diff --git a/oss/vtiger/trunk/Releases/vTiger_zh_cn_5.1_20100618.zip b/oss/vtiger/trunk/Releases/vTiger_zh_cn_5.1_20100618.zip new file mode 100644 index 00000000..490f9e28 Binary files /dev/null and b/oss/vtiger/trunk/Releases/vTiger_zh_cn_5.1_20100618.zip differ diff --git a/oss/vtiger/trunk/Smarty/templates_c/%%47^47F^47FECAC7%%AddPickList.tpl.php b/oss/vtiger/trunk/Smarty/templates_c/%%47^47F^47FECAC7%%AddPickList.tpl.php new file mode 100644 index 00000000..c46f6c5f --- /dev/null +++ b/oss/vtiger/trunk/Smarty/templates_c/%%47^47F^47FECAC7%%AddPickList.tpl.php @@ -0,0 +1,86 @@ + +
+ + + + +
_tpl_vars['MOD']['ADD_PICKLIST_VALUES']; ?> + - _tpl_vars['FIELDLABEL']; ?> +
+ + + + + + + + + + + + + +
+ _tpl_vars['MOD']['LBL_EXISTING_PICKLIST_VALUES']; ?> + +
+ + _tpl_vars['PICKVAL']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['pick_val']): +?> + + + + +
+ _tpl_vars['pick_val']; ?> + +
+
+
+ _tpl_vars['NONEDITPICKLIST'] )): ?> + _tpl_vars['MOD']['LBL_NON_EDITABLE_PICKLIST_ENTRIES']; ?> + : +
+ + _tpl_vars['NONEDITPICKLIST']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['nonedit']): +?> + + + + +
+ + _tpl_vars['nonedit']; ?> + + +
+
+ +
+ _tpl_vars['MOD']['LBL_PICKLIST_ADDINFO']; ?> + + +
+ _tpl_vars['MOD']['LBL_SELECT_ROLES']; ?> +
+ +
+ + +
+
\ No newline at end of file diff --git a/oss/vtiger/trunk/Smarty/templates_c/%%AB^AB0^AB08D088%%ShowRoleSelect.tpl.php b/oss/vtiger/trunk/Smarty/templates_c/%%AB^AB0^AB08D088%%ShowRoleSelect.tpl.php new file mode 100644 index 00000000..22205088 --- /dev/null +++ b/oss/vtiger/trunk/Smarty/templates_c/%%AB^AB0^AB08D088%%ShowRoleSelect.tpl.php @@ -0,0 +1,13 @@ + +_tpl_vars['MOD']['LBL_SELECT_ROLES']; ?> +
+ \ No newline at end of file diff --git a/oss/vtiger/trunk/cache/513d62bd4346d3dc095da948ef81b9a1 b/oss/vtiger/trunk/cache/513d62bd4346d3dc095da948ef81b9a1 index 5c3cbd18..fd23bd42 100644 --- a/oss/vtiger/trunk/cache/513d62bd4346d3dc095da948ef81b9a1 +++ b/oss/vtiger/trunk/cache/513d62bd4346d3dc095da948ef81b9a1 @@ -1,10 +1,68 @@ -O:9:"MagpieRSS":23:{s:6:"parser";i:0;s:12:"current_item";a:0:{}s:5:"items";a:20:{i:0;a:8:{s:5:"title";s:57:"如何添加“事件”中的选项才能正确显示?";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=794";s:11:"description";s:873:"我在下拉框编辑项的事件中,在电话、会议外添加“通知、备忘”等选项,但在客户中添加“通知”的相应内容时,在成功保存后却无法显示。但在事件还可以找到相应的内容,就是无法与客户相联系。只有修改电话或者会议后,才可以捆绑两者的联系并成功显示。 - 请问应该如何设 ... -


-

";s:8:"category";s:6:"Vtiger";s:6:"author";s:9:"southlion";s:7:"pubdate";s:31:"Thu, 17 Jun 2010 13:43:17 +0000";s:7:"summary";s:873:"我在下拉框编辑项的事件中,在电话、会议外添加“通知、备忘”等选项,但在客户中添加“通知”的相应内容时,在成功保存后却无法显示。但在事件还可以找到相应的内容,就是无法与客户相联系。只有修改电话或者会议后,才可以捆绑两者的联系并成功显示。 - 请问应该如何设 ... -


-

";s:14:"date_timestamp";i:1276782197;}i:1;a:8:{s:5:"title";s:21:"网页邮件不能用";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=786";s:11:"description";s:833:"VT有个网页邮件的功能,我点击的时候提示我: +O:9:"MagpieRSS":23:{s:6:"parser";i:0;s:12:"current_item";a:0:{}s:5:"items";a:20:{i:0;a:8:{s:5:"title";s:73:"有一个问题: 下拉框编辑的界面是乱码,我该怎么处理呢?";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=801";s:11:"description";s:765:"有一个问题: 下拉框编辑的界面是乱码,我该怎么处理呢? 我哪里弄错了? 如果修改,我怎么修改呢? 谢谢了! + +另外:下拉框编辑我怎么改动不成功呢?好像缺少按钮了! 我的系统缺少文件? + + +截图如下: + +1419[/attach] ... +


+

";s:8:"category";s:6:"Vtiger";s:6:"author";s:11:"davidyang99";s:7:"pubdate";s:31:"Fri, 18 Jun 2010 16:10:37 +0000";s:7:"summary";s:765:"有一个问题: 下拉框编辑的界面是乱码,我该怎么处理呢? 我哪里弄错了? 如果修改,我怎么修改呢? 谢谢了! + +另外:下拉框编辑我怎么改动不成功呢?好像缺少按钮了! 我的系统缺少文件? + + +截图如下: + +1419[/attach] ... +


+

";s:14:"date_timestamp";i:1276877437;}i:1;a:8:{s:5:"title";s:70:"求救: 这个问题怎么解决?文件管理无法浏览上传文件?";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=800";s:11:"description";s:684:"在"文件管理"下面,怎么把文件增加进去呢? 没有浏览菜单呀! 谁有类似的问题呀? 还是我哪里错了? 帮忙解决一下,谢谢! + +截图如下: +1418[/attach] +


+

";s:8:"category";s:6:"Vtiger";s:6:"author";s:11:"davidyang99";s:7:"pubdate";s:31:"Fri, 18 Jun 2010 15:58:26 +0000";s:7:"summary";s:684:"在"文件管理"下面,怎么把文件增加进去呢? 没有浏览菜单呀! 谁有类似的问题呀? 还是我哪里错了? 帮忙解决一下,谢谢! + +截图如下: +1418[/attach] +


+

";s:14:"date_timestamp";i:1276876706;}i:2;a:8:{s:5:"title";s:79:"大家有没有遇到过这样的问题。invoice生成pdf文件成这个样子";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=799";s:11:"description";s:830:"[i=s] 本帖最后由 tkboy 于 2010-6-18 20:04 编辑 [/i] + +1416[/attach] + + + + +在saleorder生成的pdf却没问题。六页每页6个产品。而在invoice生成第二页就不行了。而且还生成了五百多页 + + +1417[/attach] + +还有个情况就是在数量多的产品和产品描述很长的时候就会出现这个情况。12 ... +


+

";s:8:"category";s:6:"Vtiger";s:6:"author";s:5:"tkboy";s:7:"pubdate";s:31:"Fri, 18 Jun 2010 11:58:43 +0000";s:7:"summary";s:830:"[i=s] 本帖最后由 tkboy 于 2010-6-18 20:04 编辑 [/i] + +1416[/attach] + + + + +在saleorder生成的pdf却没问题。六页每页6个产品。而在invoice生成第二页就不行了。而且还生成了五百多页 + + +1417[/attach] + +还有个情况就是在数量多的产品和产品描述很长的时候就会出现这个情况。12 ... +


+

";s:14:"date_timestamp";i:1276862323;}i:3;a:8:{s:5:"title";s:57:"如何添加“事件”中的选项才能正确显示?";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=794";s:11:"description";s:875:"我在下拉框编辑项的事件中,在电话、会议外添加“通知、备忘”等选项,但在客户中添加“通知”的相应内容时,在成功保存后却无法显示。但在事件还可以找到相应的内容,就是无法与客户相联系。只有修改电话或者会议后,才可以捆绑两者的联系并成功显示。 + +请问应该如何设置添 ... +


+

";s:8:"category";s:6:"Vtiger";s:6:"author";s:9:"southlion";s:7:"pubdate";s:31:"Thu, 17 Jun 2010 13:43:17 +0000";s:7:"summary";s:875:"我在下拉框编辑项的事件中,在电话、会议外添加“通知、备忘”等选项,但在客户中添加“通知”的相应内容时,在成功保存后却无法显示。但在事件还可以找到相应的内容,就是无法与客户相联系。只有修改电话或者会议后,才可以捆绑两者的联系并成功显示。 + +请问应该如何设置添 ... +


+

";s:14:"date_timestamp";i:1276782197;}i:4;a:8:{s:5:"title";s:21:"网页邮件不能用";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=786";s:11:"description";s:833:"VT有个网页邮件的功能,我点击的时候提示我: 无法连接到邮件服务器。请检查邮件服务器的细节 这. 请 点击这里 电子邮件模块 [/b] @@ -26,7 +84,7 @@ http://forums.hawebs.net/computer/viewthread.php?tid=221&highli ... 之前看了这个帖子: http://forums.hawebs.net/computer/viewthread.php?tid=221&highli ...


-

";s:14:"date_timestamp";i:1276670948;}i:2;a:8:{s:5:"title";s:24:"导出数据乱码问题";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=767";s:11:"description";s:853:"[i=s] 本帖最后由 mydream 于 2010-6-12 19:21 编辑 [/i] +

";s:14:"date_timestamp";i:1276670948;}i:5;a:8:{s:5:"title";s:24:"导出数据乱码问题";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=767";s:11:"description";s:853:"[i=s] 本帖最后由 mydream 于 2010-6-12 19:21 编辑 [/i] 选择导出用户资料,都是乱码,我用数据库工具查看表中数据也是乱码。字符集编码我已经设置为utf-8了,这是为什么呢。。。。。 @@ -42,7 +100,7 @@ http://forums.hawebs.net/computer/viewthread.php?tid=221&highli ... 就是在导出客户信息或者其他数据的时候,到处成一个e ...


-

";s:14:"date_timestamp";i:1276332879;}i:3;a:8:{s:5:"title";s:53:"唉 纠结啊 vtiger生成的pdf文档还是有问题";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=766";s:11:"description";s:675:"vtiger V5.1版本还有 5.2版本生成的pdf文档中折扣和税款部分显示的数字不能超过3位 +

";s:14:"date_timestamp";i:1276332879;}i:6;a:8:{s:5:"title";s:53:"唉 纠结啊 vtiger生成的pdf文档还是有问题";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=766";s:11:"description";s:675:"vtiger V5.1版本还有 5.2版本生成的pdf文档中折扣和税款部分显示的数字不能超过3位 订单上的金额 1327[/attach] 生成pdf文档上面的金额 @@ -54,7 +112,7 @@ http://forums.hawebs.net/computer/viewthread.php?tid=221&highli ... 生成pdf文档上面的金额 1328[/attach]


-

";s:14:"date_timestamp";i:1276327521;}i:4;a:8:{s:5:"title";s:59:"请教vtiger V5.1备份数据库功能使用后如何还原";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=765";s:11:"description";s:750:"这几天玩vtiger 突然发现两个问题 +

";s:14:"date_timestamp";i:1276327521;}i:7;a:8:{s:5:"title";s:59:"请教vtiger V5.1备份数据库功能使用后如何还原";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=765";s:11:"description";s:750:"这几天玩vtiger 突然发现两个问题 1.vtiger V5.1里的备份数据库功能是否是备份所有的数据?(包含客户资料、自己上传的文件等) @@ -74,7 +132,7 @@ http://forums.hawebs.net/computer/viewthread.php?tid=221&highli ... 嘿嘿 ...


-

";s:14:"date_timestamp";i:1276306122;}i:5;a:8:{s:5:"title";s:70:"vTiger 运行时出现错误 Sorry! Attempt to access restricted file.";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=762";s:11:"description";s:660:"vTiger 运行时出现错误 +

";s:14:"date_timestamp";i:1276306122;}i:8;a:8:{s:5:"title";s:70:"vTiger 运行时出现错误 Sorry! Attempt to access restricted file.";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=762";s:11:"description";s:660:"vTiger 运行时出现错误 Sorry! Attempt to access restricted file. @@ -90,7 +148,7 @@ Sorry! Attempt to access restricted file. 这是因为 vTiger 的运行配置文件的文件绝对路径配置不正确。


-

";s:14:"date_timestamp";i:1276287837;}i:6;a:8:{s:5:"title";s:60:"解决Vtiger在导出PDF文件中文字符为乱码的方法";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=761";s:11:"description";s:846:"使用中发现Vtiger在导出PDF文件的时候,中文字符为乱码,按照网上介绍的方法,结合此版本,找到了解决的方法,此问题的主要原因在于tcpdf中对字符的引用问题,如果使用的是Vtiger5.1版本中自 +

";s:14:"date_timestamp";i:1276287837;}i:9;a:8:{s:5:"title";s:60:"解决Vtiger在导出PDF文件中文字符为乱码的方法";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=761";s:11:"description";s:846:"使用中发现Vtiger在导出PDF文件的时候,中文字符为乱码,按照网上介绍的方法,结合此版本,找到了解决的方法,此问题的主要原因在于tcpdf中对字符的引用问题,如果使用的是Vtiger5.1版本中自 带的tcpdf,仅需要修改include\tcpdf\tcpdf.php文件即可。将文件中2674行的 $fami ... @@ -100,7 +158,7 @@ $fami ... 带的tcpdf,仅需要修改include\tcpdf\tcpdf.php文件即可。将文件中2674行的 $fami ...


-

";s:14:"date_timestamp";i:1276264329;}i:7;a:8:{s:5:"title";s:32:"PBXManager 语言文件已发布";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=759";s:11:"description";s:803:"PBXManager 的中文语言文件已经发布到 SVN 服务器上了 +

";s:14:"date_timestamp";i:1276264329;}i:10;a:8:{s:5:"title";s:32:"PBXManager 语言文件已发布";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=759";s:11:"description";s:803:"PBXManager 的中文语言文件已经发布到 SVN 服务器上了 地址为 @@ -120,11 +178,11 @@ http://hawebs.svn.sourceforge.net/viewvc/hawebs/oss/vtiger/trunk/modules/PBXMana 在使用手机方式的时候,如果你是 ...


-

";s:14:"date_timestamp";i:1276197531;}i:8;a:8:{s:5:"title";s:15:"总算回来了";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=757";s:11:"description";s:506:"真不容易啊 +

";s:14:"date_timestamp";i:1276197531;}i:11;a:8:{s:5:"title";s:15:"总算回来了";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=757";s:11:"description";s:506:"真不容易啊


";s:8:"category";s:6:"Vtiger";s:6:"author";s:5:"qqing";s:7:"pubdate";s:31:"Thu, 10 Jun 2010 05:48:50 +0000";s:7:"summary";s:506:"真不容易啊


-

";s:14:"date_timestamp";i:1276148930;}i:9;a:8:{s:5:"title";s:66:"找到一个易客集成Discuz组件包望高手能整合到vtiger";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=756";s:11:"description";s:823:"不多说上附件 +

";s:14:"date_timestamp";i:1276148930;}i:12;a:8:{s:5:"title";s:66:"找到一个易客集成Discuz组件包望高手能整合到vtiger";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=756";s:11:"description";s:823:"不多说上附件 易客CRM集成Discuz5.0论坛的教程在引用里 易客CRM集成Discuz5.0论坛 安装步骤: @@ -144,7 +202,7 @@ http://hawebs.svn.sourceforge.net/viewvc/hawebs/oss/vtiger/trunk/modules/PBXMana 4)通过phpmyadmin导入bbs/discuz5.sql文件到CRM数据库中 ...


-

";s:14:"date_timestamp";i:1276136267;}i:10;a:8:{s:5:"title";s:48:"如何在 vTiger 5.1 中使用手机扩展模块";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=755";s:11:"description";s:830:"假设当前你已经成功的安装了手机扩展模块。 +

";s:14:"date_timestamp";i:1276136267;}i:13;a:8:{s:5:"title";s:48:"如何在 vTiger 5.1 中使用手机扩展模块";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=755";s:11:"description";s:830:"假设当前你已经成功的安装了手机扩展模块。 使用手机访问的地址为: @@ -172,7 +230,7 @@ http://192.168.1.102/modules/Mobile[/url] 在你手机上输入上述地址,如果你的这个模块是部署在公共网 ...


-

";s:14:"date_timestamp";i:1276099691;}i:11;a:8:{s:5:"title";s:41:"vtiger 5.1 手机扩展模块安装过程";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=754";s:11:"description";s:831:"vTiger CRM 的移动扩展模块主要是向移动设备能够提供一个基本的 WEB 界面。 +

";s:14:"date_timestamp";i:1276099691;}i:14;a:8:{s:5:"title";s:41:"vtiger 5.1 手机扩展模块安装过程";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=754";s:11:"description";s:831:"vTiger CRM 的移动扩展模块主要是向移动设备能够提供一个基本的 WEB 界面。 首先你需要下载 Mobile 的扩展插件,插件版本被表述为 Mobile-x.y.zip, 你可以通过 Google 进行搜索,也可以在本站里面查找。 @@ -188,11 +246,11 @@ http://192.168.1.102/modules/Mobile[/url] [url=http://forums.hawebs.net/computer/ ...


-

";s:14:"date_timestamp";i:1276098343;}i:12;a:8:{s:5:"title";s:52:"vtiger CRM 5.1.0手机扩展插件的安装与使用";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=752";s:11:"description";s:565:"不多说了.有需要的朋友自己去下载附件,自己去安装使用 +

";s:14:"date_timestamp";i:1276098343;}i:15;a:8:{s:5:"title";s:52:"vtiger CRM 5.1.0手机扩展插件的安装与使用";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=752";s:11:"description";s:565:"不多说了.有需要的朋友自己去下载附件,自己去安装使用


";s:8:"category";s:6:"Vtiger";s:6:"author";s:7:"dasunny";s:7:"pubdate";s:31:"Wed, 09 Jun 2010 01:20:35 +0000";s:7:"summary";s:565:"不多说了.有需要的朋友自己去下载附件,自己去安装使用


-

";s:14:"date_timestamp";i:1276046435;}i:13;a:8:{s:5:"title";s:73:"发一个极品帖vtiger CRM的主要目录结构及主要数据库结构";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=749";s:11:"description";s:609:"[i=s] 本帖最后由 dasunny 于 2010-6-8 17:45 编辑 [/i] +

";s:14:"date_timestamp";i:1276046435;}i:16;a:8:{s:5:"title";s:73:"发一个极品帖vtiger CRM的主要目录结构及主要数据库结构";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=749";s:11:"description";s:609:"[i=s] 本帖最后由 dasunny 于 2010-6-8 17:45 编辑 [/i] 找了很久的好东西,在这里贴出来大家共享.


@@ -200,7 +258,7 @@ http://192.168.1.102/modules/Mobile[/url] 找了很久的好东西,在这里贴出来大家共享.


-

";s:14:"date_timestamp";i:1275987412;}i:14;a:8:{s:5:"title";s:32:"VT显示模块和子模块问题";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=748";s:11:"description";s:866:"现在我有一个职位的权限只有“网页邮件”和“日程安排” +

";s:14:"date_timestamp";i:1275987412;}i:17;a:8:{s:5:"title";s:32:"VT显示模块和子模块问题";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=748";s:11:"description";s:866:"现在我有一个职位的权限只有“网页邮件”和“日程安排” 但登录后还是显示4个模块 @@ -216,7 +274,7 @@ http://192.168.1.102/modules/Mobile[/url] 因为除工作台外的那三个模块下都有“网页邮件”或“日程安排”,这样就显得有些多余,怎么给他去掉呢,还有很多模块下都存在这样的问题,不同模块下拥有相同子模块,比如“ ...


-

";s:14:"date_timestamp";i:1275978656;}i:15;a:8:{s:5:"title";s:18:"vtiger权限问题";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=745";s:11:"description";s:692:"用户管理里有: +

";s:14:"date_timestamp";i:1275978656;}i:18;a:8:{s:5:"title";s:18:"vtiger权限问题";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=745";s:11:"description";s:692:"用户管理里有: 用户、职位、权限、用户组 @@ -232,7 +290,7 @@ http://192.168.1.102/modules/Mobile[/url] 比如分配某个权限给职位,然后职位属于某个组还是怎么样呢?求解


-

";s:14:"date_timestamp";i:1275958515;}i:16;a:8:{s:5:"title";s:52:"求助 vitger在添加新记录时添加时间错误";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=744";s:11:"description";s:673:"我6月8号早上8点45分添加的一条记录,但添加完一查看时间却是:2010-06-08 00:42:42 +

";s:14:"date_timestamp";i:1275958515;}i:19;a:8:{s:5:"title";s:52:"求助 vitger在添加新记录时添加时间错误";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=744";s:11:"description";s:673:"我6月8号早上8点45分添加的一条记录,但添加完一查看时间却是:2010-06-08 00:42:42 有人遇到类似的问题吗,或者谁知道解决办法 @@ -244,36 +302,6 @@ http://192.168.1.102/modules/Mobile[/url] 1263[/attach]


-

";s:14:"date_timestamp";i:1275958069;}i:17;a:8:{s:5:"title";s:76:"求助vtiger CRM 5.1.0中文汉化版本导出生产的PDF文档中文乱码";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=743";s:11:"description";s:619:"我在用vtiger CRM 5.1.0中文汉化版本导出的PDF文档中文部分是乱码,望高手帮忙看看 -如下图 -1261[/attach] -


-

";s:8:"category";s:6:"Vtiger";s:6:"author";s:7:"dasunny";s:7:"pubdate";s:31:"Mon, 07 Jun 2010 11:15:18 +0000";s:7:"summary";s:619:"我在用vtiger CRM 5.1.0中文汉化版本导出的PDF文档中文部分是乱码,望高手帮忙看看 -如下图 -1261[/attach] -


-

";s:14:"date_timestamp";i:1275909318;}i:18;a:8:{s:5:"title";s:70:"目前找到最完美的vtiger CRM 5.1.0简体中文包与安装教程";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=742";s:11:"description";s:641:"vtiger CRM 5.1.0 简体中文包 - -下载地址:http://www.xdowns.com/soft/softdown.asp?softid=61300[/url] - 安装教程在附件里,大家自己下载 -


-

";s:8:"category";s:6:"Vtiger";s:6:"author";s:7:"dasunny";s:7:"pubdate";s:31:"Mon, 07 Jun 2010 08:12:03 +0000";s:7:"summary";s:641:"vtiger CRM 5.1.0 简体中文包 - -下载地址:http://www.xdowns.com/soft/softdown.asp?softid=61300[/url] - 安装教程在附件里,大家自己下载 -


-

";s:14:"date_timestamp";i:1275898323;}i:19;a:8:{s:5:"title";s:51:"vTiger 5.1 邮件扫描 Trouble Ticket 更新规则";s:4:"link";s:56:"http://forums.hawebs.net/computer/viewthread.php?tid=687";s:11:"description";s:824:"在 vTiger 5.1 进行邮件扫描时,使用正则表达式对用户回复的邮件的主题进行匹配。 - -如果成功后,将会更新指定 Trouble Ticket ID 的状态。 - -其正则表达式为:Ticket Id[^:]?: ([0-9]+)[/code]如果用户回复邮件的主题为:RE: TT13 [ Ticket Id : 140 ] Re : 服务请求[/code]那 ... -


-

";s:8:"category";s:6:"Vtiger";s:6:"author";s:10:"honeymoose";s:7:"pubdate";s:31:"Mon, 31 May 2010 20:39:00 +0000";s:7:"summary";s:824:"在 vTiger 5.1 进行邮件扫描时,使用正则表达式对用户回复的邮件的主题进行匹配。 - -如果成功后,将会更新指定 Trouble Ticket ID 的状态。 - -其正则表达式为:Ticket Id[^:]?: ([0-9]+)[/code]如果用户回复邮件的主题为:RE: TT13 [ Ticket Id : 140 ] Re : 服务请求[/code]那 ... -


-

";s:14:"date_timestamp";i:1275338340;}}s:7:"channel";a:8:{s:5:"title";s:25:"OSS 计算技术 - Vtiger";s:4:"link";s:57:"http://forums.hawebs.net/computer/forumdisplay.php?fid=50";s:11:"description";s:27:"Latest 20 threads of Vtiger";s:9:"copyright";s:29:"Copyright(C) OSS 计算技术";s:9:"generator";s:13:"HX WEBSYSTEMS";s:13:"lastbuilddate";s:31:"Thu, 17 Jun 2010 14:53:45 +0000";s:3:"ttl";s:2:"30";s:7:"tagline";s:27:"Latest 20 threads of Vtiger";}s:9:"textinput";a:0:{}s:5:"image";a:3:{s:3:"url";s:49:"http://forums.hawebs.net/computer/images/logo.gif";s:5:"title";s:16:"OSS 计算技术";s:4:"link";s:34:"http://forums.hawebs.net/computer/";}s:9:"feed_type";s:3:"RSS";s:12:"feed_version";s:3:"2.0";s:8:"encoding";s:5:"UTF-8";s:16:"_source_encoding";s:0:"";s:5:"ERROR";s:0:"";s:7:"WARNING";s:0:"";s:19:"_CONTENT_CONSTRUCTS";a:6:{i:0;s:7:"content";i:1;s:7:"summary";i:2;s:4:"info";i:3;s:5:"title";i:4;s:7:"tagline";i:5;s:9:"copyright";}s:16:"_KNOWN_ENCODINGS";a:3:{i:0;s:5:"UTF-8";i:1;s:8:"US-ASCII";i:2;s:10:"ISO-8859-1";}s:5:"stack";a:0:{}s:9:"inchannel";b:0;s:6:"initem";b:0;s:9:"incontent";b:0;s:11:"intextinput";b:0;s:7:"inimage";b:0;s:17:"current_namespace";b:0;s:13:"last_modified";s:31:"Thu, 17 Jun 2010 14:57:56 GMT -";s:4:"etag";s:29:"usZRTNF8BzcbMKnEIYmXsVmlSNQ +

";s:14:"date_timestamp";i:1275958069;}}s:7:"channel";a:8:{s:5:"title";s:25:"OSS 计算技术 - Vtiger";s:4:"link";s:57:"http://forums.hawebs.net/computer/forumdisplay.php?fid=50";s:11:"description";s:27:"Latest 20 threads of Vtiger";s:9:"copyright";s:29:"Copyright(C) OSS 计算技术";s:9:"generator";s:13:"HX WEBSYSTEMS";s:13:"lastbuilddate";s:31:"Fri, 18 Jun 2010 21:57:35 +0000";s:3:"ttl";s:2:"30";s:7:"tagline";s:27:"Latest 20 threads of Vtiger";}s:9:"textinput";a:0:{}s:5:"image";a:3:{s:3:"url";s:49:"http://forums.hawebs.net/computer/images/logo.gif";s:5:"title";s:16:"OSS 计算技术";s:4:"link";s:34:"http://forums.hawebs.net/computer/";}s:9:"feed_type";s:3:"RSS";s:12:"feed_version";s:3:"2.0";s:8:"encoding";s:5:"UTF-8";s:16:"_source_encoding";s:0:"";s:5:"ERROR";s:0:"";s:7:"WARNING";s:0:"";s:19:"_CONTENT_CONSTRUCTS";a:6:{i:0;s:7:"content";i:1;s:7:"summary";i:2;s:4:"info";i:3;s:5:"title";i:4;s:7:"tagline";i:5;s:9:"copyright";}s:16:"_KNOWN_ENCODINGS";a:3:{i:0;s:5:"UTF-8";i:1;s:8:"US-ASCII";i:2;s:10:"ISO-8859-1";}s:5:"stack";a:0:{}s:9:"inchannel";b:0;s:6:"initem";b:0;s:9:"incontent";b:0;s:11:"intextinput";b:0;s:7:"inimage";b:0;s:17:"current_namespace";b:0;s:13:"last_modified";s:31:"Fri, 18 Jun 2010 21:57:37 GMT +";s:4:"etag";s:29:"pnSP1GkzAR7kAw1LFKf0ONj7X6s ";} \ No newline at end of file diff --git a/oss/vtiger/trunk/include/database/PearDatabase.php b/oss/vtiger/trunk/include/database/PearDatabase.php new file mode 100644 index 00000000..9bcc07fb --- /dev/null +++ b/oss/vtiger/trunk/include/database/PearDatabase.php @@ -0,0 +1,1148 @@ +ctr = 0; + $this->vals = $vals; + } + function call($matches){ + /** + * If ? is found as expected in regex used in function convert2sql + * /('[^']*')|(\"[^\"]*\")|([?])/ + * + */ + if($matches[3]=='?'){ + $this->ctr++; + return $this->vals[$this->ctr-1]; + }else{ + return $matches[0]; + } + } +} + +/** + * Performance perference API + */ +@include_once('config.performance.php'); // Ignore warning if not present +class PerformancePrefs { + /** + * Get performance parameter configured value or default one + */ + static function get($key, $defvalue=false) { + global $PERFORMANCE_CONFIG; + if(isset($PERFORMANCE_CONFIG)){ + if(isset($PERFORMANCE_CONFIG[$key])) { + return $PERFORMANCE_CONFIG[$key]; + } + } + return $defvalue; + } + /** Get boolean value */ + static function getBoolean($key, $defvalue=false) { + return self::get($key, $defvalue); + } + /** Get Integer value */ + static function getInteger($key, $defvalue=false) { + return intval(self::get($key, $defvalue)); + } +} + +/** + * Cache Class for PearDatabase + */ +class PearDatabaseCache { + var $_queryResultCache = Array(); + var $_parent; + + // Cache the result if rows is less than this + var $_CACHE_RESULT_ROW_LIMIT; + + /** + * Constructor + */ + function __construct($parent) { + $this->_parent = $parent; + $this->_CACHE_RESULT_ROW_LIMIT = PerformancePrefs::getInteger('CACHE_RESULT_ROW_LIMIT', 100); + } + + /** + * Reset the cache contents + */ + function resetCache() { + unset($this->_queryResultCache); + $this->_queryResultCache = Array(); + } + + /** + * Cache SQL Query Result (perferably only SELECT SQL) + */ + function cacheResult($result, $sql, $params=false) { + // We don't want to cache NON-SELECT query results now + if(stripos(trim($sql), 'SELECT ') !== 0) { + return; + } + // If the result is too big, don't cache it + if($this->_parent->num_rows($result) > $this->_CACHE_RESULT_ROW_LIMIT) { + global $log; + $log->fatal("[" . get_class($this) . "] Cannot cache result! $sql [Exceeds limit ". + $this->_CACHE_RESULT_ROW_LIMIT . ", Total Rows " . $this->_parent->num_rows($result) . "]"); + return false; + } + $usekey = $sql; + if(!empty($params)) $usekey = $this->_parent->convert2Sql($sql, $this->_parent->flatten_array($params)); + $this->_queryResultCache[$usekey] = $result; + } + + /** + * Get the cached result for re-use + */ + function getCacheResult($sql, $params=false) { + $result = false; + $usekey = $sql; + if(!empty($params)) $usekey = $this->_parent->convert2Sql($sql, $this->_parent->flatten_array($params)); + $result = $this->_queryResultCache[$usekey]; + // Rewind the result for re-use + if($result) { + // If result not in use rewind it + if($result->EOF) $result->MoveFirst(); + else if($result->CurrentRow() != 0) { + global $log; + $log->fatal("[" . get_class($this) . "] Cannot reuse result! $usekey [Rows Total " . + $this->_parent->num_rows($result) . ", Currently At: " . $result->CurrentRow() . "]"); + // Do no allow result to be re-used if it is in use. + $result = false; + } + } + return $result; + } +} + +class PearDatabase{ + var $database = null; + var $dieOnError = false; + var $dbType = null; + var $dbHostName = null; + var $dbName = null; + var $dbOptions = null; + var $userName=null; + var $userPassword=null; + var $query_time = 0; + var $log = null; + var $lastmysqlrow = -1; + var $enableSQLlog = false; + var $continueInstallOnError = true; + + // If you want to avoid executing PreparedStatement, set this to true + // PreparedStatement will be converted to normal SQL statement for execution + var $avoidPreparedSql = false; + + /** + * Performance tunning parameters (can be configured through performance.prefs.php) + * See the constructor for initialization + */ + var $isdb_default_utf8_charset = false; + var $enableCache = false; + + var $_cacheinstance = false; // Will be auto-matically initialized if $enableCache is true + /** + * API's to control cache behavior + */ + function __setCacheInstance($cacheInstance) { + $this->_cacheinstance = $cacheInstance; + } + /** Return the cache instance reference (using &) */ + function &getCacheInstance() { + return $this->_cacheinstance; + } + function isCacheEnabled() { + return ($this->enableCache && ($this->getCacheInstance() != false)); + } + function clearCache() { + if($this->isCacheEnabled()) $this->getCacheInstance()->resetCache(); + } + function toggleCache($newstatus) { + $oldstatus = $this->enableCache; + $this->enableCache = $newstatus; + return $oldstatus; + } + // END + + /** + * Manage instance usage of this class + */ + static function &getInstance() { + global $adb, $log; + + $multiConnection = PerformancePrefs::getBoolean('ALLOW_MULTI_DB_CONNECTION_PER_REQUEST', true); + if(!$multiConnection) { + // Reuse the instance + if(!isset($adb)) { + $adb = new self(); + } + return $adb; + } else { + // Create new instance + return (new self()); + } + } + // END + + /* + * Reset query result for resuing if cache is enabled. + */ + function resetQueryResultToEOF(&$result) { + if($result) { + if($result->MoveLast()) { + $result->MoveNext(); + } + } + } + // END + + function isMySQL() { return (stripos($this->dbType ,'mysql') === 0);} + function isOracle() { return $this->dbType=='oci8'; } + function isPostgres() { return $this->dbType=='pgsql'; } + + function println($msg) + { + require_once('include/logging.php'); + $log1 =& LoggerManager::getLogger('VT'); + if(is_array($msg)) { + $log1->info("PearDatabse ->".print_r($msg,true)); + } else { + $log1->info("PearDatabase ->".$msg); + } + return $msg; + } + + function setDieOnError($value){ $this->dieOnError = $value; } + function setDatabaseType($type){ $this->dbType = $type; } + function setUserName($name){ $this->userName = $name; } + + function setOption($name, $value){ + if(isset($this->dbOptions)) $this->dbOptions[$name] = $value; + if(isset($this->database)) $this->database->setOption($name, $value); + } + + function setUserPassword($pass){ $this->userPassword = $pass; } + function setDatabaseName($db){ $this->dbName = $db; } + function setDatabaseHost($host){ $this->dbHostName = $host; } + + function getDataSourceName(){ + return $this->dbType. "://".$this->userName.":".$this->userPassword."@". $this->dbHostName . "/". $this->dbName; + } + + function startTransaction() { + if($this->isPostgres()) return; + $this->checkConnection(); + $this->println("TRANS Started"); + $this->database->StartTrans(); + } + + function completeTransaction() { + if($this->isPostgres()) return; + if($this->database->HasFailedTrans()) $this->println("TRANS Rolled Back"); + else $this->println("TRANS Commited"); + + $this->database->CompleteTrans(); + $this->println("TRANS Completed"); + } + + function hasFailedTransaction(){ return $this->database->HasFailedTrans(); } + + function checkError($msg='', $dieOnError=false) { + if($this->dieOnError || $dieOnError) { + $this->println("ADODB error ".$msg."->[".$this->database->ErrorNo()."]".$this->database->ErrorMsg()); + die ($msg."ADODB error ".$msg."->".$this->database->ErrorMsg()); + } else { + $this->println("ADODB error ".$msg."->[".$this->database->ErrorNo()."]".$this->database->ErrorMsg()); + } + return false; + } + + function change_key_case($arr) { + return is_array($arr)?array_change_key_case($arr):$arr; + } + + var $req_flist; + function checkConnection(){ + global $log; + + if(!isset($this->database)) { + $this->println("TRANS creating new connection"); + $this->connect(false); + } else { + //$this->println("checkconnect using old connection"); + } + } + + /** + * Put out the SQL timing information + */ + function logSqlTiming($startat, $endat, $sql, $params=false) { + global $logsqltm; + // Specifically for timing the SQL execution, you need to enable DEBUG in log4php.properties + if($logsqltm->isDebugEnabled()){ + if(PerformancePrefs::getBoolean('SQL_LOG_INCLUDE_CALLER', false)) { + $callers = debug_backtrace(); + $callerscount = count($callers); + $callerfunc = ''; + for($calleridx = 0; $calleridx < $callerscount; ++$calleridx) { + if($calleridx == 0) { + // Ignore the first caller information, it will be generally from this file! + continue; + } + // Caller function will be in next information block + if($calleridx < $callerscount) { + $callerfunc = $callers[$calleridx+1]['function']; + if(!empty($callerfunc)) $callerfunc = " ($callerfunc) "; + } + $logsqltm->debug( + "CALLER: (" . $callers[$calleridx]['line'] . ') ' . + $callers[$calleridx]['file'] . $callerfunc); + } + } + $logsqltm->debug("SQL: " . $sql); + if($params != null && count($params) > 0) $logsqltm->debug("PARAMS: [" . implode(",", $params) . "]"); + $logsqltm->debug("EXEC: " . ($endat - $startat) ." micros [START=$startat, END=$endat]"); + $logsqltm->debug(""); + } + } + + /** + * Execute SET NAMES UTF-8 on the connection based on configuration. + */ + function executeSetNamesUTF8SQL($force = false) { + global $default_charset; + // Performance Tuning: If database default charset is UTF-8, we don't need this + if(strtoupper($default_charset) == 'UTF-8' && ($force || !$this->isdb_default_utf8_charset)) { + + $sql_start_time = microtime(true); + + $setnameSql = "SET NAMES utf8"; + $this->database->Execute($setnameSql); + $this->logSqlTiming($sql_start_time, microtime(true), $setnameSql); + } + } + + /** + * Execute query in a batch. + * + * For example: + * INSERT INTO TABLE1 VALUES (a,b); + * INSERT INTO TABLE1 VALUES (c,d); + * + * like: INSERT INTO TABLE1 VALUES (a,b), (c,d) + */ + function query_batch($prefixsql, $valuearray) { + if(PerformancePrefs::getBoolean('ALLOW_SQL_QUERY_BATCH')) { + $sql = $prefixsql; + $suffixsql = $valuearray; + if(!is_array($valuearray)) $suffixsql = implode(',', $valuearray); + $this->query($prefixsql . $suffixsql); + } else { + if(is_array($valuearray) && !empty($valuearray)) { + foreach($valuearray as $suffixsql) { + $this->query($prefixsql . $suffixsql); + } + } + } + } + + function query($sql, $dieOnError=false, $msg='') + { + global $log, $default_charset; + // Performance Tuning: Have we cached the result earlier? + if($this->isCacheEnabled()) { + $fromcache = $this->getCacheInstance()->getCacheResult($sql); + if($fromcache) { + $log->debug("Using query result from cache: $sql"); + return $fromcache; + } + } + // END + $log->debug('query being executed : '.$sql); + $this->checkConnection(); + + $this->executeSetNamesUTF8SQL(); + + $sql_start_time = microtime(true); + $result = & $this->database->Execute($sql); + $this->logSqlTiming($sql_start_time, microtime(true), $sql); + + $this->lastmysqlrow = -1; + if(!$result)$this->checkError($msg.' Query Failed:' . $sql . '::', $dieOnError); + + // Performance Tuning: Cache the query result + if($this->isCacheEnabled()) { + $this->getCacheInstance()->cacheResult($result, $sql); + } + // END + return $result; + } + + + /** + * Convert PreparedStatement to SQL statement + */ + function convert2Sql($ps, $vals) { + if(empty($vals)) { return $ps; } + // TODO: Checks need to be added array out of bounds situations + for($index = 0; $index < count($vals); $index++) { + // Package import pushes data after XML parsing, so type-cast it + if(is_a($vals[$index], 'SimpleXMLElement')) { + $vals[$index] = (string) $vals[$index]; + } + if(is_string($vals[$index])) { + if($vals[$index] == '') { + $vals[$index] = $this->database->Quote($vals[$index]); + } + else { + $vals[$index] = "'".$this->sql_escape_string($vals[$index]). "'"; + } + } + if($vals[$index] === null) { + $vals[$index] = "NULL"; + } + } + $sql = preg_replace_callback("/('[^']*')|(\"[^\"]*\")|([?])/", array(new PreparedQMark2SqlValue($vals),"call"), $ps); + return $sql; + } + + /* ADODB prepared statement Execution + * @param $sql -- Prepared sql statement + * @param $params -- Parameters for the prepared statement + * @param $dieOnError -- Set to true, when query execution fails + * @param $msg -- Error message on query execution failure + */ + function pquery($sql, $params, $dieOnError=false, $msg='') { + global $log, $default_charset; + // Performance Tuning: Have we cached the result earlier? + if($this->isCacheEnabled()) { + $fromcache = $this->getCacheInstance()->getCacheResult($sql, $params); + if($fromcache) { + $log->debug("Using query result from cache: $sql"); + return $fromcache; + } + } + // END + $log->debug('Prepared sql query being executed : '.$sql); + $this->checkConnection(); + + $this->executeSetNamesUTF8SQL(); + + $sql_start_time = microtime(true); + $params = $this->flatten_array($params); + if (count($params) > 0) { + $log->debug('Prepared sql query parameters : [' . implode(",", $params) . ']'); + } + + if($this->avoidPreparedSql || empty($params)) { + $sql = $this->convert2Sql($sql, $params); + $result = &$this->database->Execute($sql); + } else { + $result = &$this->database->Execute($sql, $params); + } + $sql_end_time = microtime(true); + $this->logSqlTiming($sql_start_time, $sql_end_time, $sql, $params); + + $this->lastmysqlrow = -1; + if(!$result)$this->checkError($msg.' Query Failed:' . $sql . '::', $dieOnError); + + // Performance Tuning: Cache the query result + if($this->isCacheEnabled()) { + $this->getCacheInstance()->cacheResult($result, $sql, $params); + } + // END + return $result; + } + + /** + * Flatten the composite array into single value. + * Example: + * $input = array(10, 20, array(30, 40), array('key1' => '50', 'key2'=>array(60), 70)); + * returns array(10, 20, 30, 40, 50, 60, 70); + */ + function flatten_array($input, $output=null) { + if($input == null) return null; + if($output == null) $output = array(); + foreach($input as $value) { + if(is_array($value)) { + $output = $this->flatten_array($value, $output); + } else { + array_push($output, $value); + } + } + return $output; + } + + function getEmptyBlob($is_string=true) + { + //if(dbType=="oci8") return 'empty_blob()'; + //else return 'null'; + if (is_string) return 'null'; + return null; + } + + function updateBlob($tablename, $colname, $id, $data) + { + $this->println("updateBlob t=".$tablename." c=".$colname." id=".$id); + $this->checkConnection(); + $this->executeSetNamesUTF8SQL(); + + $sql_start_time = microtime(true); + $result = $this->database->UpdateBlob($tablename, $colname, $data, $id); + $this->logSqlTiming($sql_start_time, microtime(true), "Update Blob $tablename, $colname, $id"); + + $this->println("updateBlob t=".$tablename." c=".$colname." id=".$id." status=".$result); + return $result; + } + + function updateBlobFile($tablename, $colname, $id, $filename) + { + $this->println("updateBlobFile t=".$tablename." c=".$colname." id=".$id." f=".$filename); + $this->checkConnection(); + $this->executeSetNamesUTF8SQL(); + + $sql_start_time = microtime(true); + $result = $this->database->UpdateBlobFile($tablename, $colname, $filename, $id); + $this->logSqlTiming($sql_start_time, microtime(true), "Update Blob $tablename, $colname, $id"); + + $this->println("updateBlobFile t=".$tablename." c=".$colname." id=".$id." f=".$filename." status=".$result); + return $result; + } + + function limitQuery($sql,$start,$count, $dieOnError=false, $msg='') + { + global $log; + //$this->println("ADODB limitQuery sql=".$sql." st=".$start." co=".$count); + $log->debug(' limitQuery sql = '.$sql .' st = '.$start .' co = '.$count); + $this->checkConnection(); + + $this->executeSetNamesUTF8SQL(); + + $sql_start_time = microtime(true); + $result =& $this->database->SelectLimit($sql,$count,$start); + $this->logSqlTiming($sql_start_time, microtime(true), "$sql LIMIT $count, $start"); + + if(!$result) $this->checkError($msg.' Limit Query Failed:' . $sql . '::', $dieOnError); + return $result; + } + + function getOne($sql, $dieOnError=false, $msg='') + { + $this->println("ADODB getOne sql=".$sql); + $this->checkConnection(); + + $this->executeSetNamesUTF8SQL(); + + $sql_start_time = microtime(true); + $result =& $this->database->GetOne($sql); + $this->logSqlTiming($sql_start_time, microtime(true), "$sql GetONE"); + + if(!$result) $this->checkError($msg.' Get one Query Failed:' . $sql . '::', $dieOnError); + return $result; + } + + function getFieldsDefinition(&$result) + { + //$this->println("ADODB getFieldsArray"); + $field_array = array(); + if(! isset($result) || empty($result)) + { + return 0; + } + + $i = 0; + $n = $result->FieldCount(); + while ($i < $n) + { + $meta = $result->FetchField($i); + if (!$meta) + { + return 0; + } + array_push($field_array,$meta); + $i++; + } + + //$this->println($field_array); + return $field_array; + } + + function getFieldsArray(&$result) + { + //$this->println("ADODB getFieldsArray"); + $field_array = array(); + if(! isset($result) || empty($result)) + { + return 0; + } + + $i = 0; + $n = $result->FieldCount(); + while ($i < $n) + { + $meta = $result->FetchField($i); + if (!$meta) + { + return 0; + } + array_push($field_array,$meta->name); + $i++; + } + + //$this->println($field_array); + return $field_array; + } + + function getRowCount(&$result){ + global $log; + if(isset($result) && !empty($result)) + $rows= $result->RecordCount(); + return $rows; + } + + /* ADODB newly added. replacement for mysql_num_rows */ + function num_rows(&$result) { + return $this->getRowCount($result); + } + + /* ADODB newly added. replacement form mysql_num_fields */ + function num_fields(&$result) { + return $result->FieldCount(); + } + + /* ADODB newly added. replacement for mysql_fetch_array() */ + function fetch_array(&$result) { + if($result->EOF) { + //$this->println("ADODB fetch_array return null"); + return NULL; + } + $arr = $result->FetchRow(); + if(is_array($arr)) + $arr = array_map('to_html', $arr); + return $this->change_key_case($arr); + } + + ## adds new functions to the PearDatabase class to come around the whole + ## broken query_result() idea + ## Code-Contribution given by weigelt@metux.de - Starts + function run_query_record_html($query) { + if (!is_array($rec = $this->run_query_record($query))) + return $rec; + foreach ($rec as $walk => $cur) + $r[$walk] = to_html($cur); + return $r; + } + + function sql_quote($data) { + if (is_array($data)) { + switch($data{'type'}) { + case 'text': + case 'numeric': + case 'integer': + case 'oid': + return $this->quote($data{'value'}); + break; + case 'timestamp': + return $this->formatDate($data{'value'}); + break; + default: + throw new Exception("unhandled type: ".serialize($cur)); + } + } else + return $this->quote($data); + } + + function sql_insert_data($table, $data) { + if (!$table) + throw new Exception("missing table name"); + if (!is_array($data)) + throw new Exception("data must be an array"); + if (!count($table)) + throw new Exception("no data given"); + + $sql_fields = ''; + $sql_data = ''; + foreach($data as $walk => $cur) { + $sql_fields .= ($sql_fields?',':'').$walk; + $sql_data .= ($sql_data?',':'').$this->sql_quote($cur); + } + return 'INSERT INTO '.$table.' ('.$sql_fields.') VALUES ('.$sql_data.')'; + } + + function run_insert_data($table,$data) { + $query = $this->sql_insert_data($table,$data); + $res = $this->query($query); + $this->query("commit;"); + } + + function run_query_record($query) { + $result = $this->query($query); + if (!$result) + return; + if (!is_object($result)) + throw new Exception("query \"$query\" failed: ".serialize($result)); + $res = $result->FetchRow(); + $rowdata = $this->change_key_case($res); + return $rowdata; + } + + function run_query_allrecords($query) { + $result = $this->query($query); + $records = array(); + $sz = $this->num_rows($result); + for ($i=0; $i<$sz; $i++) + $records[$i] = $this->change_key_case($result->FetchRow()); + return $records; + } + + function run_query_field($query,$field='') { + $rowdata = $this->run_query_record($query); + if(isset($field) && $field != '') + return $rowdata{$field}; + else + return array_shift($rowdata); + } + + function run_query_list($query,$field){ + $records = $this->run_query_allrecords($query); + foreach($records as $walk => $cur) + $list[] = $cur{$field}; + } + + function run_query_field_html($query,$field){ + return to_html($this->run_query_field($query,$field)); + } + + function result_get_next_record($result){ + return $this->change_key_case($result->FetchRow()); + } + + // create an IN expression from an array/list + function sql_expr_datalist($a) { + if (!is_array($a)) + throw new Exception("not an array"); + if (!count($a)) + throw new Exception("empty arrays not allowed"); + + foreach($a as $walk => $cur) + $l .= ($l?',':'').$this->quote($cur); + return ' ( '.$l.' ) '; + } + + // create an IN expression from an record list, take $field within each record + function sql_expr_datalist_from_records($a,$field) { + if (!is_array($a)) + throw new Exception("not an array"); + if (!$field) + throw new Exception("missing field"); + if (!count($a)) + throw new Exception("empty arrays not allowed"); + + foreach($a as $walk => $cur) + $l .= ($l?',':'').$this->quote($cur{$field}); + + return ' ( '.$l.' ) '; + } + + function sql_concat($list) { + switch ($this->dbType) { + case 'mysql': + return 'concat('.implode(',',$list).')'; + case 'pgsql': + return '('.implode('||',$list).')'; + default: + throw new Exception("unsupported dbtype \"".$this->dbType."\""); + } + } + ## Code-Contribution given by weigelt@metux.de - Ends + + /* ADODB newly added. replacement for mysql_result() */ + function query_result(&$result, $row, $col=0) { + if (!is_object($result)) + throw new Exception("result is not an object"); + $result->Move($row); + $rowdata = $this->change_key_case($result->FetchRow()); + //$this->println($rowdata); + //Commented strip_selected_tags and added to_html function for HTML tags vulnerability + if($col == 'fieldlabel') $coldata = $rowdata[$col]; + else $coldata = to_html($rowdata[$col]); + return $coldata; + } + + // Function to get particular row from the query result + function query_result_rowdata(&$result, $row=0) { + if (!is_object($result)) + throw new Exception("result is not an object"); + $result->Move($row); + $rowdata = $this->change_key_case($result->FetchRow()); + + foreach($rowdata as $col => $coldata) { + if($col != 'fieldlabel') + $rowdata[$col] = to_html($coldata); + } + return $rowdata; + } + + /** + * Get an array representing a row in the result set + * Unlike it's non raw siblings this method will not escape + * html entities in return strings. + * + * The case of all the field names is converted to lower case. + * as with the other methods. + * + * @param &$result The query result to fetch from. + * @param $row The row number to fetch. It's default value is 0 + * + */ + function raw_query_result_rowdata(&$result, $row=0) { + if (!is_object($result)) + throw new Exception("result is not an object"); + $result->Move($row); + $rowdata = $this->change_key_case($result->FetchRow()); + return $rowdata; + } + + + + function getAffectedRowCount(&$result){ + global $log; + $log->debug('getAffectedRowCount'); + $rows =$this->database->Affected_Rows(); + $log->debug('getAffectedRowCount rows = '.$rows); + return $rows; + } + + function requireSingleResult($sql, $dieOnError=false,$msg='', $encode=true) { + $result = $this->query($sql, $dieOnError, $msg); + + if($this->getRowCount($result ) == 1) + return $result; + $this->log->error('Rows Returned:'. $this->getRowCount($result) .' More than 1 row returned for '. $sql); + return ''; + } + /* function which extends requireSingleResult api to execute prepared statment + */ + + function requirePsSingleResult($sql, $params, $dieOnError=false,$msg='', $encode=true) { + $result = $this->pquery($sql, $params, $dieOnError, $msg); + + if($this->getRowCount($result ) == 1) + return $result; + $this->log->error('Rows Returned:'. $this->getRowCount($result) .' More than 1 row returned for '. $sql); + return ''; + } + + function fetchByAssoc(&$result, $rowNum = -1, $encode=true) { + if($result->EOF) { + $this->println("ADODB fetchByAssoc return null"); + return NULL; + } + if(isset($result) && $rowNum < 0) { + $row = $this->change_key_case($result->GetRowAssoc(false)); + $result->MoveNext(); + if($encode&& is_array($row)) + return array_map('to_html', $row); + return $row; + } + + if($this->getRowCount($result) > $rowNum) { + $result->Move($rowNum); + } + $this->lastmysqlrow = $rowNum; + $row = $this->change_key_case($result->GetRowAssoc(false)); + $result->MoveNext(); + $this->println($row); + + if($encode&& is_array($row)) + return array_map('to_html', $row); + return $row; + } + + function getNextRow(&$result, $encode=true){ + global $log; + $log->info('getNextRow'); + if(isset($result)){ + $row = $this->change_key_case($result->FetchRow()); + if($row && $encode&& is_array($row)) + return array_map('to_html', $row); + return $row; + } + return null; + } + + function fetch_row(&$result, $encode=true) { + return $this->getNextRow($result); + } + + function field_name(&$result, $col) { + return $result->FetchField($col); + } + + function getQueryTime(){ + return $this->query_time; + } + + function connect($dieOnError = false) { + global $dbconfigoption,$dbconfig; + if(!isset($this->dbType)) { + $this->println("ADODB Connect : DBType not specified"); + return; + } + $this->database = ADONewConnection($this->dbType); + + $this->database->PConnect($this->dbHostName, $this->userName, $this->userPassword, $this->dbName); + $this->database->LogSQL($this->enableSQLlog); + + // 'SET NAMES UTF8' needs to be executed even if database has default CHARSET UTF8 + // as mysql server might be running with different charset! + // We will notice problem reading UTF8 characters otherwise. + if($this->isdb_default_utf8_charset) { + $this->executeSetNamesUTF8SQL(true); + } + } + + /** + * Constructor + */ + function PearDatabase($dbtype='',$host='',$dbname='',$username='',$passwd='') { + global $currentModule; + $this->log =& LoggerManager::getLogger('PearDatabase_'. $currentModule); + $this->resetSettings($dbtype,$host,$dbname,$username,$passwd); + + // Initialize performance parameters + $this->isdb_default_utf8_charset = PerformancePrefs::getBoolean('DB_DEFAULT_CHARSET_UTF8'); + $this->enableCache = PerformancePrefs::getBoolean('CACHE_QUERY_RESULT', false); + // END + + if(!isset($this->dbType)) + { + $this->println("ADODB Connect : DBType not specified"); + return; + } + // Initialize the cache object to use. + if(isset($this->enableCache) && $this->enableCache) { + $this->__setCacheInstance(new PearDatabaseCache($this)); + } + // END + } + + function resetSettings($dbtype,$host,$dbname,$username,$passwd){ + global $dbconfig, $dbconfigoption; + + if($host == '') { + $this->disconnect(); + $this->setDatabaseType($dbconfig['db_type']); + $this->setUserName($dbconfig['db_username']); + $this->setUserPassword($dbconfig['db_password']); + $this->setDatabaseHost( $dbconfig['db_hostname']); + $this->setDatabaseName($dbconfig['db_name']); + $this->dbOptions = $dbconfigoption; + if($dbconfig['log_sql']) + $this->enableSQLlog = ($dbconfig['log_sql'] == true); + } else { + $this->disconnect(); + $this->setDatabaseType($dbtype); + $this->setDatabaseName($dbname); + $this->setUserName($username); + $this->setUserPassword($passwd); + $this->setDatabaseHost( $host); + } + } + + function quote($string){ + return $this->database->qstr($string); + } + + function disconnect() { + $this->println("ADODB disconnect"); + if(isset($this->database)){ + if($this->dbType == "mysql"){ + mysql_close($this->database); + } else { + $this->database->disconnect(); + } + unset($this->database); + } + } + + function setDebug($value) { + $this->database->debug = $value; + } + + // ADODB newly added methods + function createTables($schemaFile, $dbHostName=false, $userName=false, $userPassword=false, $dbName=false, $dbType=false) { + $this->println("ADODB createTables ".$schemaFile); + if($dbHostName!=false) $this->dbHostName=$dbHostName; + if($userName!=false) $this->userName=$userPassword; + if($userPassword!=false) $this->userPassword=$userPassword; + if($dbName!=false) $this->dbName=$dbName; + if($dbType!=false) $this->dbType=$dbType; + + $this->checkConnection(); + $db = $this->database; + $schema = new adoSchema( $db ); + //Debug Adodb XML Schema + $sehema->XMLS_DEBUG = TRUE; + //Debug Adodb + $sehema->debug = true; + $sql = $schema->ParseSchema( $schemaFile ); + + $this->println("--------------Starting the table creation------------------"); + $result = $schema->ExecuteSchema( $sql, $this->continueInstallOnError ); + if($result) print $db->errorMsg(); + // needs to return in a decent way + $this->println("ADODB createTables ".$schemaFile." status=".$result); + return $result; + } + + function createTable($tablename, $flds) { + $this->println("ADODB createTable table=".$tablename." flds=".$flds); + $this->checkConnection(); + $dict = NewDataDictionary($this->database); + $sqlarray = $dict->CreateTableSQL($tablename, $flds); + $result = $dict->ExecuteSQLArray($sqlarray); + $this->println("ADODB createTable table=".$tablename." flds=".$flds." status=".$result); + return $result; + } + + function alterTable($tablename, $flds, $oper) { + $this->println("ADODB alterTableTable table=".$tablename." flds=".$flds." oper=".$oper); + $this->checkConnection(); + $dict = NewDataDictionary($this->database); + + if($oper == 'Add_Column') { + $sqlarray = $dict->AddColumnSQL($tablename, $flds); + } else if($oper == 'Delete_Column') { + $sqlarray = $dict->DropColumnSQL($tablename, $flds); + } + $this->println("sqlarray"); + $this->println($sqlarray); + + $result = $dict->ExecuteSQLArray($sqlarray); + + $this->println("ADODB alterTableTable table=".$tablename." flds=".$flds." oper=".$oper." status=".$result); + return $result; + } + + function getColumnNames($tablename) { + $this->println("ADODB getColumnNames table=".$tablename); + $this->checkConnection(); + $adoflds = $this->database->MetaColumns($tablename); + $i=0; + foreach($adoflds as $fld) { + $colNames[$i] = $fld->name; + $i++; + } + return $colNames; + } + + function formatString($tablename,$fldname, $str) { + $this->checkConnection(); + $adoflds = $this->database->MetaColumns($tablename); + + foreach ( $adoflds as $fld ) { + if(strcasecmp($fld->name,$fldname)==0) { + $fldtype =strtoupper($fld->type); + if(strcmp($fldtype,'CHAR')==0 || strcmp($fldtype,'VARCHAR') == 0 || strcmp($fldtype,'VARCHAR2') == 0 || strcmp($fldtype,'LONGTEXT')==0 || strcmp($fldtype,'TEXT')==0) { + return $this->database->Quote($str); + } else if(strcmp($fldtype,'DATE') ==0 || strcmp($fldtype,'TIMESTAMP')==0) { + return $this->formatDate($str); + } else { + return $str; + } + } + } + $this->println("format String Illegal field name ".$fldname); + return $str; + } + + function formatDate($datetime, $strip_quotes=false) { + $this->checkConnection(); + $db = &$this->database; + $date = $db->DBTimeStamp($datetime); + /* Asha: Stripping single quotes to use the date as parameter for Prepared statement */ + if($strip_quotes == true) { + return trim($date, "'"); + } + return $date; + } + + function getDBDateString($datecolname) { + $this->checkConnection(); + $db = &$this->database; + $datestr = $db->SQLDate("Y-m-d, H:i:s" ,$datecolname); + return $datestr; + } + + function getUniqueID($seqname) { + $this->checkConnection(); + return $this->database->GenID($seqname."_seq",1); + } + + function get_tables() { + $this->checkConnection(); + $result = & $this->database->MetaTables('TABLES'); + $this->println($result); + return $result; + } + + //To get a function name with respect to the database type which escapes strings in given text + function sql_escape_string($str) + { + if($this->isMySql()) + $result_data = mysql_real_escape_string($str); + elseif($this->isPostgres()) + $result_data = pg_escape_string($str); + return $result_data; + } + + // Function to get the last insert id based on the type of database + function getLastInsertID($seqname = '') { + if($this->isPostgres()) { + $result = pg_query("SELECT currval('".$seqname."_seq')"); + if($result) + { + $row = pg_fetch_row($result); + $last_insert_id = $row[0]; + } + } else { + $last_insert_id = $this->database->Insert_ID(); + } + return $last_insert_id; + } +} /* End of class */ + +if(empty($adb)) { + $adb = new PearDatabase(); + $adb->connect(); +} +//$adb->database->setFetchMode(ADODB_FETCH_NUM); + +?> diff --git a/oss/vtiger/trunk/include/database/Postgres8.php b/oss/vtiger/trunk/include/database/Postgres8.php new file mode 100644 index 00000000..0464465f --- /dev/null +++ b/oss/vtiger/trunk/include/database/Postgres8.php @@ -0,0 +1,228 @@ +info( "fixPostgresQuery: ".$query); + + // If we already have an order or group cluase separate ist for later use + if( stripos($queryRecord,'GROUP BY') > 0) + { + $groupClause = substr($queryRecord, stripos($queryRecord,'GROUP BY')+strlen('GROUP BY'), strlen($queryRecord)); + if( stripos($groupClause,'ORDER BY') > 0) + { + $orderClause = substr($groupClause, stripos($groupClause,'ORDER BY'), strlen($groupClause)); + $groupClause = substr($groupClause, 0, stripos($groupClause,'ORDER BY')); + } + $queryRecord = substr($queryRecord, 0, stripos($queryRecord,'GROUP BY')); + } + + if( stripos($queryRecord,'ORDER BY') > 0) + { + $orderClause = substr($queryRecord, stripos($queryRecord,'ORDER BY'), strlen($queryRecord)); + $queryRecord = substr($queryRecord, 0, stripos($queryRecord,'ORDER BY')); + } + + // Construkt the privateGroupList from the filed list by separating combined + // record.field entries + $privateGroupList = array(); + $token = strtok( $queryFields, ", () "); + while( $token !== false) { + if( strpos( $token, ".") !== false) + array_push( $privateGroupList, $token); + $token = strtok( ", () "); + } + sort( $privateGroupList); + $groupFields = ""; + $last = ""; + for( $i = 0; $i < count($privateGroupList); $i++) { + if( $last != $privateGroupList[$i]) + if( $groupFields == "") + $groupFields = $privateGroupList[$i]; + else + $groupFields .= ",".$privateGroupList[$i]; + $last = $privateGroupList[$i]; + } + + // Rebuild the query + $query = "SELECT ".$queryFields.$queryRecord; + if( $groupClause != "" ) + $groupClause =$groupClause.",".$groupFields; + else + $groupClause =$groupFields; + $query .= expandStar($groupClause,$log)." ".$orderClause; + + if( $debug) + $log->info( "fixPostgresQuery result: ".$query); + + return( $query); +} + +// Postgres8 will not accept a "tablename.*" entry in the GROUP BY clause +function expandStar($fieldlist,$log) +{ + $expanded=""; + $field = strtok( $fieldlist, ","); + while( $field != "") + { + //remove leading and trailing spaces + $field = trim( $field); + + //still spaces in the field indicate a complex structure + if( strpos( $field, " ") == 0) + { + + //locate table- and fieldname + $pos = strpos( $field, "."); + if( $pos > 0) + { + $table = substr( $field, 0, $pos); + $subfield = substr( $field, $pos+1, strlen($field)-$pos); + + //do we need to expand? + if( $subfield == "*") + $field = expandRecord($table,$log); + } + + //add the propably expanded field to the querylist + if( $expanded == "") + $expanded = $field; + else + $expanded .= ",".$field; + } + + //next field + $field = strtok(","); + } + if($expanded!= '') + $expanded = " GROUP BY ". trim($expanded, ","); + //return the expanded fieldlist + return( $expanded); +} + +//return an expanded table field list +function expandRecord($table,$log) +{ + $result = ""; + $log->info( "Debug: expandRecord"); + $subfields = array(); + + //vtiger_products table + if( $table == "vtiger_products" ) + $subfields = array ( "productid", "productname", "productcode", "productcategory", "manufacturer", "qty_per_unit", "unit_price", "weight", "pack_size", "sales_start_date", "sales_end_date", "start_date", "expiry_date", "cost_factor", "commissionrate", "commissionmethod", "discontinued", "usageunit", "handler", "currency", "reorderlevel", "website", "taxclass", "mfr_part_no", "vendor_part_no", "serialno", "qtyinstock", "productsheet", "qtyindemand", "glacct", "vendor_id", "imagename"); + //$subfields = array ( "productid", "productname", "productcode", "productcategory", "manufacturer", "qty_per_unit", "unit_price", "weight", "pack_size", "sales_start_date", "sales_end_date", "start_date", "expiry_date", "cost_factor", "commissionrate", "commissionmethod", "discontinued", "usageunit", "handler", "contactid", "currency", "reorderlevel", "website", "taxclass", "mfr_part_no", "vendor_part_no", "serialno", "qtyinstock", "productsheet", "qtyindemand", "glacct", "vendor_id", "imagename" ); + + //vtiger_activity table + elseif( $table == "vtiger_activity") + $subfields = array ( "activityid", "subject", "semodule", "activitytype", "date_start", "due_date", "time_start", "time_end", "sendnotification", "duration_hours", "duration_minutes", "status", "eventstatus", "priority", "location", "notime", "visibility", "recurringtype" ); + + //vtiger_notes table + elseif( $table == "vtiger_notes") + $subfields = array ( "notesid", "contact_id", "title", "filename", "notecontent"); + + //vtiger_faq table + elseif( $table == "vtiger_faq") + $subfields = array ( "id", "product_id", "question", "answer", "category", "status"); + + //vtiger_profile2field + elseif( $table == "vtiger_profile2field") + $subfields = array ( "profileid", "tabid", "fieldid", "visible", "readonly"); + + //vtiger_field + elseif( $table == "vtiger_field") + $subfields = array ( "tabid", "fieldid", "columnname", "tablename", "generatedtype", "uitype", "fieldname", "fieldlabel", "readonly", "presence", "selected", "maximumlength", "sequence", "block", "displaytype", "typeofdata", "quickcreate", "quickcreatesequence", "info_type"); + + //vtiger_producttaxrel + elseif( $table == "vtiger_producttaxrel") + $subfields = array ( "productid", "taxid", "taxpercentage"); + + //vtiger_inventorytaxinfo + elseif( $table == "vtiger_inventorytaxinfo") + $subfields = array ( "taxid", "taxname", "taxlabel", "percentage", "deleted"); + + //vtiger_role2picklist + elseif( $table == "vtiger_role2picklist") + $subfields = array ( "roleid", "picklistid", "sortid"); + + //vtiger_contactdetails + elseif( $table == "vtiger_contactdetails") + $subfields = array( "lastname", "contactid", "accountid", "salutation", "firstname", "email", "phone", "mobile", "title", "department", "fax", "reportsto", "training", "usertype", "contacttype", "otheremail", "yahooid", "donotcall", "emailoptout", "imagename", "reference", "notify_owner"); + + //vtiger_quotes + elseif( $table == "vtiger_quotes") + $subfields = array( "quoteid", "subject", "potentialid", "quotestage", "validtill", "contactid", "currency", "subtotal", "carrier", "shipping", "inventorymanager", "type", "adjustment", "total", "taxtype", "discount_percent", "discount_amount", "s_h_amount", "accountid", "terms_conditions"); + + //vtiger_crmentity + elseif( $table == "vtiger_crmentity") + $subfields = array("crmid", "smcreatorid", "smownerid", "modifiedby", "setype", "description", "createdtime", "modifiedtime", "viewedtime", "status", "version", "presence", "deleted"); + + //vtiger_salesorder + elseif( $table == "vtiger_salesorder") + $subfields = array("salesorderid", "subject", "potentialid", "customerno", "quoteid", "vendorterms", "contactid", "vendorid", "duedate", "carrier", "pending", "type", "adjustment", "salescommission", "exciseduty","total", "subtotal", "taxtype", "discount_percent", "discount_amount", "s_h_amount", "accountid", "terms_conditions", "purchaseorder", "sostatus"); + + //vtiger_invoice + elseif( $table == "vtiger_invoice") + $subfields = array("invoiceid", "subject", "salesorderid","customerno","contactid", "notes", "invoicedate", "duedate", "invoiceterms", "type", "adjustment","salescommission","exciseduty", "subtotal","total", "taxtype","discount_percent", "discount_amount", "s_h_amount","shipping", "accountid", "terms_conditions","purchaseorder","invoicestatus","invoice_no"); + + //vtiger_seactivityrel + elseif( $table == "vtiger_seactivityrel") + $subfields = array("crmid", "activityid"); + + //vtiger_cntactivityrel + elseif( $table == "vtiger_cntactivityrel") + $subfields = array("contactid", "activityid"); + + //vtiger_purchaseorder + elseif( $table == "vtiger_purchaseorder") + $subfields = array("purchaseorderid", "subject", "quoteid", "vendorid", "requisition_no", "tracking_no", "contactid", "duedate", "carrier", "type", "adjustment", "salescommission", "exciseduty", "total", "subtotal", "taxtype", "discount_percent","discount_amount", "s_h_amount", "terms_conditions", "postatus"); + + //vtiger_leaddetails + elseif( $table == "vtiger_leaddetails") + $subfields = array("leadid", "email", "interest", "firstname", "salutation", "lastname", "company", "annualrevenue", "industry", "campaign", "rating", "leadstatus", "leadsource", "converted", "designation", "space", "comments", "priority", "demorequest", "partnercontact", "productversion", "product", "maildate", "nextstepdate", "fundingsituation", "purpose", "evaluationstatus", "transferdate", "revenuetype", "noofemployees", "yahooid", "assignleadchk" ); + + //vtiger_campaignleadrel + elseif( $table == "vtiger_campaignleadrel") + $subfields = array("campaignid", "leadid"); + + //vtiger_pricebook + elseif( $table == "vtiger_pricebook") + $subfields = array("pricebookid", "bookname","active","description"); + + //fields of the requested array still undefined + else + $log->info("function expandRecord: please add structural information for table '".$table."'"); + + //construct an entity string + for( $i=0; $i 0) + $result = substr( $result, 0, strlen( $result) -1); + + //return out new string + return( $result); +} +?> diff --git a/oss/vtiger/trunk/include/db_backup/DatabaseBackup.php b/oss/vtiger/trunk/include/db_backup/DatabaseBackup.php new file mode 100644 index 00000000..b39857ca --- /dev/null +++ b/oss/vtiger/trunk/include/db_backup/DatabaseBackup.php @@ -0,0 +1,317 @@ +'Source database connect failed', + 'DestConnectFailed'=>'Destination database connect failed', + 'TableListFetchError'=>'Failed to get Table List for database', + 'SqlExecutionError'=>'Execution of following query failed', +); + +class DatabaseConfig{ + private $hostName = null; + private $username = null; + private $password = null; + private $dbName = null; + private $rootUsername = null; + private $rootPassword = null; + function DatabaseConfig($dbserver, $username, $password,$dbName, $rootusername='', $rootpassword=''){ + $this->hostName = $dbserver; + $this->username = $username; + $this->password = $password; + $this->dbName = $dbName; + $this->rootUsername = $rootusername; + $this->rootPassword = $rootpassword; + } + + function getHostName(){ + return $this->hostName; + } + + function getUsername(){ + return $this->username; + } + + function getPassword(){ + return $this->password; + } + + function getRootUsername(){ + return $this->rootUsername; + } + + function getRootPassword(){ + return $this->rootPassword; + } + + function getDatabaseName(){ + return $this->dbName; + } + +} + +class DatabaseBackupException extends Exception{ + public $code; + public $message; + + function DatabaseBackupException($errCode,$msg){ + $this->code = $errCode; + $this->message = $msg; + } +} + +class DatabaseErrorCode{ + public static $DB_CONNECT_ERROR = 'CONNECT_ERROR'; + public static $TABLE_NAME_ERROR = 'TABLE_LIST_FETCH_ERROR'; + public static $SQL_EXECUTION_ERROR = 'SQL_EXECUTION_ERROR'; +} + +class DatabaseBackup { + private $sourceConfig = null; + private $destinationConfig = null; + private $dbType = null; + private $sourceCon = null; + private $destCon = null; + private static $langString = null; + private $downloadMode = null; + private $createTarget = null; + private $supportUTF8 = null; + function DatabaseBackup($dbType='mysql',$createTarget=false,$utf=true){ + $this->dbType = strtolower($dbType); + if(!is_array(DatabaseBackup::$langString)){ + DatabaseBackup::$langString = getLanguageStrings(); + } + $this->downloadMode = false; + $this->createTarget = $createTarget; + $this->supportUTF8 = $utf; + } + + function setSourceConfig($sourceConfig){ + $this->sourceConfig = $sourceConfig; + $this->initSourceConnection(); + } + + function setDestinationConfig($destinationConfig){ + $this->destinationConfig = $destinationConfig; + $this->initDestinationConnection(); + } + + function enableDownloadMode(){ + $this->downloadMode = true; + } + + function isDownloadMode(){ + return $this->downloadMode; + } + + function isUTF8SupportEnabled() { + return $this->supportUTF8; + } + + function getSourceConnection(){ + return $this->sourceCon; + } + + function getDestinationConnection(){ + return $this->destCon; + } + + function initSourceConnection(){ + $this->sourceCon = &NewADOConnection($this->dbType); + $ok = $this->sourceCon->NConnect($this->sourceConfig->getHostName(),$this->sourceConfig->getUserName(), + $this->sourceConfig->getPassword(),$this->sourceConfig->getDatabaseName()); + if(!$ok){ + throw new DatabaseBackupException(DatabaseErrorCode::$DB_CONNECT_ERROR, + DatabaseBackup::$langString['SourceConnectFailed']); + } + $this->sourceCon->_Execute("SET NAMES 'utf8'",false); + $result = $this->sourceCon->_Execute("SET interactive_timeout=28800",false); + $result = $this->sourceCon->_Execute("SET wait_timeout=28800",false); + $result = $this->sourceCon->_Execute("SET net_write_timeout=900",false); + $result = $this->sourceCon->_Execute("SET net_read_timeout=900",false); + } + + function initDestinationConnection(){ + $this->destCon = &NewADOConnection($this->dbType); + if($this->createTarget){ + $this->createTargetDB(); + } + $ok = $this->destCon->NConnect($this->destinationConfig->getHostName(),$this->destinationConfig->getUserName(), + $this->destinationConfig->getPassword(),$this->destinationConfig->getDatabaseName()); + if(!$ok){ + throw new DatabaseBackupException(DatabaseErrorCode::$DB_CONNECT_ERROR, + DatabaseBackup::$langString['DestConnectFailed']); + } + $result = $this->destCon->_Execute("SET interactive_timeout=28800",false); + $result = $this->destCon->_Execute("SET wait_timeout=28800",false); + $result = $this->destCon->_Execute("SET net_write_timeout=900",false); + } + + function createTargetDB(){ + if(!$this->isDownloadMode()){ + if($this->dbType == 'mysql'){ + $ok = $this->destCon->NConnect($this->destinationConfig->getHostName(),$this->destinationConfig->getRootUserName(), + $this->destinationConfig->getRootPassword()); + if(!$ok){ + throw new DatabaseBackupException(DatabaseErrorCode::$DB_CONNECT_ERROR, + DatabaseBackup::$langString['DestConnectFailed']); + } + // Drop database if already exists + $sql = "drop database IF EXISTS ".$this->destinationConfig->getDatabaseName(); + $result = $this->destCon->Execute($sql); + $this->checkError($result,$sql); + + $sql = 'create database '.$this->destinationConfig->getDatabaseName(); + if( $this->supportUTF8 == true){ + $sql .= " default character set utf8 default collate utf8_general_ci"; + } + $result = $this->destCon->Execute($sql); + $this->checkError($result,$sql); + $this->destCon->Close(); + $this->destCon = &NewADOConnection($this->dbType); + } + } + } + + function initBackup(){ + if(!$this->isDownloadMode()){ + $sql = "SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0"; + $result = $this->destCon->_Execute($sql,false); + $this->checkError($result,$sql); + $sql = "SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO';"; + $result = $this->destCon->_Execute($sql,false); + $this->checkError($result,$sql); + $sql = 'SET NAMES utf8'; + $result = $this->destCon->_Execute($sql,false); + $this->checkError($result,$sql); + return; + }else{ + $this->writeLine('-- Dump generated by vtigerCRM'); + $this->writeLine('-- Date: ' . date("D, M j, G:i:s T Y")); + $this->writeLine('-- HOST: ' . $this->sourceConfig->getHostName(). + ' Database: '.$this->sourceConfig->getDatabaseName()); + $this->writeLine("-- ----------------------------------"); + $this->writeLine(""); + + $this->writeLine("/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;"); + $this->writeLine("/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;"); + $this->writeLine("/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;"); + $this->writeLine("/*!40101 SET NAMES utf8 */;"); + $this->writeLine("/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;"); + $this->writeLine("/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;"); + $this->writeLine("/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;"); + $this->writeLine("/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;"); + } + } + + function writeLine($string){ + echo $string,"\n"; + } + + function finalizeBackup(){ + if(!$this->isDownloadMode()){ + $sql = "SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS"; + $result = $this->destCon->_Execute($sql,false); + $this->checkError($result,$sql); + $sql = "SET SQL_MODE=@OLD_SQL_MODE;"; + $result = $this->destCon->_Execute($sql,false); + $this->checkError($result,$sql); + return; + }else{ + $this->writeLine("/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;"); + $this->writeLine("/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;"); + $this->writeLine("/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;"); + $this->writeLine("/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;"); + $this->writeLine("/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;"); + $this->writeLine("/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;"); + $this->writeLine("/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;"); + $this->writeLine("-- DONE"); + } + } + + function processTableCreate($tableName,$sql){ + if(!$this->isDownloadMode()){ + $result = $this->destCon->_Execute($sql,false); + $this->checkError($result,$sql); + }else{ + $this->writeLine(""); + $this->writeLine("--"); + $this->writeLine("-- Table structure for table $tableName"); + $this->writeLine("--"); + $this->writeLine(""); + $this->writeLine("DROP TABLE IF EXISTS $tableName;"); + $this->writeLine($sql.';'); + $this->writeLine(""); + $this->writeLine("--"); + $this->writeLine("-- Dumping data for table $tableName"); + $this->writeLine("--"); + $this->writeLine(""); + } + } + + function processStatement($sql){ + if(!$this->isDownloadMode()){ + $result = $this->destCon->_Execute($sql,false); + $this->checkError($result,$sql); + }else{ + $this->writeLine($sql.';'); + } + } + + function checkError($result,$sql){ + if($result === false){ + throw new DatabaseBackupException(DatabaseErrorCode::$SQL_EXECUTION_ERROR, + DatabaseBackup::$langString['SqlExecutionError'].' '.$sql); + } + } + + function backup(){ + $this->initBackup(); + set_time_limit(0); + $tableNameList = $this->sourceCon->MetaTables('TABLES'); + if($tableNameList === false){ + throw new DatabaseBackupException(DatabaseErrorCode::$TABLE_NAME_ERROR, + DatabaseBackup::$langString['TableListFetchError']); + } + foreach ($tableNameList as $tableName) { + $sql = $this->getTableCreateStatement($this->sourceCon,$tableName); + $this->processTableCreate($tableName,$sql); + $sql = "select * from $tableName"; + $result = $this->sourceCon->_Execute($sql,false); + $this->checkError($result,$sql); + while(!$result->EOF){ + $row = $result->GetRowAssoc(2); + $sql = $this->sourceCon->GetInsertSQL($tableName,$row); + $this->processStatement($sql); + $result->MoveNext(); + } + } + $this->finalizeBackup(); + } + + function getTableCreateStatement($con, $tableName){ + if($this->dbType == 'mysql'){ + $sql = "show create table $tableName"; + $result = $con->_Execute($sql,false); + $this->checkError($result,$sql.' '.$con->ErrorMsg().' '.$con->ErrorNo()); + $data = $result->FetchRow(); + return $data[1]; + } + } + +} + +function getLanguageStrings(){ + global $langString; + return $langString; +} + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/include/db_backup/backup.php b/oss/vtiger/trunk/include/db_backup/backup.php new file mode 100644 index 00000000..ec7f340f --- /dev/null +++ b/oss/vtiger/trunk/include/db_backup/backup.php @@ -0,0 +1,351 @@ +debug("Entering save_structure(".$filename.",".$root_directory.") method ..."); + + $dbdump = new DatabaseDump(dbserver, dbuser, dbpass); + $dumpfile = $root_directory.'/'.$filename; + $dbdump->save(dbname, $dumpfile) ; + $log->debug("Exiting save_structure method ..."); +} + +/** + * DatabaseDump will save the dump of database to the file specified. + * + * The dump file contains series of SQL statements (with some meta information) + * generated similar to mysqldump command. + * + * To restore back the dump you can use the 'source' command in sql. + * Like: + * mysql> create database dbname; + * mysql> use dbname; + * mysql> source sql_dump_file; + * + * @author Prasad + */ +class DatabaseDump { + private $fhandle; + function DatabaseDump($dbserver, $username, $password) { + mysql_connect($dbserver, $username, $password); + } + function save($database, $filename) { + // Connect to database + $db = mysql_select_db($database); + $db_charset = mysql_fetch_assoc(mysql_query("SHOW variables LIKe'character_set_database'")); + if($db_charset['Value']=='utf8'){ + mysql_query("SET NAMES 'utf8'"); + } + if(empty($db)) { + return; + } + $this->file_open($filename); + + // Write some information regarding database dump and the time first. + $this->writeln("SET NAMES 'utf8';"); + $this->writeln("-- $database database dump"); + $this->writeln("-- Date: " . date("D, M j, G:i:s T Y")); + $this->writeln("-- ----------------------------------"); + $this->writeln(""); + + // Meta information which helps to import into mysql database. + $this->writeln("SET FOREIGN_KEY_CHECKS=0;"); + $this->writeln("SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';"); + $this->writeln(""); + + // Get all table names from database + $tcount = 0; + $trs = mysql_list_tables($database); + for($tindex = 0; $tindex < mysql_num_rows($trs); $tindex++) { + $table = mysql_tablename($trs, $tindex); + if(!empty($table)) { + $tables[$tcount] = mysql_tablename($trs, $tindex); + $tcount++; + } + } + + // List tables + $dump = ''; + for($tindex = 0; $tindex < count($tables); $tindex++) { + // Table Name + $table = $tables[$tindex]; + + $table_create_rs = mysql_query("SHOW CREATE TABLE `$table`"); + $table_create_rows = mysql_fetch_array($table_create_rs); + $table_create_sql = $table_create_rows[1]; + + // Our parser used for reading the dump file is very basic + // hence we will need to remove the new lines + $table_create_sql = str_replace("\n","",$table_create_sql); + + // Our parser used for reading the dump file is very basic + // hence we will need to remove the new lines + $table_create_sql = str_replace("\n","",$table_create_sql); + + // Write table create statement + $this->writeln(""); + $this->writeln("--"); + $this->writeln("-- Table structure for table `$table` "); + $this->writeln("--"); + $this->writeln(""); + $this->writeln("DROP TABLE IF EXISTS `$table`;"); + $this->writeln($table_create_sql . ';'); + $this->writeln(""); + + // Write data + $this->writeln("--"); + $this->writeln("-- Dumping data for table `$table` "); + $this->writeln("--"); + $this->writeln(""); + + $table_query = mysql_query("SELECT * FROM `$table`"); + $num_fields = mysql_num_fields($table_query); + while($fetch_row = mysql_fetch_array($table_query)) { + $insert_sql = "INSERT INTO `$table` VALUES("; + for($n = 1; $n <= $num_fields; $n++) { + $m = $n -1; + $field_value = $fetch_row[$m]; + $field_value = str_replace('\"', '"', mysql_escape_string($field_value)); + $insert_sql .= "'". $field_value . "', "; + } + $insert_sql = substr($insert_sql,0,-2); + $insert_sql .= ");"; + + if($insert_sql != "") { + $this->writeln($insert_sql); + } + } + } + // Meta information reset to original state. + $this->writeln("SET FOREIGN_KEY_CHECKS=0;"); + + $this->file_close(); + } + function file_open($filename) { $this->fhandle = fopen($filename, "w+"); } + function file_close() { fclose($this->fhandle); } + function write($string) { fprintf($this->fhandle, "%s", $string); } + function writeln($string) { fprintf($this->fhandle, "%s\r\n", $string); } +}; + + +class createZip { + + public $compressedData = array(); + public $centralDirectory = array(); // central directory + public $endOfCentralDirectory = "\x50\x4b\x05\x06\x00\x00\x00\x00"; //end of Central directory record + public $oldOffset = 0; + + /** + * Function to create the directory where the file(s) will be unzipped + * + * @param $directoryName string + * + */ + + public function addDirectory($directoryName) { + $directoryName = str_replace("\\", "/", $directoryName); + + $feedArrayRow = "\x50\x4b\x03\x04"; + $feedArrayRow .= "\x0a\x00"; + $feedArrayRow .= "\x00\x00"; + $feedArrayRow .= "\x00\x00"; + $feedArrayRow .= "\x00\x00\x00\x00"; + + $feedArrayRow .= pack("V",0); + $feedArrayRow .= pack("V",0); + $feedArrayRow .= pack("V",0); + $feedArrayRow .= pack("v", strlen($directoryName) ); + $feedArrayRow .= pack("v", 0 ); + $feedArrayRow .= $directoryName; + + $feedArrayRow .= pack("V",0); + $feedArrayRow .= pack("V",0); + $feedArrayRow .= pack("V",0); + + $this -> compressedData[] = $feedArrayRow; + + $newOffset = strlen(implode("", $this->compressedData)); + + $addCentralRecord = "\x50\x4b\x01\x02"; + $addCentralRecord .="\x00\x00"; + $addCentralRecord .="\x0a\x00"; + $addCentralRecord .="\x00\x00"; + $addCentralRecord .="\x00\x00"; + $addCentralRecord .="\x00\x00\x00\x00"; + $addCentralRecord .= pack("V",0); + $addCentralRecord .= pack("V",0); + $addCentralRecord .= pack("V",0); + $addCentralRecord .= pack("v", strlen($directoryName) ); + $addCentralRecord .= pack("v", 0 ); + $addCentralRecord .= pack("v", 0 ); + $addCentralRecord .= pack("v", 0 ); + $addCentralRecord .= pack("v", 0 ); + $ext = "\x00\x00\x10\x00"; + $ext = "\xff\xff\xff\xff"; + $addCentralRecord .= pack("V", 16 ); + + $addCentralRecord .= pack("V", $this -> oldOffset ); + $this -> oldOffset = $newOffset; + + $addCentralRecord .= $directoryName; + + $this -> centralDirectory[] = $addCentralRecord; + } + + /** + * Function to add file(s) to the specified directory in the archive + * + * @param $directoryName string + * + */ + + public function addFile($data, $directoryName) { + + $directoryName = str_replace("\\", "/", $directoryName); + + $feedArrayRow = "\x50\x4b\x03\x04"; + $feedArrayRow .= "\x14\x00"; + $feedArrayRow .= "\x00\x00"; + $feedArrayRow .= "\x08\x00"; + $feedArrayRow .= "\x00\x00\x00\x00"; + + $uncompressedLength = strlen($data); + $compression = crc32($data); + $gzCompressedData = gzcompress($data); + $gzCompressedData = substr( substr($gzCompressedData, 0, strlen($gzCompressedData) - 4), 2); + $compressedLength = strlen($gzCompressedData); + $feedArrayRow .= pack("V",$compression); + $feedArrayRow .= pack("V",$compressedLength); + $feedArrayRow .= pack("V",$uncompressedLength); + $feedArrayRow .= pack("v", strlen($directoryName) ); + $feedArrayRow .= pack("v", 0 ); + $feedArrayRow .= $directoryName; + + $feedArrayRow .= $gzCompressedData; + + $feedArrayRow .= pack("V",$compression); + $feedArrayRow .= pack("V",$compressedLength); + $feedArrayRow .= pack("V",$uncompressedLength); + + $this -> compressedData[] = $feedArrayRow; + + $newOffset = strlen(implode("", $this->compressedData)); + + $addCentralRecord = "\x50\x4b\x01\x02"; + $addCentralRecord .="\x00\x00"; + $addCentralRecord .="\x14\x00"; + $addCentralRecord .="\x00\x00"; + $addCentralRecord .="\x08\x00"; + $addCentralRecord .="\x00\x00\x00\x00"; + $addCentralRecord .= pack("V",$compression); + $addCentralRecord .= pack("V",$compressedLength); + $addCentralRecord .= pack("V",$uncompressedLength); + $addCentralRecord .= pack("v", strlen($directoryName) ); + $addCentralRecord .= pack("v", 0 ); + $addCentralRecord .= pack("v", 0 ); + $addCentralRecord .= pack("v", 0 ); + $addCentralRecord .= pack("v", 0 ); + $addCentralRecord .= pack("V", 32 ); + + $addCentralRecord .= pack("V", $this -> oldOffset ); + $this -> oldOffset = $newOffset; + + $addCentralRecord .= $directoryName; + + $this -> centralDirectory[] = $addCentralRecord; + } + + /** + * Fucntion to return the zip file + * + * @return zipfile (archive) + */ + + public function getZippedfile() { + + $data = implode("", $this -> compressedData); + $controlDirectory = implode("", $this -> centralDirectory); + + return + $data. + $controlDirectory. + $this -> endOfCentralDirectory. + pack("v", sizeof($this -> centralDirectory)). + pack("v", sizeof($this -> centralDirectory)). + pack("V", strlen($controlDirectory)). + pack("V", strlen($data)). + "\x00\x00"; + } + + /** + * + * Function to force the download of the archive as soon as it is created + * + * @param archiveName string - name of the created archive file + */ + + public function forceDownload($archiveName) { + $headerInfo = ''; + + if(ini_get('zlib.output_compression')) { + ini_set('zlib.output_compression', 'Off'); + } + + // Security checks + if( $archiveName == "" ) { + echo "Public Photo Directory - Download
ERROR: The download file was NOT SPECIFIED."; + exit; + } + elseif ( ! file_exists( $archiveName ) ) { + echo "Public Photo Directory - Download
ERROR: File not found."; + exit; + } + + header("Pragma: public"); + header("Expires: 0"); + header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); + header("Cache-Control: private",false); + header("Content-Type: application/zip"); + header("Content-Disposition: attachment; filename=".basename($archiveName).";" ); + header("Content-Transfer-Encoding: binary"); + header("Content-Length: ".filesize($archiveName)); + readfile("$archiveName"); + + } + +} + +class createDirZip extends createZip { + function get_files_from_folder($directory, $put_into) { + if ($handle = @opendir($directory)) { + while (false != ($file = readdir($handle))) { + if (is_file($directory.$file)) { + $fileContents = file_get_contents($directory.$file); + $this->addFile($fileContents, $put_into.$file); + } elseif ($file != '.' and $file != '..' and is_dir($directory.$file)) { + $this->addDirectory($put_into.$file.'/'); + $this->get_files_from_folder($directory.$file.'/', $put_into.$file.'/'); + } + } + } + @closedir($handle); + } +} +?> diff --git a/oss/vtiger/trunk/include/db_backup/ftp.php b/oss/vtiger/trunk/include/db_backup/ftp.php new file mode 100644 index 00000000..1caea866 --- /dev/null +++ b/oss/vtiger/trunk/include/db_backup/ftp.php @@ -0,0 +1,65 @@ +debug("Entering ftpBackupFile(".$source_file.", ".$ftpserver.", ".$ftpuser.", ".$ftppassword.") method ..."); + // set up basic connection + $conn_id = @ftp_connect($ftpserver); + if(!$conn_id) + { + $log->debug("Exiting ftpBackupFile method ..."); + return; + } + + + // login with username and password + + $login_result = @ftp_login($conn_id, $ftpuser, $ftppassword); + + if(!$login_result) + { + ftp_close($conn_id); + $log->debug("Exiting ftpBackupFile method ..."); + return; + } + + // check connection + /*if ((!$conn_id) || (!$login_result)) { + echo "FTP connection has failed!"; + echo "Attempted to connect to $ftp_server for user $ftp_user_name"; + exit; + } else { + echo "Connected to $ftp_server, for user $ftp_user_name"; + } + */ + + // upload the file + $destination_file=$source_file; + $upload = @ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY); + + // check upload status + if (!$upload) { + ftp_close($conn_id); + $log->debug("Exiting ftpBackupFile method ..."); + return; + } + /* + else { + echo "Uploaded $source_file to $ftp_server as $destination_file"; + }*/ + + // close the FTP stream + ftp_close($conn_id); + $log->debug("Exiting ftpBackupFile method ..."); +} +?> diff --git a/oss/vtiger/trunk/include/events/SqlResultIterator.inc b/oss/vtiger/trunk/include/events/SqlResultIterator.inc new file mode 100644 index 00000000..bb9362ac --- /dev/null +++ b/oss/vtiger/trunk/include/events/SqlResultIterator.inc @@ -0,0 +1,92 @@ +result = $result; + $this->adb = $adb; + $this->pos = 0; + } + + public function rewind(){ + $this->pos = 0; + } + + function valid(){ + $adb = $this->adb; + return $this->pos < $adb->num_rows($this->result); + } + + public function next(){ + $this->pos+=1; + } + + public function current(){ + $adb = $this->adb; + $data = $adb->raw_query_result_rowdata($this->result, $this->pos); + return new SqlResultIteratorRow($data); + } + + public function key(){ + return $this->pos; + } + + + /** + * Return the contents of the resultset as an array. Destroys a running iterator's state. + * + * This method will reset the iterator using the rewind method. + * + * $copyFields specify which fields of the result to copy to the array. + * If not specified the function will return values for all the fields. + */ + function toArray($copyFields=null){ + $adb = $this->adb; + $this->rewind(); + + if($copyFields===null){ + $columnData = $adb->getFieldsDefinition($this->result); + $columnNames = array(); + foreach($columnData as $column){ + $columnNames[]=$column->name; + } + $copyFields = $columnNames; + } + + $arr=array(); + foreach($this as $row){ + $rowArr = array(); + foreach($copyFields as $name){ + $rowArr[$name]=$row->$name; + } + $arr[]=$rowArr; + } + return $arr; + $this->rewind(); + } + } + + class SqlResultIteratorRow{ + function __construct($data){ + $this->data = $data; + } + + function get($column){ + return $this->data[$column]; + } + + function __get($column){ + return $this->get($column); + } + + } + + +?> diff --git a/oss/vtiger/trunk/include/events/VTEntityData.inc b/oss/vtiger/trunk/include/events/VTEntityData.inc new file mode 100644 index 00000000..d706eebc --- /dev/null +++ b/oss/vtiger/trunk/include/events/VTEntityData.inc @@ -0,0 +1,125 @@ +entityId = $entityId; + $result = $adb->pquery("select setype from vtiger_crmentity where crmid=?", array($entityId)); + $setype = $adb->query_result($result,0,"setype"); + $obj->moduleName = $setype; + + require_once('data/CRMEntity.php'); + $focus = CRMEntity::getInstance($setype); + + $focus->retrieve_entity_info($entityId, $setype); + $focus->id = $entityId; + $obj->isNew = false; + $obj->focus = $focus; + return $obj; + } + + + /** + * Get an entity data object from a crmentity object + * + * @param $crmEntity The CRMEntity instance. + * @return The new entity data object. + */ + static function fromCRMEntity($crmEntity){ + $obj = new VTEntityData(); + $obj->focus = $crmEntity; + $obj->isNew = !(isset($crmEntity->id) && $crmEntity->id != null); + return $obj; + } + + /** + * Get the data from the entity object as an array. + * + * @return An array representation of the module data. + */ + function getData(){ + return $this->focus->column_fields; + } + + /** + * Get the entity id. + * + * @return The entity id. + */ + function getId(){ + return $this->focus->id; + } + + /** + * Get the name of the module represented by the entity data object. + * + * @return The module name. + */ + function getModuleName(){ + $className = get_class($this->focus); + $importModuleMapping = Array( + "ImportLead"=>"Leads", + "ImportAccount"=>"Accounts", + "ImportContact"=>"Contacts", + "ImportOpportunity"=>"Potentials", + "ImportProduct"=>"Products", + "ImportTicket"=>"HelpDesk", + "ImportVendors"=>"Vendors" + ); + $moduleName = $className; + if(array_key_exists($className, $importModuleMapping)){ + $moduleName = $importModuleMapping[$className]; + } + return $moduleName; + } + + function get($fieldName){ + return $this->focus->column_fields[$fieldName]; + } + + function set($fieldName, $value){ + $data = $this->focus->column_fields[$fieldName] = $value; + } + + /** + * Check whether the object is stored on the database. + * + * @return True if the object is saved false otherwiser. + */ + function isSaved(){ + return isset($this->focus->id); + } + + + /** + * Check wether the obkect is new. + * + * @return True if the object is new, false otherwise. + */ + function isNew(){ + return $this->isNew; + } + + } + +?> diff --git a/oss/vtiger/trunk/include/events/VTEntityType.inc b/oss/vtiger/trunk/include/events/VTEntityType.inc new file mode 100644 index 00000000..81339dc3 --- /dev/null +++ b/oss/vtiger/trunk/include/events/VTEntityType.inc @@ -0,0 +1,87 @@ +moduleName=$setype; + require_once("modules/".$setype."/".$setype.".php"); + $result = $adb->pquery("select tabid from vtiger_tab where name=?", + array($setype)); + $tabId = $adb->query_result($result,0,"tabid"); + $this->tabId = $tabId; + $this->adb = $adb; + } + + function getTabId(){ + return $this->tabId; + } + + function getModuleName(){ + return $this->moduleName; + } + + function getFieldNames(){ + $adb = $this->adb; + $arr = array(); + $result = $adb->pquery("select fieldname from vtiger_field where tabid=? and vtiger_field.presence in (0,2)", + array($this->getTabId())); + $it = new SQLResultIterator($adb, $result); + foreach($it as $row){ + $arr[] = $row->fieldname; + } + return $arr; + } + + function getFieldType($fieldName){ + $adb = $this->adb; + $result = $adb->pquery("select * from vtiger_field where fieldname=? and tabid=? and vtiger_field.presence in (0,2)", + array($fieldName, $this->tabId)); + $uitype = $adb->query_result($result,0,"uitype"); + $fieldType = new VTFieldType(); + if(in_array($uitype, array(50, 51, 73))){ + $fieldType->type = "Related"; + $fieldType->relatedTo = "Accounts"; + }else if($uitype == 71){ + $fieldType->type = "Number"; + }else{ + $fieldType->type = "String"; + } + return $fieldType; + } + + function getFieldTypes(){ + $adb = $this->adb; + $fieldNames = $this->getFieldNames(); + $fieldTypes = array(); + foreach($fieldNames as $fieldName){ + $fieldTypes[$fieldName]=$this->getFieldType($fieldName); + } + return $fieldTypes; + } + + +} + +class VTFieldType{ + function toArray(){ + $ro = new ReflectionObject($this); + $props = $ro->getProperties(); + $arr = array(); + foreach($props as $prop){ + $arr[$prop->getName()]=$prop->getValue($this); + } + return $arr; + } + +} + +?> diff --git a/oss/vtiger/trunk/include/events/VTEventCondition.php b/oss/vtiger/trunk/include/events/VTEventCondition.php new file mode 100644 index 00000000..e1676640 --- /dev/null +++ b/oss/vtiger/trunk/include/events/VTEventCondition.php @@ -0,0 +1,82 @@ +getParser($expr); + $this->expr = $parser->statement(); + }else{ + $this->expr = null; + } + } + + + function test($obj){ + $this->data = $obj; + if($this->expr==null){ + return true; + }else{ + return $this->evaluate($this->expr); + } + } + + private function getParser($expr){ + $ass = new ANTLRStringStream($expr); + $lex = new VTEventConditionParserLexer($ass); + $cts = new CommonTokenStream($lex); + $tap = new VTEventConditionParserParser($cts); + return $tap; + } + + + private function evaluate($expr){ + if(is_array($expr)){ + $oper = $expr[0]; + if($oper=='.'){ + $out = $this->data; + $syms = array_slice($expr, 1); + foreach($syms as $sym){ + $out = $this->get($out, $sym->name); + } + return $out; + }else{ + $evaled = array_map(array($this, 'evaluate'), array_slice($expr, 1)); + switch($oper){ + case "in": + return in_array($evaled[0], $evaled[1]); + case "==": + return $evaled[0] == $evaled[1]; + case "list": + return $evaled; + default: + return false; + } + } + }else{ + if($expr instanceof VTEventConditionSymbol){ + return $this->get($this->data, $expr->name); + }else{ + return $expr; + } + } + } + + private function get($obj, $field){ + if(is_array($obj)){ + return $obj[$field]; + }else{ + $func = "get".ucwords($field); + return $obj->$func(); + } + + } + } +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/include/events/VTEventConditionParserLexer.php b/oss/vtiger/trunk/include/events/VTEventConditionParserLexer.php new file mode 100644 index 00000000..d6c26155 --- /dev/null +++ b/oss/vtiger/trunk/include/events/VTEventConditionParserLexer.php @@ -0,0 +1,729 @@ +"; + $transitionS = array( + "\x2\xa\x2\xff\x1\xa\x12\xff\x1\xa\x6\xff\x1\x7\x4\xff\x1\x3\x1\xff". + "\x1\x9\x1\xff\xa\x6\x3\xff\x1\x1\x3\xff\x8\x8\x1\x5\x11\x8\x1\x2". + "\x1\xff\x1\x4\x2\xff\x9\x8\x1\x5\x11\x8", + "", + "", + "", + "", + "\x1\xb\x1f\xff\x1\xb", + "\xa\x6\x3e\xff\x1\xd", + "", + "", + "", + "", + "\xa\x8\x7\xff\x1a\x8\x4\xff\x1\x8\x1\xff\x1a\x8", + "", + "", + "" + ); + $arr = array(); + $arr['eot'] = DFA::unpackEncodedString($eotS); + $arr['eof'] = DFA::unpackEncodedString($eofS); + $arr['min'] = DFA::unpackEncodedString($minS); + $arr['max'] = DFA::unpackEncodedString($maxS); + $arr['accept'] = DFA::unpackEncodedString($acceptS); + $arr['special'] = DFA::unpackEncodedString($specialS); + + + $numStates = sizeof($transitionS); + $arr['transition'] = array(); + for ($i=0; $i<$numStates; $i++) { + $arr['transition'][$i] = DFA::unpackEncodedString($transitionS[$i]); + } + return $arr; +} +$VTEventConditionParserLexer_DFA9 = VTEventConditionParserLexer_DFA9_static(); + +class VTEventConditionParserLexer_DFA9 extends DFA { + + public function __construct($recognizer) { + global $VTEventConditionParserLexer_DFA9; + $DFA = $VTEventConditionParserLexer_DFA9; + $this->recognizer = $recognizer; + $this->decisionNumber = 9; + $this->eot = $DFA['eot']; + $this->eof = $DFA['eof']; + $this->min = $DFA['min']; + $this->max = $DFA['max']; + $this->accept = $DFA['accept']; + $this->special = $DFA['special']; + $this->transition = $DFA['transition']; + } + public function getDescription() { + return "1:1: Tokens : ( T__13 | T__14 | T__15 | T__16 | IN | INTEGER | STRING | SYMBOL | DOT | ELEMENT_ID | WHITESPACE );"; + } +} + + +class VTEventConditionParserLexer extends AntlrLexer { + static $INTEGER=8; + static $T__16=16; + static $IN=5; + static $T__15=15; + static $SYMBOL=4; + static $T__14=14; + static $LETTER=9; + static $T__13=13; + static $WHITESPACE=12; + static $DIGIT=7; + static $DOT=10; + static $EOF=-1; + static $ELEMENT_ID=11; + static $STRING=6; + + public function reportError($e) { + print_r($e); + throw new Exception("The condition you provided is invalid"); + } + + + // delegates + // delegators + + function __construct($input, $state=null){ + parent::__construct($input,$state); + + + $this->dfa9 = new VTEventConditionParserLexer_DFA9($this); + } + function getGrammarFileName() { return "VTEventConditionParser.g"; } + + // $ANTLR start "T__13" + function mT__13(){ + try { + $_type = VTEventConditionParserLexer::$T__13; + $_channel = VTEventConditionParserLexer::$DEFAULT_TOKEN_CHANNEL; + { + $this->matchString("=="); + + + } + + $this->state->type = $_type; + $this->state->channel = $_channel; + } + catch(Exception $e){ + throw $e; + } + } + // $ANTLR end "T__13" + + // $ANTLR start "T__14" + function mT__14(){ + try { + $_type = VTEventConditionParserLexer::$T__14; + $_channel = VTEventConditionParserLexer::$DEFAULT_TOKEN_CHANNEL; + { + $this->matchChar(91); + + } + + $this->state->type = $_type; + $this->state->channel = $_channel; + } + catch(Exception $e){ + throw $e; + } + } + // $ANTLR end "T__14" + + // $ANTLR start "T__15" + function mT__15(){ + try { + $_type = VTEventConditionParserLexer::$T__15; + $_channel = VTEventConditionParserLexer::$DEFAULT_TOKEN_CHANNEL; + { + $this->matchChar(44); + + } + + $this->state->type = $_type; + $this->state->channel = $_channel; + } + catch(Exception $e){ + throw $e; + } + } + // $ANTLR end "T__15" + + // $ANTLR start "T__16" + function mT__16(){ + try { + $_type = VTEventConditionParserLexer::$T__16; + $_channel = VTEventConditionParserLexer::$DEFAULT_TOKEN_CHANNEL; + { + $this->matchChar(93); + + } + + $this->state->type = $_type; + $this->state->channel = $_channel; + } + catch(Exception $e){ + throw $e; + } + } + // $ANTLR end "T__16" + + // $ANTLR start "IN" + function mIN(){ + try { + $_type = VTEventConditionParserLexer::$IN; + $_channel = VTEventConditionParserLexer::$DEFAULT_TOKEN_CHANNEL; + { + if ( $this->input->LA(1)==73||$this->input->LA(1)==105 ) { + $this->input->consume(); + + } + else { + $mse = new MismatchedSetException(null,$this->input); + $this->recover($mse); + throw $mse;} + + if ( $this->input->LA(1)==78||$this->input->LA(1)==110 ) { + $this->input->consume(); + + } + else { + $mse = new MismatchedSetException(null,$this->input); + $this->recover($mse); + throw $mse;} + + + } + + $this->state->type = $_type; + $this->state->channel = $_channel; + } + catch(Exception $e){ + throw $e; + } + } + // $ANTLR end "IN" + + // $ANTLR start "INTEGER" + function mINTEGER(){ + try { + $_type = VTEventConditionParserLexer::$INTEGER; + $_channel = VTEventConditionParserLexer::$DEFAULT_TOKEN_CHANNEL; + { + $cnt1=0; + //loop1: + do { + $alt1=2; + $LA1_0 = $this->input->LA(1); + + if ( (($LA1_0>=$this->getToken('48') && $LA1_0<=$this->getToken('57'))) ) { + $alt1=1; + } + + + switch ($alt1) { + case 1 : + { + $this->mDIGIT(); + + } + break; + + default : + if ( $cnt1 >= 1 ) break 2;//loop1; + $eee = + new EarlyExitException(1, $this->input); + throw $eee; + } + $cnt1++; + } while (true); + + + } + + $this->state->type = $_type; + $this->state->channel = $_channel; + } + catch(Exception $e){ + throw $e; + } + } + // $ANTLR end "INTEGER" + + // $ANTLR start "STRING" + function mSTRING(){ + try { + $_type = VTEventConditionParserLexer::$STRING; + $_channel = VTEventConditionParserLexer::$DEFAULT_TOKEN_CHANNEL; + { + $this->matchChar(39); + $cnt2=0; + //loop2: + do { + $alt2=3; + $LA2_0 = $this->input->LA(1); + + if ( ($LA2_0==$this->getToken('39')) ) { + $LA2_1 = $this->input->LA(2); + + if ( ($LA2_1==$this->getToken('39')) ) { + $alt2=2; + } + + + } + else if ( (($LA2_0>=$this->getToken('0') && $LA2_0<=$this->getToken('38'))||($LA2_0>=$this->getToken('40') && $LA2_0<=$this->getToken('65534'))) ) { + $alt2=1; + } + + + switch ($alt2) { + case 1 : + { + if ( ($this->input->LA(1)>=$this->getToken('0') && $this->input->LA(1)<=$this->getToken('38'))||($this->input->LA(1)>=$this->getToken('40') && $this->input->LA(1)<=$this->getToken('65534')) ) { + $this->input->consume(); + + } + else { + $mse = new MismatchedSetException(null,$this->input); + $this->recover($mse); + throw $mse;} + + + } + break; + case 2 : + { + $this->matchString("\'\'"); + + + } + break; + + default : + if ( $cnt2 >= 1 ) break 2;//loop2; + $eee = + new EarlyExitException(2, $this->input); + throw $eee; + } + $cnt2++; + } while (true); + + $this->matchChar(39); + + } + + $this->state->type = $_type; + $this->state->channel = $_channel; + } + catch(Exception $e){ + throw $e; + } + } + // $ANTLR end "STRING" + + // $ANTLR start "SYMBOL" + function mSYMBOL(){ + try { + $_type = VTEventConditionParserLexer::$SYMBOL; + $_channel = VTEventConditionParserLexer::$DEFAULT_TOKEN_CHANNEL; + $alt5=2; + $LA5_0 = $this->input->LA(1); + + if ( (($LA5_0>=$this->getToken('65') && $LA5_0<=$this->getToken('90'))||($LA5_0>=$this->getToken('97') && $LA5_0<=$this->getToken('122'))) ) { + $alt5=1; + } + else if ( ($LA5_0==$this->getToken('96')) ) { + $alt5=2; + } + else { + $nvae = new NoViableAltException("", 5, 0, $this->input); + + throw $nvae; + } + switch ($alt5) { + case 1 : + { + $this->mLETTER(); + { + //loop3: + do { + $alt3=2; + $LA3_0 = $this->input->LA(1); + + if ( (($LA3_0>=$this->getToken('48') && $LA3_0<=$this->getToken('57'))||($LA3_0>=$this->getToken('65') && $LA3_0<=$this->getToken('90'))||$LA3_0==$this->getToken('95')||($LA3_0>=$this->getToken('97') && $LA3_0<=$this->getToken('122'))) ) { + $alt3=1; + } + + + switch ($alt3) { + case 1 : + { + if ( ($this->input->LA(1)>=$this->getToken('48') && $this->input->LA(1)<=$this->getToken('57'))||($this->input->LA(1)>=$this->getToken('65') && $this->input->LA(1)<=$this->getToken('90'))||$this->input->LA(1)==95||($this->input->LA(1)>=$this->getToken('97') && $this->input->LA(1)<=$this->getToken('122')) ) { + $this->input->consume(); + + } + else { + $mse = new MismatchedSetException(null,$this->input); + $this->recover($mse); + throw $mse;} + + + } + break; + + default : + break 2;//loop3; + } + } while (true); + + + } + + + } + break; + case 2 : + { + $this->matchChar(96); + $cnt4=0; + //loop4: + do { + $alt4=2; + $LA4_0 = $this->input->LA(1); + + if ( (($LA4_0>=$this->getToken('0') && $LA4_0<=$this->getToken('95'))||($LA4_0>=$this->getToken('97') && $LA4_0<=$this->getToken('65534'))) ) { + $alt4=1; + } + + + switch ($alt4) { + case 1 : + { + if ( ($this->input->LA(1)>=$this->getToken('0') && $this->input->LA(1)<=$this->getToken('95'))||($this->input->LA(1)>=$this->getToken('97') && $this->input->LA(1)<=$this->getToken('65534')) ) { + $this->input->consume(); + + } + else { + $mse = new MismatchedSetException(null,$this->input); + $this->recover($mse); + throw $mse;} + + + } + break; + + default : + if ( $cnt4 >= 1 ) break 2;//loop4; + $eee = + new EarlyExitException(4, $this->input); + throw $eee; + } + $cnt4++; + } while (true); + + $this->matchChar(96); + + } + break; + + } + $this->state->type = $_type; + $this->state->channel = $_channel; + } + catch(Exception $e){ + throw $e; + } + } + // $ANTLR end "SYMBOL" + + // $ANTLR start "DOT" + function mDOT(){ + try { + $_type = VTEventConditionParserLexer::$DOT; + $_channel = VTEventConditionParserLexer::$DEFAULT_TOKEN_CHANNEL; + { + $this->matchChar(46); + + } + + $this->state->type = $_type; + $this->state->channel = $_channel; + } + catch(Exception $e){ + throw $e; + } + } + // $ANTLR end "DOT" + + // $ANTLR start "ELEMENT_ID" + function mELEMENT_ID(){ + try { + $_type = VTEventConditionParserLexer::$ELEMENT_ID; + $_channel = VTEventConditionParserLexer::$DEFAULT_TOKEN_CHANNEL; + { + $cnt6=0; + //loop6: + do { + $alt6=2; + $LA6_0 = $this->input->LA(1); + + if ( (($LA6_0>=$this->getToken('48') && $LA6_0<=$this->getToken('57'))) ) { + $alt6=1; + } + + + switch ($alt6) { + case 1 : + { + $this->mDIGIT(); + + } + break; + + default : + if ( $cnt6 >= 1 ) break 2;//loop6; + $eee = + new EarlyExitException(6, $this->input); + throw $eee; + } + $cnt6++; + } while (true); + + $this->matchChar(120); + $cnt7=0; + //loop7: + do { + $alt7=2; + $LA7_0 = $this->input->LA(1); + + if ( (($LA7_0>=$this->getToken('48') && $LA7_0<=$this->getToken('57'))) ) { + $alt7=1; + } + + + switch ($alt7) { + case 1 : + { + $this->mDIGIT(); + + } + break; + + default : + if ( $cnt7 >= 1 ) break 2;//loop7; + $eee = + new EarlyExitException(7, $this->input); + throw $eee; + } + $cnt7++; + } while (true); + + + } + + $this->state->type = $_type; + $this->state->channel = $_channel; + } + catch(Exception $e){ + throw $e; + } + } + // $ANTLR end "ELEMENT_ID" + + // $ANTLR start "LETTER" + function mLETTER(){ + try { + { + if ( ($this->input->LA(1)>=$this->getToken('65') && $this->input->LA(1)<=$this->getToken('90'))||($this->input->LA(1)>=$this->getToken('97') && $this->input->LA(1)<=$this->getToken('122')) ) { + $this->input->consume(); + + } + else { + $mse = new MismatchedSetException(null,$this->input); + $this->recover($mse); + throw $mse;} + + + } + + } + catch(Exception $e){ + throw $e; + } + } + // $ANTLR end "LETTER" + + // $ANTLR start "DIGIT" + function mDIGIT(){ + try { + { + $this->matchRange(48,57); + + } + + } + catch(Exception $e){ + throw $e; + } + } + // $ANTLR end "DIGIT" + + // $ANTLR start "WHITESPACE" + function mWHITESPACE(){ + try { + $_type = VTEventConditionParserLexer::$WHITESPACE; + $_channel = VTEventConditionParserLexer::$DEFAULT_TOKEN_CHANNEL; + { + $cnt8=0; + //loop8: + do { + $alt8=2; + $LA8_0 = $this->input->LA(1); + + if ( (($LA8_0>=$this->getToken('9') && $LA8_0<=$this->getToken('10'))||$LA8_0==$this->getToken('13')||$LA8_0==$this->getToken('32')) ) { + $alt8=1; + } + + + switch ($alt8) { + case 1 : + { + if ( ($this->input->LA(1)>=$this->getToken('9') && $this->input->LA(1)<=$this->getToken('10'))||$this->input->LA(1)==13||$this->input->LA(1)==32 ) { + $this->input->consume(); + + } + else { + $mse = new MismatchedSetException(null,$this->input); + $this->recover($mse); + throw $mse;} + + + } + break; + + default : + if ( $cnt8 >= 1 ) break 2;//loop8; + $eee = + new EarlyExitException(8, $this->input); + throw $eee; + } + $cnt8++; + } while (true); + + $_channel=self::$HIDDEN; + + } + + $this->state->type = $_type; + $this->state->channel = $_channel; + } + catch(Exception $e){ + throw $e; + } + } + // $ANTLR end "WHITESPACE" + + function mTokens(){ + $alt9=11; + $alt9 = $this->dfa9->predict($this->input); + switch ($alt9) { + case 1 : + { + $this->mT__13(); + + } + break; + case 2 : + { + $this->mT__14(); + + } + break; + case 3 : + { + $this->mT__15(); + + } + break; + case 4 : + { + $this->mT__16(); + + } + break; + case 5 : + { + $this->mIN(); + + } + break; + case 6 : + { + $this->mINTEGER(); + + } + break; + case 7 : + { + $this->mSTRING(); + + } + break; + case 8 : + { + $this->mSYMBOL(); + + } + break; + case 9 : + { + $this->mDOT(); + + } + break; + case 10 : + { + $this->mELEMENT_ID(); + + } + break; + case 11 : + { + $this->mWHITESPACE(); + + } + break; + + } + + } + + + +} +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/include/events/VTEventConditionParserParser.php b/oss/vtiger/trunk/include/events/VTEventConditionParserParser.php new file mode 100644 index 00000000..184090f5 --- /dev/null +++ b/oss/vtiger/trunk/include/events/VTEventConditionParserParser.php @@ -0,0 +1,354 @@ +", "", "", "", "SYMBOL", "IN", "STRING", "DIGIT", "INTEGER", "LETTER", "DOT", "ELEMENT_ID", "WHITESPACE", "'=='", "'['", "','", "']'" + ); + public $INTEGER=8; + public $T__16=16; + public $IN=5; + public $T__15=15; + public $SYMBOL=4; + public $LETTER=9; + public $T__14=14; + public $T__13=13; + public $WHITESPACE=12; + public $DIGIT=7; + public $DOT=10; + public $EOF=-1; + public $ELEMENT_ID=11; + public $STRING=6; + + // delegates + // delegators + + static $FOLLOW_comparision_in_statement57; + static $FOLLOW_inclause_in_statement63; + static $FOLLOW_SYMBOL_in_comparision78; + static $FOLLOW_13_in_comparision80; + static $FOLLOW_value_in_comparision84; + static $FOLLOW_SYMBOL_in_inclause101; + static $FOLLOW_IN_in_inclause103; + static $FOLLOW_listelement_in_inclause107; + static $FOLLOW_14_in_listelement122; + static $FOLLOW_value_in_listelement126; + static $FOLLOW_15_in_listelement137; + static $FOLLOW_value_in_listelement141; + static $FOLLOW_16_in_listelement147; + static $FOLLOW_STRING_in_value162; + + + + + public function __construct($input, $state = null) { + if($state==null){ + $state = new RecognizerSharedState(); + } + parent::__construct($input, $state); + + + + } + + + public function getTokenNames() { return VTEventConditionParserParser::$tokenNames; } + public function getGrammarFileName() { return "VTEventConditionParser.g"; } + + + protected function mismatch($input, $ttype, $follow){ + throw new MismatchedTokenException($ttype, $input); + } + public function recoverFromMismatchedSet($input, $e, $follow){ + throw $e; + } + + + + // $ANTLR start "statement" + ///* VTEventConditionParser.g:33:1: statement returns [result] : (exp= comparision | exp= inclause ) ; */ + public function statement(){ + $result = null; + + $exp = null; + + + try { + { + $alt1=2; + $LA1_0 = $this->input->LA(1); + + if ( ($LA1_0==$this->getToken('SYMBOL')) ) { + $LA1_1 = $this->input->LA(2); + + if ( ($LA1_1==$this->getToken('13')) ) { + $alt1=1; + } + else if ( ($LA1_1==$this->getToken('IN')) ) { + $alt1=2; + } + else { + if ($this->state->backtracking>0) {$this->state->failed=true; return $result;} + $nvae = new NoViableAltException("", 1, 1, $this->input); + + throw $nvae; + } + } + else { + if ($this->state->backtracking>0) {$this->state->failed=true; return $result;} + $nvae = new NoViableAltException("", 1, 0, $this->input); + + throw $nvae; + } + switch ($alt1) { + case 1 : + { + $this->pushFollow(self::$FOLLOW_comparision_in_statement57); + $exp=$this->comparision(); + + $this->state->_fsp--; + if ($this->state->failed) return $result; + + } + break; + case 2 : + { + $this->pushFollow(self::$FOLLOW_inclause_in_statement63); + $exp=$this->inclause(); + + $this->state->_fsp--; + if ($this->state->failed) return $result; + + } + break; + + } + + if ( $this->state->backtracking==0 ) { + $result=$exp; + } + + } + + } + + catch (RecognitionException $e) { + throw $e; + } + catch(Exception $e) { + throw $e; + } + + return $result; + } + // $ANTLR end "statement" + + + // $ANTLR start "comparision" + ///* VTEventConditionParser.g:35:1: comparision returns [result] : lhs= SYMBOL '==' rhs= value ; */ + public function comparision(){ + $result = null; + + $lhs=null; + $rhs = null; + + + try { + { + $lhs=$this->match($this->input,$this->getToken('SYMBOL'),self::$FOLLOW_SYMBOL_in_comparision78); if ($this->state->failed) return $result; + $this->match($this->input,$this->getToken('13'),self::$FOLLOW_13_in_comparision80); if ($this->state->failed) return $result; + $this->pushFollow(self::$FOLLOW_value_in_comparision84); + $rhs=$this->value(); + + $this->state->_fsp--; + if ($this->state->failed) return $result; + if ( $this->state->backtracking==0 ) { + $result=array('==', new VTEventConditionSymbol(($lhs!=null?$lhs->getText():null)), $rhs); echo $value; + } + + } + + } + + catch (RecognitionException $e) { + throw $e; + } + catch(Exception $e) { + throw $e; + } + + return $result; + } + // $ANTLR end "comparision" + + + // $ANTLR start "inclause" + ///* VTEventConditionParser.g:38:1: inclause returns [result] : lhs= SYMBOL IN rhs= listelement ; */ + public function inclause(){ + $result = null; + + $lhs=null; + $rhs = null; + + + try { + { + $lhs=$this->match($this->input,$this->getToken('SYMBOL'),self::$FOLLOW_SYMBOL_in_inclause101); if ($this->state->failed) return $result; + $this->match($this->input,$this->getToken('IN'),self::$FOLLOW_IN_in_inclause103); if ($this->state->failed) return $result; + $this->pushFollow(self::$FOLLOW_listelement_in_inclause107); + $rhs=$this->listelement(); + + $this->state->_fsp--; + if ($this->state->failed) return $result; + if ( $this->state->backtracking==0 ) { + $result=array('in', new VTEventConditionSymbol(($lhs!=null?$lhs->getText():null)), $rhs); + } + + } + + } + + catch (RecognitionException $e) { + throw $e; + } + catch(Exception $e) { + throw $e; + } + + return $result; + } + // $ANTLR end "inclause" + + + // $ANTLR start "listelement" + ///* VTEventConditionParser.g:40:1: listelement returns [result] : '[' val= value ( ',' val= value )* ']' ; */ + public function listelement(){ + $result = null; + + $val = null; + + + try { + { + $this->match($this->input,$this->getToken('14'),self::$FOLLOW_14_in_listelement122); if ($this->state->failed) return $result; + $this->pushFollow(self::$FOLLOW_value_in_listelement126); + $val=$this->value(); + + $this->state->_fsp--; + if ($this->state->failed) return $result; + if ( $this->state->backtracking==0 ) { + $result = array('list', $val); + } + //loop2: + do { + $alt2=2; + $LA2_0 = $this->input->LA(1); + + if ( ($LA2_0==$this->getToken('15')) ) { + $alt2=1; + } + + + switch ($alt2) { + case 1 : + { + $this->match($this->input,$this->getToken('15'),self::$FOLLOW_15_in_listelement137); if ($this->state->failed) return $result; + $this->pushFollow(self::$FOLLOW_value_in_listelement141); + $val=$this->value(); + + $this->state->_fsp--; + if ($this->state->failed) return $result; + if ( $this->state->backtracking==0 ) { + $result[] = $val; + } + + } + break; + + default : + break 2;//loop2; + } + } while (true); + + $this->match($this->input,$this->getToken('16'),self::$FOLLOW_16_in_listelement147); if ($this->state->failed) return $result; + + } + + } + + catch (RecognitionException $e) { + throw $e; + } + catch(Exception $e) { + throw $e; + } + + return $result; + } + // $ANTLR end "listelement" + + + // $ANTLR start "value" + ///* VTEventConditionParser.g:44:1: value returns [result] : val= STRING ; */ + public function value(){ + $result = null; + + $val=null; + + try { + { + $val=$this->match($this->input,$this->getToken('STRING'),self::$FOLLOW_STRING_in_value162); if ($this->state->failed) return $result; + if ( $this->state->backtracking==0 ) { + $result = stripcslashes(substr(($val!=null?$val->getText():null), 1, strlen(($val!=null?$val->getText():null))-2)); + } + + } + + } + + catch (RecognitionException $e) { + throw $e; + } + catch(Exception $e) { + throw $e; + } + + return $result; + } + // $ANTLR end "value" + + // Delegated rules + + + +} + + + + + +VTEventConditionParserParser::$FOLLOW_comparision_in_statement57 = new Set(array(1)); +VTEventConditionParserParser::$FOLLOW_inclause_in_statement63 = new Set(array(1)); +VTEventConditionParserParser::$FOLLOW_SYMBOL_in_comparision78 = new Set(array(13)); +VTEventConditionParserParser::$FOLLOW_13_in_comparision80 = new Set(array(6)); +VTEventConditionParserParser::$FOLLOW_value_in_comparision84 = new Set(array(1)); +VTEventConditionParserParser::$FOLLOW_SYMBOL_in_inclause101 = new Set(array(5)); +VTEventConditionParserParser::$FOLLOW_IN_in_inclause103 = new Set(array(14)); +VTEventConditionParserParser::$FOLLOW_listelement_in_inclause107 = new Set(array(1)); +VTEventConditionParserParser::$FOLLOW_14_in_listelement122 = new Set(array(6)); +VTEventConditionParserParser::$FOLLOW_value_in_listelement126 = new Set(array(15, 16)); +VTEventConditionParserParser::$FOLLOW_15_in_listelement137 = new Set(array(6)); +VTEventConditionParserParser::$FOLLOW_value_in_listelement141 = new Set(array(15, 16)); +VTEventConditionParserParser::$FOLLOW_16_in_listelement147 = new Set(array(1)); +VTEventConditionParserParser::$FOLLOW_STRING_in_value162 = new Set(array(1)); + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/include/events/VTEventConditionSymbol.php b/oss/vtiger/trunk/include/events/VTEventConditionSymbol.php new file mode 100644 index 00000000..7ffb30f4 --- /dev/null +++ b/oss/vtiger/trunk/include/events/VTEventConditionSymbol.php @@ -0,0 +1,16 @@ +name=$name; + } + } +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/include/events/VTEventHandler.inc b/oss/vtiger/trunk/include/events/VTEventHandler.inc new file mode 100644 index 00000000..874f64b9 --- /dev/null +++ b/oss/vtiger/trunk/include/events/VTEventHandler.inc @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/include/events/VTEventTrigger.inc b/oss/vtiger/trunk/include/events/VTEventTrigger.inc new file mode 100644 index 00000000..e0188997 --- /dev/null +++ b/oss/vtiger/trunk/include/events/VTEventTrigger.inc @@ -0,0 +1,125 @@ +$v) { + if(!self::isCached($k) || $force) { + self::$cache[$forname] = $evtinfos; + } + } + } else { + if(!self::isCached() || $force) { + self::$cache = self::getActiveEventInfos($adb, $name); + self::$cacheLookupType = self::CACHE_LOOKUP_TYPE_ALL; + } + } + } + static function isCached($name = false) { + if($name === false) { + if(self::$cacheLookupType == self::CACHE_LOOKUP_TYPE_ALL) { + // Was init cache done for ALL earlier? + return true; + } + } else { + return isset(self::$cache[$name]); + } + return false; + } + static function clearCache($name = false) { + if($name === false) { + self::$cache = array(); + self::$cacheLookupType = ''; + } else if(self::isCached($name)) { + unset(self::$cache[$name]); + } + } + static function lookupCache($name) { + if(self::isCached($name)) { + return self::$cache[$name]; + } else if(self::$cacheLookupType == self::CACHE_LOOKUP_TYPE_ALL) { + return array(); + } + return false; + } + + static function getActiveEventInfos($adb, $name = false) { + $params = array(); + $query = "SELECT * FROM vtiger_eventhandlers WHERE is_active=true"; + if($name !== false) { + if(is_array($name)) { + $query .= " AND event_name IN (" . generateQuestionMarks($name) . ")"; + } else { + $query .= " AND event_name = ?"; + } + $params[] = $name; + } + + $evtinfosbyname = array(); + + $result= $adb->pquery($query, $params); + $it = new SqlResultIterator($adb, $result); + foreach($it as $row) { + $evtinfosbyname[$row->event_name][] = array( + 'condition' => $row->cond, + 'handler_class' => $row->handler_class, + 'handler_path' => $row->handler_path + ); + } + + if($name) return $evtinfosbyname[$name]; + else return $evtinfosbyname; + } + /** END **/ + + function __construct($adb, $name){ + $this->name=$name; + $this->adb = $adb; + } + + function trigger($data){ + $adb = $this->adb; + + $eventInfos = self::lookupCache($this->name); + if($eventInfos === false) { + $eventInfos = self::getActiveEventInfos($this->adb, $this->name); + } + + if($eventInfos) { + foreach($eventInfos as $eventInfo){ + $condition = new VTEventCondition($eventInfo['condition']); + if($condition->test($data)){ + require_once($eventInfo['handler_path']); + $handler_class = $eventInfo['handler_class']; + $handler = new $handler_class(); + + $handler->handleEvent($this->name, $data); + } + } + } + } + } +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/include/events/VTEventsManager.inc b/oss/vtiger/trunk/include/events/VTEventsManager.inc new file mode 100644 index 00000000..f5ff67a4 --- /dev/null +++ b/oss/vtiger/trunk/include/events/VTEventsManager.inc @@ -0,0 +1,189 @@ +adb = $adb; + } + + /** + * Register an event handler + * + * @param $forEvent The name of the event to handle + * @param $path The path to the php file containing the handler + * @param $className The name of the VTEventHandler class. + * @param $condition A condition which must evaluate true for the event to be accepted. + */ + function registerHandler($forEvent, $path, $className, $condition=''){ + $adb = $this->adb; + $result = $adb->pquery("SELECT * FROM vtiger_eventhandlers WHERE event_name=? AND handler_path=? AND handler_class=?", + array($forEvent, $path, $className)); + if($adb->num_rows($result)===0){ + $handlerId = $adb->getUniqueId('vtiger_eventhandlers'); + $adb->pquery("insert into vtiger_eventhandlers + (eventhandler_id, event_name, handler_path, handler_class, cond, is_active) + values (?,?,?,?,?, true)", array($handlerId, $forEvent, $path, $className, $condition)); + + $this->clearTriggerCache($forEvent); + } + } + + /** + * Initialize Event Trigger Cache for the required event types. + * + * @param Object $for Optional String or Array of event_names for initializing. + * @param Boolean $force Optional Force the initialization of cache? + */ + function initTriggerCache($for = false, $force = false) { + VTEventTrigger::initCache($for, $force); + } + + /** + * Clear the Event Trigger Cache + * + * @param Object $forEvent + */ + function clearTriggerCache($forEvent = false) { + VTEventTrigger::clearCache($forEvent); + } + + /** + * Set an event handler as inactive + * @param The handler class to set as inactive + * + */ + function setHandlerInActive($handlerClass){ + $adb = $this->adb; + $adb->pquery("update vtiger_eventhandlers set is_active=false where handler_class=?", array($handlerClass)); + + $this->clearTriggerCache(); + } + + /** + * Set an event handler as active + * + * @param The handler class to set as active + */ + function setHandlerActive($handlerClass){ + $adb = $this->adb; + $adb->pquery("update vtiger_eventhandlers set is_active=true where handler_class=?", array($handlerClass)); + + $this->clearTriggerCache(); + } + + + /** + * Unregister a registered handler + * + * @param $className The name of teh VTEventHandler class to unregister + */ + function unregisterHandler($className){ + $adb = $this->adb; + $adb->pquery("delete from vtiger_eventhandlers where handler_class=?", + array($className)); + $adb->pquery("delete from vtiger_eventhandler_module where handler_class=?", + array($className)); + + $this->clearTriggerCache(); + } + + /** + * Get an event triger instance + * + * @param $triggerName The name of the event. + * @return The trigger object for the event. + */ + function getTrigger($triggerName){ + $adb=$this->adb; + return new VTEventTrigger($adb, $triggerName); + } + + /** + * Trigger an event + * + * @param $triggerName The name of the event. + * @return The trigger object for the event. + */ + function triggerEvent($triggerName, $data){ + $this->getTrigger($triggerName)->trigger($data); + } + + /** + * Set the module the handler belongs to + * + * @param moduleName - The name of the module + * @param handlerClass - The name of the handler class + */ + function setModuleForHandler($moduleName, $handlerClass){ + $adb = $this->adb; + $result = $adb->pquery("SELECT * FROM vtiger_eventhandler_module WHERE handler_class=?", + array($handlerClass)); + if($adb->num_rows($result)===0){ + $handlerModuleId = $adb->getUniqueId('vtiger_eventhandler_module'); + $adb->pquery("insert into vtiger_eventhandler_module + (eventhandler_module_id, module_name, handler_class) + values (?,?,?)", array($handlerModuleId, $moduleName, $handlerClass)); + } + } + + /** + * List handler classes for a module + * + * @param moduleName - The name of the module + */ + function listHandlersForModule($moduleName){ + $adb = $this->adb; + $result = $adb->pquery('SELECT handler_class FROM vtiger_eventhandler_module WHERE module_name=?', array($moduleName)); + $it = new SqlResultIterator($adb, $result); + $arr = array(); + foreach($it as $row){ + $arr[] = $row->handler_class; + } + return $arr; + } + + /** + * List active events. + * + * @return A list of registered events. + */ + function listActiveEventHandlers(){ + $adb = $this->adb; + $result = $adb->pquery("select * from vtiger_eventhandlers where is_active=true"); + return $this->listEventHandlers($result); + } + + function listAllEventHandlers(){ + $adb = $this->adb; + $result = $adb->pquery("select * from vtiger_eventhandlers"); + return $this->listEventHandlers($result); + + } + + private function listEventHandlers($result){ + $adb = $this->adb; + $it = new SQLResultIterator($adb, $result); + $out = array(); + foreach($it as $row){ + $el = array(); + $el['eventName'] = $row->event_name; + $el['handlerPath'] = $row->handler_path; + $el['handlerClass'] = $tow->handler_class; + $el['condition'] = $row->cond; + $el['isActive'] = $row->is_active; + $out[] = $el; + } + return $out; + } + } +?> diff --git a/oss/vtiger/trunk/include/events/VTWSEntityType.inc b/oss/vtiger/trunk/include/events/VTWSEntityType.inc new file mode 100644 index 00000000..2805167d --- /dev/null +++ b/oss/vtiger/trunk/include/events/VTWSEntityType.inc @@ -0,0 +1,203 @@ +entityTypeName = $entityTypeName; + $this->description = $describeResult; + } + + function usingGlobalCurrentUser($entityTypeName){ + global $current_user; + return new VTWSEntityType($entityTypeName, $current_user); + + + } + + function forUser($entityTypeName, $user){ + return new VTWSEntityType($entityTypeName, $user); + } + function getTabId(){ + global $adb; + if(!isset($this->tabId)){ + $result = $adb->pquery("select tabid from vtiger_tab where name=?", + array($this->entityTypeName)); + $this->tabId = $adb->query_result($result,0,"tabid"); + } + return $this->tabId; + } + + function getModuleName(){ + return $this->moduleName; + } + + function getFieldNames(){ + if(!isset($this->fieldNames)){ + $fields = $this->description['fields']; + $arr = array(); + foreach($fields as $field){ + $arr[]=$field["name"]; + } + $this->fieldNames = $arr; + } + return $this->fieldNames; + } + + + + function getFieldLabel($fieldName){ + if(!isset($this->fieldLabels)){ + $this->getFieldLabels(); + } + return $this->fieldLabels[$fieldName]; + } + + function getFieldLabels(){ + if(!isset($this->fieldLabels)){ + $fields = $this->description['fields']; + foreach($fields as $field){ + $this->fieldLabels[$field['name']] = $field['label']; + } + } + return $this->fieldLabels; + } + + function getFieldType($fieldName){ + if(!isset($this->fieldTypes[$fieldName])){ + $fields = $this->description['fields']; + foreach($fields as $field){ + if($field['name']==$fieldName){ + $type = $field['type']; + $et = new VTWSFieldType(); + switch($type['name']){ + case 'reference': + $et->type = 'Related'; + $et->relatedTo = $type['refersTo']; + break; + case 'integer': + $et->type = 'Number'; + $et->format = 'Integer'; + break; + case 'url': + $et->type = 'Url'; + break; + case 'string': + $et->type = 'String'; + break; + case 'picklist': + $et->type = 'Select'; + $et->values = $type['picklistValues']; + break; + case 'datetime': + $et->type = 'DateTime'; + break; + case 'email': + $et->type = 'Email'; + break; + case 'boolean': + $et->type = 'Boolean'; + break; + case 'phone': + $et->type = 'Phone'; + break; + case 'text': + $et->type = 'String'; + break; + case 'a'://Autogenerated type is getting messed up for Accounts + $et->type = 'Id'; + break; + case 'date': + $et->type = 'Date'; + break; + case 'time': + $et->type = 'Time'; + break; + case 'double': + $et->type = 'Number'; + $et->format = 'Decimal'; + break; + case 'autogenerated': + $et->type = 'Id'; + break; + case 'owner': + $et->type = 'Owner'; + break; + case 'multipicklist': + $et->type = 'Select'; + $et->values = array(); + break; + case 'skype': + $et->type = 'Skype'; + break; + case 'password': + $et->type = 'Password'; + break; + case 'decimal': + $et->type = 'Number'; + $et->format = 'Decimal'; + break; + default: + print_r($type); + throw new Exception($type["name"]." is not supported yet."); + } + $this->fieldTypes[$fieldName] = $et; + break; + } + } + + } + return $this->fieldTypes[$fieldName]; + } + + function getFieldTypes(){ + $adb = $this->adb; + $fieldNames = $this->getFieldNames(); + $fieldTypes = array(); + foreach($fieldNames as $fieldName){ + $fieldTypes[$fieldName]=$this->getFieldType($fieldName); + } + return $fieldTypes; + } + +} + + + +class VTWSFieldType{ + function toArray(){ + $ro = new ReflectionObject($this); + $props = $ro->getProperties(); + $arr = array(); + foreach($props as $prop){ + $arr[$prop->getName()]=$prop->getValue($this); + } + return $arr; + } +} +?> diff --git a/oss/vtiger/trunk/include/events/include.inc b/oss/vtiger/trunk/include/events/include.inc new file mode 100644 index 00000000..61501f33 --- /dev/null +++ b/oss/vtiger/trunk/include/events/include.inc @@ -0,0 +1,21 @@ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/anchor.gif b/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/anchor.gif new file mode 100644 index 00000000..5aa797b2 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/anchor.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/anchors.htc b/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/anchors.htc new file mode 100644 index 00000000..0bb7a1be --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/anchors.htc @@ -0,0 +1,30 @@ + + + + + + + + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/disablehandles.htc b/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/disablehandles.htc new file mode 100644 index 00000000..8dfb661d --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/disablehandles.htc @@ -0,0 +1,15 @@ + + + + + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/hiddenfield.gif b/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/hiddenfield.gif new file mode 100644 index 00000000..12bc2511 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/hiddenfield.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/hiddenfield.htc b/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/hiddenfield.htc new file mode 100644 index 00000000..455484ff --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/hiddenfield.htc @@ -0,0 +1,30 @@ + + + + + + + + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/moz-bindings.xml b/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/moz-bindings.xml new file mode 100644 index 00000000..111dd11a --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/moz-bindings.xml @@ -0,0 +1,59 @@ + + + + + + this.CheckShowBorders() ; + + + + var oClassRegex = /\s*FCK__ShowTableBorders\s*/ ; + + if ( this.border == 0 ) + { + if ( !oClassRegex.test( this.className ) ) + this.className += ' FCK__ShowTableBorders' ; + } + else + { + if ( oClassRegex.test( this.className ) ) + this.className = this.className.replace( oClassRegex, '' ) ; + } + + + + + + this.CheckShowBorders() ; + + + + + + + 0 && ( this.getAttribute('href') == null || this.getAttribute('href').length == 0 ) ) ; + this.ShowIcon() ; + ]]> + + + + if ( this.IsAnchor ) + { + this.style.height = '1px' ; + this.style.paddingLeft = '16px' ; + this.style.backgroundImage = 'url(behaviors/anchor.gif)' ; + this.style.backgroundRepeat = 'no-repeat' ; + this.style.cursor = 'pointer' ; + } + + + + + + if ( this.IsAnchor ) + alert( this.IsAnchor ) ; + + + + \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/showtableborders.htc b/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/showtableborders.htc new file mode 100644 index 00000000..7fef3f31 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/css/behaviors/showtableborders.htc @@ -0,0 +1,36 @@ + + + + + + + + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/css/fck_editorarea.css b/oss/vtiger/trunk/include/fckeditor/editor/css/fck_editorarea.css new file mode 100644 index 00000000..305b786f --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/css/fck_editorarea.css @@ -0,0 +1,67 @@ +/* + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2005 Frederico Caldeira Knabben + * + * Licensed under the terms of the GNU Lesser General Public License: + * http://www.opensource.org/licenses/lgpl-license.php + * + * For further information visit: + * http://www.fckeditor.net/ + * + * "Support Open Source software. What about a donation today?" + * + * File Name: fck_editorarea.css + * This is the default CSS file used by the editor area. It defines the + * initial font of the editor and background color. + * + * A user can configure the editor to use another CSS file. Just change + * the value of the FCKConfig.EditorAreaCSS key in the configuration + * file. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +body +{ + font-family: Arial, Verdana, Sans-Serif; + font-size: 12px; + padding: 5px 5px 5px 5px; + margin: 0px; + border-style: none; + background-color: #ffffff; +} + +/* + Just uncomment the following block if you want to avoid spaces between + paragraphs. Remember to apply the same style in your output front end page. +*/ +/* +P, UL, LI +{ + margin-top: 0px; + margin-bottom: 0px; +} +*/ + +.Bold +{ + font-weight: bold; +} + +.Title +{ + font-weight: bold; + font-size: 18px; + color: #cc3300; +} + +.Code +{ + border: #8b4513 1px solid; + padding-right: 5px; + padding-left: 5px; + color: #000066; + font-family: 'Courier New' , Monospace; + background-color: #ff9933; +} \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/css/fck_internal.css b/oss/vtiger/trunk/include/fckeditor/editor/css/fck_internal.css new file mode 100644 index 00000000..6ad7abc7 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/css/fck_internal.css @@ -0,0 +1,80 @@ +/* + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2005 Frederico Caldeira Knabben + * + * Licensed under the terms of the GNU Lesser General Public License: + * http://www.opensource.org/licenses/lgpl-license.php + * + * For further information visit: + * http://www.fckeditor.net/ + * + * "Support Open Source software. What about a donation today?" + * + * File Name: fck_internal.css + * This CSS Style Sheet defines rules used by the editor for its internal use. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +TABLE.FCK__ShowTableBorders, TABLE.FCK__ShowTableBorders TD, TABLE.FCK__ShowTableBorders TH +{ + border: #d3d3d3 1px solid; +} + +FORM +{ + border: 1px dotted #FF0000; + padding: 2px; +} + +.FCK__Flash +{ + border: darkgray 1px solid; + background-position: center center; + background-image: url(images/fck_flashlogo.gif); + background-repeat: no-repeat; + width: 80px; + height: 80px; +} + +.FCK__Anchor +{ + background-position: center center; + background-image: url(images/fck_anchor.gif); + background-repeat: no-repeat; + width: 16px; + height: 15px; +} + +.FCK__PageBreak +{ + background-position: center center; + background-image: url(images/fck_pagebreak.gif); + background-repeat: no-repeat; + clear: both; + display: block; + float: none; + width: 100%; + border-top: #999999 1px dotted; + border-bottom: #999999 1px dotted; + border-right: 0px; + border-left: 0px; + height: 5px; +} + +input[type="hidden"] +{ + display: inline; + width:20px; + height:20px; + border:1px dotted #FF0000 ; + background-image: url(behaviors/hiddenfield.gif); + background-repeat: no-repeat; +} + +input[type="hidden"]:after +{ + padding-left: 20px; + content: "" ; +} diff --git a/oss/vtiger/trunk/include/fckeditor/editor/css/fck_showtableborders_gecko.css b/oss/vtiger/trunk/include/fckeditor/editor/css/fck_showtableborders_gecko.css new file mode 100644 index 00000000..f92467a4 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/css/fck_showtableborders_gecko.css @@ -0,0 +1,31 @@ +/* + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2005 Frederico Caldeira Knabben + * + * Licensed under the terms of the GNU Lesser General Public License: + * http://www.opensource.org/licenses/lgpl-license.php + * + * For further information visit: + * http://www.fckeditor.net/ + * + * "Support Open Source software. What about a donation today?" + * + * File Name: fck_showtableborders_gecko.css + * This CSS Style Sheet defines the rules to show table borders on Gecko. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ +TABLE[border="0"], +TABLE[border="0"] > TR > TD, TABLE[border="0"] > TR > TH, +TABLE[border="0"] > TBODY > TR > TD, TABLE[border="0"] > TBODY > TR > TH, +TABLE[border="0"] > THEAD > TR > TD, TABLE[border="0"] > THEAD > TR > TH, +TABLE[border="0"] > TFOOT > TR > TD, TABLE[border="0"] > TFOOT > TR > TH, +TABLE:not([border]), +TABLE:not([border]) > TR > TD, TABLE:not([border]) > TR > TH, +TABLE:not([border]) > TBODY > TR > TD, TABLE:not([border]) > TBODY > TR > TH, +TABLE:not([border]) > THEAD > TR > TD, TABLE:not([border]) > THEAD > TR > TH, +TABLE:not([border]) > TFOOT > TR > TD, TABLE:not([border]) > TFOOT > TR > TH +{ + border: #d3d3d3 1px dotted ; +} diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/fck_dialog_common.css b/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/fck_dialog_common.css new file mode 100644 index 00000000..fab1a747 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/fck_dialog_common.css @@ -0,0 +1,79 @@ +/* + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2005 Frederico Caldeira Knabben + * + * Licensed under the terms of the GNU Lesser General Public License: + * http://www.opensource.org/licenses/lgpl-license.php + * + * For further information visit: + * http://www.fckeditor.net/ + * + * "Support Open Source software. What about a donation today?" + * + * File Name: fck_dialog_common.css + * This is the CSS file used for interface details in some dialog + * windows. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +.ImagePreviewArea +{ + border: #000000 1px solid; + overflow: auto; + width: 100%; + height: 170px; + background-color: #ffffff; +} + +.FlashPreviewArea +{ + border: #000000 1px solid; + padding: 5px; + overflow: auto; + width: 100%; + height: 170px; + background-color: #ffffff; +} + +.BtnReset +{ + float: left; + background-position: center center; + background-image: url(images/reset.gif); + width: 16px; + height: 16px; + background-repeat: no-repeat; + border: 1px none; + font-size: 1px ; +} + +.BtnLocked, .BtnUnlocked +{ + float: left; + background-position: center center; + background-image: url(images/locked.gif); + width: 16px; + height: 16px; + background-repeat: no-repeat; + border: 1px none; + font-size: 1px ; +} + +.BtnUnlocked +{ + background-image: url(images/unlocked.gif); +} + +.BtnOver +{ + border: 1px outset; + cursor: pointer; + cursor: hand; +} + +.FCK__FieldNumeric +{ + behavior: url(common/fcknumericfield.htc) ; +} \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/fck_dialog_common.js b/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/fck_dialog_common.js new file mode 100644 index 00000000..bc3a1386 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/fck_dialog_common.js @@ -0,0 +1,125 @@ +/* + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2005 Frederico Caldeira Knabben + * + * Licensed under the terms of the GNU Lesser General Public License: + * http://www.opensource.org/licenses/lgpl-license.php + * + * For further information visit: + * http://www.fckeditor.net/ + * + * "Support Open Source software. What about a donation today?" + * + * File Name: fck_dialog_common.js + * Useful functions used by almost all dialog window pages. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +// Gets a element by its Id. Used for shorter coding. +function GetE( elementId ) +{ + return document.getElementById( elementId ) ; +} + +function ShowE( element, isVisible ) +{ + if ( typeof( element ) == 'string' ) + element = GetE( element ) ; + element.style.display = isVisible ? '' : 'none' ; +} + +function SetAttribute( element, attName, attValue ) +{ + if ( attValue == null || attValue.length == 0 ) + element.removeAttribute( attName, 0 ) ; // 0 : Case Insensitive + else + element.setAttribute( attName, attValue, 0 ) ; // 0 : Case Insensitive +} + +function GetAttribute( element, attName, valueIfNull ) +{ + var oAtt = element.attributes[attName] ; + + if ( oAtt == null || !oAtt.specified ) + return valueIfNull ? valueIfNull : '' ; + + var oValue ; + + if ( !( oValue = element.getAttribute( attName, 2 ) ) ) + oValue = oAtt.nodeValue ; + + return ( oValue == null ? valueIfNull : oValue ) ; +} + +// Functions used by text fiels to accept numbers only. +function IsDigit( e ) +{ + e = e || event ; + var iCode = ( e.keyCode || e.charCode ) ; + + event.returnValue = + ( + ( iCode >= 48 && iCode <= 57 ) // Numbers + || (iCode >= 37 && iCode <= 40) // Arrows + || iCode == 8 // Backspace + || iCode == 46 // Delete + ) ; + + return event.returnValue ; +} + +String.prototype.trim = function() +{ + return this.replace( /(^\s*)|(\s*$)/g, '' ) ; +} + +String.prototype.startsWith = function( value ) +{ + return ( this.substr( 0, value.length ) == value ) ; +} + +String.prototype.remove = function( start, length ) +{ + var s = '' ; + + if ( start > 0 ) + s = this.substring( 0, start ) ; + + if ( start + length < this.length ) + s += this.substring( start + length , this.length ) ; + + return s ; +} + +function OpenFileBrowser( url, width, height ) +{ + // oEditor must be defined. + + var iLeft = ( oEditor.FCKConfig.ScreenWidth - width ) / 2 ; + var iTop = ( oEditor.FCKConfig.ScreenHeight - height ) / 2 ; + + var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes" ; + sOptions += ",width=" + width ; + sOptions += ",height=" + height ; + sOptions += ",left=" + iLeft ; + sOptions += ",top=" + iTop ; + + // The "PreserveSessionOnFileBrowser" because the above code could be + // blocked by popup blockers. + if ( oEditor.FCKConfig.PreserveSessionOnFileBrowser && oEditor.FCKBrowserInfo.IsIE ) + { + // The following change has been made otherwise IE will open the file + // browser on a different server session (on some cases): + // http://support.microsoft.com/default.aspx?scid=kb;en-us;831678 + // by Simone Chiaretta. + var oWindow = oEditor.window.open( url, 'FCKBrowseWindow', sOptions ) ; + if ( oWindow ) + oWindow.opener = window ; + else + alert( oEditor.FCKLang.BrowseServerBlocked ) ; + } + else + window.open( url, 'FCKBrowseWindow', sOptions ) ; +} \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/fcknumericfield.htc b/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/fcknumericfield.htc new file mode 100644 index 00000000..74f26d0d --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/fcknumericfield.htc @@ -0,0 +1,24 @@ + + + + + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/images/locked.gif b/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/images/locked.gif new file mode 100644 index 00000000..ea078700 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/images/locked.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/images/reset.gif b/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/images/reset.gif new file mode 100644 index 00000000..5e9a2fcb Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/images/reset.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/images/unlocked.gif b/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/images/unlocked.gif new file mode 100644 index 00000000..801e423c Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/images/unlocked.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/moz-bindings.xml b/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/moz-bindings.xml new file mode 100644 index 00000000..b056123b --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/common/moz-bindings.xml @@ -0,0 +1,28 @@ + + + + + + this.keypress = CheckIsDigit ; + + + + var iCode = keyCode ; + + var bAccepted = + ( + ( iCode >= 48 && iCode <= 57 ) // Numbers + || (iCode >= 37 && iCode <= 40) // Arrows + || iCode == 8 // Backspace + || iCode == 46 // Delete + ) ; + + return bAccepted ; + + + + + + + + \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_about.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_about.html new file mode 100644 index 00000000..3eae0035 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_about.html @@ -0,0 +1,144 @@ + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + +
+ version +
+ 2.2
+
+  
+ Support Open Source software.
+ + What about a donation today?
+


+ For further information go to + http://www.fckeditor.net/. +
+ Copyright © 2003-2005 Frederico Caldeira + Knabben +
+ +
+
+ + + + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_about/lgpl.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_about/lgpl.html new file mode 100644 index 00000000..7dfce1d5 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_about/lgpl.html @@ -0,0 +1,434 @@ + + + + GNU Lesser General Public License + + + + +

GNU Lesser General Public License

+ +

Version 2.1, February 1999

+
+

Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite + 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute + verbatim copies of this license document, but changing it is not allowed.

+

[This is the first released version of the Lesser GPL. It also counts as the + successor of the GNU Library Public License, version 2, hence the version + number 2.1.]

+
+

Preamble

+

The licenses for most software are designed to take away your freedom to share + and change it. By contrast, the GNU General Public Licenses are intended to + guarantee your freedom to share and change free software--to make sure the + software is free for all its users. +

+

This license, the Lesser General Public License, applies to some specially + designated software packages--typically libraries--of the Free Software + Foundation and other authors who decide to use it. You can use it too, but we + suggest you first think carefully about whether this license or the ordinary + General Public License is the better strategy to use in any particular case, + based on the explanations below. +

+

When we speak of free software, we are referring to freedom of use, not price. + Our General Public Licenses are designed to make sure that you have the freedom + to distribute copies of free software (and charge for this service if you + wish); that you receive source code or can get it if you want it; that you can + change the software and use pieces of it in new free programs; and that you are + informed that you can do these things.

+

To protect your rights, we need to make restrictions that forbid distributors to + deny you these rights or to ask you to surrender these rights. These + restrictions translate to certain responsibilities for you if you distribute + copies of the library or if you modify it. +

+

For example, if you distribute copies of the library, whether gratis or for a + fee, you must give the recipients all the rights that we gave you. You must + make sure that they, too, receive or can get the source code. If you link other + code with the library, you must provide complete object files to the + recipients, so that they can relink them with the library after making changes + to the library and recompiling it. And you must show them these terms so they + know their rights. +

+

We protect your rights with a two-step method: (1) we copyright the library, and + (2) we offer you this license, which gives you legal permission to copy, + distribute and/or modify the library. +

+

To protect each distributor, we want to make it very clear that there is no + warranty for the free library. Also, if the library is modified by someone else + and passed on, the recipients should know that what they have is not the + original version, so that the original author's reputation will not be affected + by problems that might be introduced by others. +

+

Finally, software patents pose a constant threat to the existence of any free + program. We wish to make sure that a company cannot effectively restrict the + users of a free program by obtaining a restrictive license from a patent + holder. Therefore, we insist that any patent license obtained for a version of + the library must be consistent with the full freedom of use specified in this + license. +

+

Most GNU software, including some libraries, is covered by the ordinary GNU + General Public License. This license, the GNU Lesser General Public License, + applies to certain designated libraries, and is quite different from the + ordinary General Public License. We use this license for certain libraries in + order to permit linking those libraries into non-free programs. +

+

When a program is linked with a library, whether statically or using a shared + library, the combination of the two is legally speaking a combined work, a + derivative of the original library. The ordinary General Public License + therefore permits such linking only if the entire combination fits its criteria + of freedom. The Lesser General Public License permits more lax criteria for + linking other code with the library. +

+

We call this license the "Lesser" General Public License because it does Less to + protect the user's freedom than the ordinary General Public License. It also + provides other free software developers Less of an advantage over competing + non-free programs. These disadvantages are the reason we use the ordinary + General Public License for many libraries. However, the Lesser license provides + advantages in certain special circumstances. +

+

For example, on rare occasions, there may be a special need to encourage the + widest possible use of a certain library, so that it becomes a de-facto + standard. To achieve this, non-free programs must be allowed to use the + library. A more frequent case is that a free library does the same job as + widely used non-free libraries. In this case, there is little to gain by + limiting the free library to free software only, so we use the Lesser General + Public License. +

+

In other cases, permission to use a particular library in non-free programs + enables a greater number of people to use a large body of free software. For + example, permission to use the GNU C Library in non-free programs enables many + more people to use the whole GNU operating system, as well as its variant, the + GNU/Linux operating system. +

+

Although the Lesser General Public License is Less protective of the users' + freedom, it does ensure that the user of a program that is linked with the + Library has the freedom and the wherewithal to run that program using a + modified version of the Library. +

+

The precise terms and conditions for copying, distribution and modification + follow. Pay close attention to the difference between a "work based on the + library" and a "work that uses the library". The former contains code derived + from the library, whereas the latter must be combined with the library in order + to run. +

+

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

+

0. This License Agreement applies to any software library or + other program which contains a notice placed by the copyright holder or other + authorized party saying it may be distributed under the terms of this Lesser + General Public License (also called "this License"). Each licensee is addressed + as "you".

+

A "library" means a collection of software functions and/or data prepared so as + to be conveniently linked with application programs (which use some of those + functions and data) to form executables. +

+

The "Library", below, refers to any such software library or work which has been + distributed under these terms. A "work based on the Library" means either the + Library or any derivative work under copyright law: that is to say, a work + containing the Library or a portion of it, either verbatim or with + modifications and/or translated straightforwardly into another language. + (Hereinafter, translation is included without limitation in the term + "modification".) +

+

"Source code" for a work means the preferred form of the work for making + modifications to it. For a library, complete source code means all the source + code for all modules it contains, plus any associated interface definition + files, plus the scripts used to control compilation and installation of the + library.

+

Activities other than copying, distribution and modification are not covered by + this License; they are outside its scope. The act of running a program using + the Library is not restricted, and output from such a program is covered only + if its contents constitute a work based on the Library (independent of the use + of the Library in a tool for writing it). Whether that is true depends on what + the Library does and what the program that uses the Library does. +

+

1. You may copy and distribute verbatim copies of the Library's + complete source code as you receive it, in any medium, provided that you + conspicuously and appropriately publish on each copy an appropriate copyright + notice and disclaimer of warranty; keep intact all the notices that refer to + this License and to the absence of any warranty; and distribute a copy of this + License along with the Library. +

+

You may charge a fee for the physical act of transferring a copy, and you may at + your option offer warranty protection in exchange for a fee. +

+

2. You may modify your copy or copies of the Library or any + portion of it, thus forming a work based on the Library, and copy and + distribute such modifications or work under the terms of Section 1 above, + provided that you also meet all of these conditions: +

+
+

a) The modified work must itself be a software library. +

+

b) You must cause the files modified to carry prominent notices stating that you + changed the files and the date of any change.

+

c) You must cause the whole of the work to be licensed at no charge to all third + parties under the terms of this License. +

+

d) If a facility in the modified Library refers to a function or a table of data + to be supplied by an application program that uses the facility, other than as + an argument passed when the facility is invoked, then you must make a good + faith effort to ensure that, in the event an application does not supply such + function or table, the facility still operates, and performs whatever part of + its purpose remains meaningful. +

+

(For example, a function in a library to compute square roots has a purpose that + is entirely well-defined independent of the application. Therefore, Subsection + 2d requires that any application-supplied function or table used by this + function must be optional: if the application does not supply it, the square + root function must still compute square roots.) +

+

These requirements apply to the modified work as a whole. If identifiable + sections of that work are not derived from the Library, and can be reasonably + considered independent and separate works in themselves, then this License, and + its terms, do not apply to those sections when you distribute them as separate + works. But when you distribute the same sections as part of a whole which is a + work based on the Library, the distribution of the whole must be on the terms + of this License, whose permissions for other licensees extend to the entire + whole, and thus to each and every part regardless of who wrote it. +

+

Thus, it is not the intent of this section to claim rights or contest your + rights to work written entirely by you; rather, the intent is to exercise the + right to control the distribution of derivative or collective works based on + the Library. +

+

In addition, mere aggregation of another work not based on the Library with the + Library (or with a work based on the Library) on a volume of a storage or + distribution medium does not bring the other work under the scope of this + License. +

+
+

3. You may opt to apply the terms of the ordinary GNU General + Public License instead of this License to a given copy of the Library. To do + this, you must alter all the notices that refer to this License, so that they + refer to the ordinary GNU General Public License, version 2, instead of to this + License. (If a newer version than version 2 of the ordinary GNU General Public + License has appeared, then you can specify that version instead if you wish.) + Do not make any other change in these notices. +

+

Once this change is made in a given copy, it is irreversible for that copy, so + the ordinary GNU General Public License applies to all subsequent copies and + derivative works made from that copy. +

+

This option is useful when you wish to copy part of the code of the Library into + a program that is not a library. +

+

4. You may copy and distribute the Library (or a portion or + derivative of it, under Section 2) in object code or executable form under the + terms of Sections 1 and 2 above provided that you accompany it with the + complete corresponding machine-readable source code, which must be distributed + under the terms of Sections 1 and 2 above on a medium customarily used for + software interchange. +

+

If distribution of object code is made by offering access to copy from a + designated place, then offering equivalent access to copy the source code from + the same place satisfies the requirement to distribute the source code, even + though third parties are not compelled to copy the source along with the object + code.

+

5. A program that contains no derivative of any portion of the + Library, but is designed to work with the Library by being compiled or linked + with it, is called a "work that uses the Library". Such a work, in isolation, + is not a derivative work of the Library, and therefore falls outside the scope + of this License. +

+

However, linking a "work that uses the Library" with the Library creates an + executable that is a derivative of the Library (because it contains portions of + the Library), rather than a "work that uses the library". The executable is + therefore covered by this License. Section 6 states terms for distribution of + such executables. +

+

When a "work that uses the Library" uses material from a header file that is + part of the Library, the object code for the work may be a derivative work of + the Library even though the source code is not. Whether this is true is + especially significant if the work can be linked without the Library, or if the + work is itself a library. The threshold for this to be true is not precisely + defined by law. +

+

If such an object file uses only numerical parameters, data structure layouts + and accessors, and small macros and small inline functions (ten lines or less + in length), then the use of the object file is unrestricted, regardless of + whether it is legally a derivative work. (Executables containing this object + code plus portions of the Library will still fall under Section 6.) +

+

Otherwise, if the work is a derivative of the Library, you may distribute the + object code for the work under the terms of Section 6. Any executables + containing that work also fall under Section 6, whether or not they are linked + directly with the Library itself. +

+

6. As an exception to the Sections above, you may also combine + or link a "work that uses the Library" with the Library to produce a work + containing portions of the Library, and distribute that work under terms of + your choice, provided that the terms permit modification of the work for the + customer's own use and reverse engineering for debugging such modifications. +

+

You must give prominent notice with each copy of the work that the Library is + used in it and that the Library and its use are covered by this License. You + must supply a copy of this License. If the work during execution displays + copyright notices, you must include the copyright notice for the Library among + them, as well as a reference directing the user to the copy of this License. + Also, you must do one of these things: +

+
+

a) Accompany the work with the complete corresponding machine-readable source + code for the Library including whatever changes were used in the work (which + must be distributed under Sections 1 and 2 above); and, if the work is an + executable linked with the Library, with the complete machine-readable "work + that uses the Library", as object code and/or source code, so that the user can + modify the Library and then relink to produce a modified executable containing + the modified Library. (It is understood that the user who changes the contents + of definitions files in the Library will not necessarily be able to recompile + the application to use the modified definitions.) +

+

b) Use a suitable shared library mechanism for linking with the Library. A + suitable mechanism is one that (1) uses at run time a copy of the library + already present on the user's computer system, rather than copying library + functions into the executable, and (2) will operate properly with a modified + version of the library, if the user installs one, as long as the modified + version is interface-compatible with the version that the work was made with. +

+

c) Accompany the work with a written offer, valid for at least three years, to + give the same user the materials specified in Subsection 6a, above, for a + charge no more than the cost of performing this distribution. +

+

d) If distribution of the work is made by offering access to copy from a + designated place, offer equivalent access to copy the above specified materials + from the same place. +

+

e) Verify that the user has already received a copy of these materials or that + you have already sent this user a copy.

+
+

For an executable, the required form of the "work that uses the Library" must + include any data and utility programs needed for reproducing the executable + from it. However, as a special exception, the materials to be distributed need + not include anything that is normally distributed (in either source or binary + form) with the major components (compiler, kernel, and so on) of the operating + system on which the executable runs, unless that component itself accompanies + the executable. +

+

It may happen that this requirement contradicts the license restrictions of + other proprietary libraries that do not normally accompany the operating + system. Such a contradiction means you cannot use both them and the Library + together in an executable that you distribute. +

+

7. You may place library facilities that are a work based on + the Library side-by-side in a single library together with other library + facilities not covered by this License, and distribute such a combined library, + provided that the separate distribution of the work based on the Library and of + the other library facilities is otherwise permitted, and provided that you do + these two things: +

+
+

a) Accompany the combined library with a copy of the same work based on the + Library, uncombined with any other library facilities. This must be distributed + under the terms of the Sections above. +

+

b) Give prominent notice with the combined library of the fact that part of it + is a work based on the Library, and explaining where to find the accompanying + uncombined form of the same work.

+
+

8. You may not copy, modify, sublicense, link with, or + distribute the Library except as expressly provided under this License. Any + attempt otherwise to copy, modify, sublicense, link with, or distribute the + Library is void, and will automatically terminate your rights under this + License. However, parties who have received copies, or rights, from you under + this License will not have their licenses terminated so long as such parties + remain in full compliance. +

+

9. You are not required to accept this License, since you have + not signed it. However, nothing else grants you permission to modify or + distribute the Library or its derivative works. These actions are prohibited by + law if you do not accept this License. Therefore, by modifying or distributing + the Library (or any work based on the Library), you indicate your acceptance of + this License to do so, and all its terms and conditions for copying, + distributing or modifying the Library or works based on it. +

+

10. Each time you redistribute the Library (or any work based + on the Library), the recipient automatically receives a license from the + original licensor to copy, distribute, link with or modify the Library subject + to these terms and conditions. You may not impose any further restrictions on + the recipients' exercise of the rights granted herein. You are not responsible + for enforcing compliance by third parties with this License. +

+

11. If, as a consequence of a court judgment or allegation of + patent infringement or for any other reason (not limited to patent issues), + conditions are imposed on you (whether by court order, agreement or otherwise) + that contradict the conditions of this License, they do not excuse you from the + conditions of this License. If you cannot distribute so as to satisfy + simultaneously your obligations under this License and any other pertinent + obligations, then as a consequence you may not distribute the Library at all. + For example, if a patent license would not permit royalty-free redistribution + of the Library by all those who receive copies directly or indirectly through + you, then the only way you could satisfy both it and this License would be to + refrain entirely from distribution of the Library. +

+

If any portion of this section is held invalid or unenforceable under any + particular circumstance, the balance of the section is intended to apply, and + the section as a whole is intended to apply in other circumstances. +

+

It is not the purpose of this section to induce you to infringe any patents or + other property right claims or to contest validity of any such claims; this + section has the sole purpose of protecting the integrity of the free software + distribution system which is implemented by public license practices. Many + people have made generous contributions to the wide range of software + distributed through that system in reliance on consistent application of that + system; it is up to the author/donor to decide if he or she is willing to + distribute software through any other system and a licensee cannot impose that + choice. +

+

This section is intended to make thoroughly clear what is believed to be a + consequence of the rest of this License. +

+

12. If the distribution and/or use of the Library is restricted + in certain countries either by patents or by copyrighted interfaces, the + original copyright holder who places the Library under this License may add an + explicit geographical distribution limitation excluding those countries, so + that distribution is permitted only in or among countries not thus excluded. In + such case, this License incorporates the limitation as if written in the body + of this License. +

+

13. The Free Software Foundation may publish revised and/or new + versions of the Lesser General Public License from time to time. Such new + versions will be similar in spirit to the present version, but may differ in + detail to address new problems or concerns.

+

Each version is given a distinguishing version number. If the Library specifies + a version number of this License which applies to it and "any later version", + you have the option of following the terms and conditions either of that + version or of any later version published by the Free Software Foundation. If + the Library does not specify a license version number, you may choose any + version ever published by the Free Software Foundation. +

+

14. If you wish to incorporate parts of the Library into other + free programs whose distribution conditions are incompatible with these, write + to the author to ask for permission. For software which is copyrighted by the + Free Software Foundation, write to the Free Software Foundation; we sometimes + make exceptions for this. Our decision will be guided by the two goals of + preserving the free status of all derivatives of our free software and of + promoting the sharing and reuse of software generally. +

+

NO WARRANTY +

+

15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO + WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT + WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES + PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR + IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE + QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE + DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR + CORRECTION. +

+

16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO + IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR + REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, + INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT + OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS + OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD + PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN + IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + DAMAGES. +

+

END OF TERMS AND CONDITIONS

+
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_about/logo_fckeditor.gif b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_about/logo_fckeditor.gif new file mode 100644 index 00000000..b7d6bc6f Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_about/logo_fckeditor.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_about/logo_fredck.gif b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_about/logo_fredck.gif new file mode 100644 index 00000000..3108dd9e Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_about/logo_fredck.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_anchor.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_anchor.html new file mode 100644 index 00000000..feb0090e --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_anchor.html @@ -0,0 +1,98 @@ + + + + + Anchor Properties + + + + + + + + + + +
+ + + + +
+ Anchor Name
+ +
+
+ + \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_button.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_button.html new file mode 100644 index 00000000..906e5a42 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_button.html @@ -0,0 +1,103 @@ + + + + + Button Properties + + + + + + + + + + +
+ + + + + + + + + + +
+ Name
+ +
+ Text (Value)
+ +
+ Type
+ +
+
+ + \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_checkbox.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_checkbox.html new file mode 100644 index 00000000..37a7eb0b --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_checkbox.html @@ -0,0 +1,103 @@ + + + + + Checkbox Properties + + + + + + + + + + +
+ + + + + + + + + + +
+ Name
+ +
+ Value
+ +
+
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_colorselector.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_colorselector.html new file mode 100644 index 00000000..031f866f --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_colorselector.html @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + +
+ + + + + +
+ +
+
+ Highlight +
+
 
+ Selected +
+ +
+ +
+
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_docprops.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_docprops.html new file mode 100644 index 00000000..ab6e3f4a --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_docprops.html @@ -0,0 +1,570 @@ + + + + + Document Properties + + + + + + + + + + + + + +
+
+ Page Title
+ +
+ + + + + + +
+ Language Direction
+ +
    + Language Code
+ +
+
+ + + + + + + + + + + + + + +
Character Set Encoding
+ +
    + Other Character Set Encoding
+ +
 
+ Document Type Heading
+ +
+ Other Document Type Heading
+ +
+
+ +
+ + + +
+ + \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_docprops/fck_document_preview.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_docprops/fck_document_preview.html new file mode 100644 index 00000000..c620010e --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_docprops/fck_document_preview.html @@ -0,0 +1,109 @@ + + + + + Document Properties - Preview + + + + + + + + + + + + + + +
+ Normal Text +
+ Visited Link + + Active Link +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_find.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_find.html new file mode 100644 index 00000000..4c0b5a8a --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_find.html @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + +
+   + + + + +
+   +
+ +
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_flash.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_flash.html new file mode 100644 index 00000000..d7f6cfdd --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_flash.html @@ -0,0 +1,142 @@ + + + + + Flash Properties + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + +
URL +
+
+
+ + + + + + +
+ Width
+ +
  + Height
+ +
+
+ + + + +
+ + + + + + + +
Preview
+
+
+
+ + + + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_form.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_form.html new file mode 100644 index 00000000..b6c05d56 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_form.html @@ -0,0 +1,101 @@ + + + + + Checkbox Properties + + + + + + + + + + +
+ + + + + + + + + + +
+ Name
+ +
+ Action
+ +
+ Method
+ +
+
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_hiddenfield.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_hiddenfield.html new file mode 100644 index 00000000..1bcfc437 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_hiddenfield.html @@ -0,0 +1,91 @@ + + + + + Hidden Field Properties + + + + + + + + + + +
+ + + + + + + +
+ Name
+ +
+ Value
+ +
+
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_image.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_image.html new file mode 100644 index 00000000..78cf4343 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_image.html @@ -0,0 +1,225 @@ + + + + + Image Properties + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + +
+ URL +
+ +
+
+ Short Description
+
+
+ + + + + + +
+
+ + + + + + + + + + +
Width  + +
+
+
Height  +
+
+ + + + + + + + + + + + + + + + + +
Border  +
HSpace  +
VSpace  +
Align  +
+
    + + + + + + + +
Preview
+ +
+
+
+
+ + + + + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_image/fck_image.js b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_image/fck_image.js new file mode 100644 index 00000000..2b5b4ff3 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_image/fck_image.js @@ -0,0 +1,475 @@ +/* + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2005 Frederico Caldeira Knabben + * + * Licensed under the terms of the GNU Lesser General Public License: + * http://www.opensource.org/licenses/lgpl-license.php + * + * For further information visit: + * http://www.fckeditor.net/ + * + * "Support Open Source software. What about a donation today?" + * + * File Name: fck_image.js + * Scripts related to the Image dialog window (see fck_image.html). + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +var oEditor = window.parent.InnerDialogLoaded() ; +var FCK = oEditor.FCK ; +var FCKLang = oEditor.FCKLang ; +var FCKConfig = oEditor.FCKConfig ; +var FCKDebug = oEditor.FCKDebug ; + +var bImageButton = ( document.location.search.length > 0 && document.location.search.substr(1) == 'ImageButton' ) ; + +//#### Dialog Tabs + +// Set the dialog tabs. +window.parent.AddTab( 'Info', FCKLang.DlgImgInfoTab ) ; + +if ( !bImageButton && !FCKConfig.ImageDlgHideLink ) + window.parent.AddTab( 'Link', FCKLang.DlgImgLinkTab ) ; + +if ( FCKConfig.ImageUpload ) + window.parent.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ; + +if ( !FCKConfig.ImageDlgHideAdvanced ) + window.parent.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ; + +// Function called when a dialog tag is selected. +function OnDialogTabChange( tabCode ) +{ + ShowE('divInfo' , ( tabCode == 'Info' ) ) ; + ShowE('divLink' , ( tabCode == 'Link' ) ) ; + ShowE('divUpload' , ( tabCode == 'Upload' ) ) ; + ShowE('divAdvanced' , ( tabCode == 'Advanced' ) ) ; +} + +// Get the selected image (if available). +var oImage = FCK.Selection.GetSelectedElement() ; + +if ( oImage && oImage.tagName != 'IMG' && !( oImage.tagName == 'INPUT' && oImage.type == 'image' ) ) + oImage = null ; + +// Get the active link. +var oLink = FCK.Selection.MoveToAncestorNode( 'A' ) ; + +var oImageOriginal ; + +function UpdateOriginal( resetSize ) +{ + if ( !eImgPreview ) + return ; + + oImageOriginal = document.createElement( 'IMG' ) ; // new Image() ; + + if ( resetSize ) + { + oImageOriginal.onload = function() + { + this.onload = null ; + ResetSizes() ; + } + } + + oImageOriginal.src = eImgPreview.src ; +} + +var bPreviewInitialized ; + +window.onload = function() +{ + // Translate the dialog box texts. + oEditor.FCKLanguageManager.TranslatePage(document) ; + + GetE('btnLockSizes').title = FCKLang.DlgImgLockRatio ; + GetE('btnResetSize').title = FCKLang.DlgBtnResetSize ; + + // Load the selected element information (if any). + LoadSelection() ; + + // Show/Hide the "Browse Server" button. + GetE('tdBrowse').style.display = FCKConfig.ImageBrowser ? '' : 'none' ; + GetE('divLnkBrowseServer').style.display = FCKConfig.LinkBrowser ? '' : 'none' ; + + UpdateOriginal() ; + + // Set the actual uploader URL. + if ( FCKConfig.ImageUpload ) + GetE('frmUpload').action = FCKConfig.ImageUploadURL ; + + window.parent.SetAutoSize( true ) ; + + // Activate the "OK" button. + window.parent.SetOkButton( true ) ; +} + +function LoadSelection() +{ + if ( ! oImage ) return ; + + var sUrl = GetAttribute( oImage, '_fcksavedurl', '' ) ; + if ( sUrl.length == 0 ) + sUrl = GetAttribute( oImage, 'src', '' ) ; + + // TODO: Wait stable version and remove the following commented lines. +// if ( sUrl.startsWith( FCK.BaseUrl ) ) +// sUrl = sUrl.remove( 0, FCK.BaseUrl.length ) ; + + GetE('txtUrl').value = sUrl ; + GetE('txtAlt').value = GetAttribute( oImage, 'alt', '' ) ; + GetE('txtVSpace').value = GetAttribute( oImage, 'vspace', '' ) ; + GetE('txtHSpace').value = GetAttribute( oImage, 'hspace', '' ) ; + GetE('txtBorder').value = GetAttribute( oImage, 'border', '' ) ; + GetE('cmbAlign').value = GetAttribute( oImage, 'align', '' ) ; + + var iWidth, iHeight ; + + var regexSize = /^\s*(\d+)px\s*$/i ; + + if ( oImage.style.width ) + { + var aMatch = oImage.style.width.match( regexSize ) ; + if ( aMatch ) + { + iWidth = aMatch[1] ; + oImage.style.width = '' ; + } + } + + if ( oImage.style.height ) + { + var aMatch = oImage.style.height.match( regexSize ) ; + if ( aMatch ) + { + iHeight = aMatch[1] ; + oImage.style.height = '' ; + } + } + + GetE('txtWidth').value = iWidth ? iWidth : GetAttribute( oImage, "width", '' ) ; + GetE('txtHeight').value = iHeight ? iHeight : GetAttribute( oImage, "height", '' ) ; + + // Get Advances Attributes + GetE('txtAttId').value = oImage.id ; + GetE('cmbAttLangDir').value = oImage.dir ; + GetE('txtAttLangCode').value = oImage.lang ; + GetE('txtAttTitle').value = oImage.title ; + GetE('txtAttClasses').value = oImage.getAttribute('class',2) || '' ; + GetE('txtLongDesc').value = oImage.longDesc ; + + if ( oEditor.FCKBrowserInfo.IsIE ) + GetE('txtAttStyle').value = oImage.style.cssText ; + else + GetE('txtAttStyle').value = oImage.getAttribute('style',2) ; + + if ( oLink ) + { + var sUrl = GetAttribute( oLink, '_fcksavedurl', '' ) ; + if ( sUrl.length == 0 ) + sUrl = oLink.getAttribute('href',2) ; + + GetE('txtLnkUrl').value = sUrl ; + GetE('cmbLnkTarget').value = oLink.target ; + } + + UpdatePreview() ; +} + +//#### The OK button was hit. +function Ok() +{ + if ( GetE('txtUrl').value.length == 0 ) + { + window.parent.SetSelectedTab( 'Info' ) ; + GetE('txtUrl').focus() ; + + alert( FCKLang.DlgImgAlertUrl ) ; + + return false ; + } + + var bHasImage = ( oImage != null ) ; + + if ( bHasImage && bImageButton && oImage.tagName == 'IMG' ) + { + if ( confirm( 'Do you want to transform the selected image on a image button?' ) ) + oImage = null ; + } + else if ( bHasImage && !bImageButton && oImage.tagName == 'INPUT' ) + { + if ( confirm( 'Do you want to transform the selected image button on a simple image?' ) ) + oImage = null ; + } + + if ( !bHasImage ) + { + if ( bImageButton ) + { + oImage = FCK.EditorDocument.createElement( 'INPUT' ) ; + oImage.type = 'image' ; + oImage = FCK.InsertElementAndGetIt( oImage ) ; + } + else + oImage = FCK.CreateElement( 'IMG' ) ; + } + else + oEditor.FCKUndo.SaveUndoStep() ; + + UpdateImage( oImage ) ; + + var sLnkUrl = GetE('txtLnkUrl').value.trim() ; + + if ( sLnkUrl.length == 0 ) + { + if ( oLink ) + FCK.ExecuteNamedCommand( 'Unlink' ) ; + } + else + { + if ( oLink ) // Modifying an existent link. + oLink.href = sLnkUrl ; + else // Creating a new link. + { + if ( !bHasImage ) + oEditor.FCKSelection.SelectNode( oImage ) ; + + oLink = oEditor.FCK.CreateLink( sLnkUrl ) ; + + if ( !bHasImage ) + { + oEditor.FCKSelection.SelectNode( oLink ) ; + oEditor.FCKSelection.Collapse( false ) ; + } + } + + SetAttribute( oLink, '_fcksavedurl', sLnkUrl ) ; + SetAttribute( oLink, 'target', GetE('cmbLnkTarget').value ) ; + } + + return true ; +} + +function UpdateImage( e, skipId ) +{ + e.src = GetE('txtUrl').value ; + SetAttribute( e, "_fcksavedurl", GetE('txtUrl').value ) ; + SetAttribute( e, "alt" , GetE('txtAlt').value ) ; + SetAttribute( e, "width" , GetE('txtWidth').value ) ; + SetAttribute( e, "height", GetE('txtHeight').value ) ; + SetAttribute( e, "vspace", GetE('txtVSpace').value ) ; + SetAttribute( e, "hspace", GetE('txtHSpace').value ) ; + SetAttribute( e, "border", GetE('txtBorder').value ) ; + SetAttribute( e, "align" , GetE('cmbAlign').value ) ; + + // Advances Attributes + + if ( ! skipId ) + SetAttribute( e, 'id', GetE('txtAttId').value ) ; + + SetAttribute( e, 'dir' , GetE('cmbAttLangDir').value ) ; + SetAttribute( e, 'lang' , GetE('txtAttLangCode').value ) ; + SetAttribute( e, 'title' , GetE('txtAttTitle').value ) ; + SetAttribute( e, 'class' , GetE('txtAttClasses').value ) ; + SetAttribute( e, 'longDesc' , GetE('txtLongDesc').value ) ; + + if ( oEditor.FCKBrowserInfo.IsIE ) + e.style.cssText = GetE('txtAttStyle').value ; + else + SetAttribute( e, 'style', GetE('txtAttStyle').value ) ; +} + +var eImgPreview ; +var eImgPreviewLink ; + +function SetPreviewElements( imageElement, linkElement ) +{ + eImgPreview = imageElement ; + eImgPreviewLink = linkElement ; + + UpdatePreview() ; + UpdateOriginal() ; + + bPreviewInitialized = true ; +} + +function UpdatePreview() +{ + if ( !eImgPreview || !eImgPreviewLink ) + return ; + + if ( GetE('txtUrl').value.length == 0 ) + eImgPreviewLink.style.display = 'none' ; + else + { + UpdateImage( eImgPreview, true ) ; + + if ( GetE('txtLnkUrl').value.trim().length > 0 ) + eImgPreviewLink.href = 'javascript:void(null);' ; + else + SetAttribute( eImgPreviewLink, 'href', '' ) ; + + eImgPreviewLink.style.display = '' ; + } +} + +var bLockRatio = true ; + +function SwitchLock( lockButton ) +{ + bLockRatio = !bLockRatio ; + lockButton.className = bLockRatio ? 'BtnLocked' : 'BtnUnlocked' ; + lockButton.title = bLockRatio ? 'Lock sizes' : 'Unlock sizes' ; + + if ( bLockRatio ) + { + if ( GetE('txtWidth').value.length > 0 ) + OnSizeChanged( 'Width', GetE('txtWidth').value ) ; + else + OnSizeChanged( 'Height', GetE('txtHeight').value ) ; + } +} + +// Fired when the width or height input texts change +function OnSizeChanged( dimension, value ) +{ + // Verifies if the aspect ration has to be mantained + if ( oImageOriginal && bLockRatio ) + { + var e = dimension == 'Width' ? GetE('txtHeight') : GetE('txtWidth') ; + + if ( value.length == 0 || isNaN( value ) ) + { + e.value = '' ; + return ; + } + + if ( dimension == 'Width' ) + value = value == 0 ? 0 : Math.round( oImageOriginal.height * ( value / oImageOriginal.width ) ) ; + else + value = value == 0 ? 0 : Math.round( oImageOriginal.width * ( value / oImageOriginal.height ) ) ; + + if ( !isNaN( value ) ) + e.value = value ; + } + + UpdatePreview() ; +} + +// Fired when the Reset Size button is clicked +function ResetSizes() +{ + if ( ! oImageOriginal ) return ; + + GetE('txtWidth').value = oImageOriginal.width ; + GetE('txtHeight').value = oImageOriginal.height ; + + UpdatePreview() ; +} + +function BrowseServer() +{ + OpenServerBrowser( + 'Image', + FCKConfig.ImageBrowserURL, + FCKConfig.ImageBrowserWindowWidth, + FCKConfig.ImageBrowserWindowHeight ) ; +} + +function LnkBrowseServer() +{ + OpenServerBrowser( + 'Link', + FCKConfig.LinkBrowserURL, + FCKConfig.LinkBrowserWindowWidth, + FCKConfig.LinkBrowserWindowHeight ) ; +} + +function OpenServerBrowser( type, url, width, height ) +{ + sActualBrowser = type ; + OpenFileBrowser( url, width, height ) ; +} + +var sActualBrowser ; + +function SetUrl( url, width, height, alt ) +{ + if ( sActualBrowser == 'Link' ) + { + GetE('txtLnkUrl').value = url ; + UpdatePreview() ; + } + else + { + GetE('txtUrl').value = url ; + GetE('txtWidth').value = width ? width : '' ; + GetE('txtHeight').value = height ? height : '' ; + + if ( alt ) + GetE('txtAlt').value = alt; + + UpdatePreview() ; + UpdateOriginal( true ) ; + } + + window.parent.SetSelectedTab( 'Info' ) ; +} + +function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) +{ + switch ( errorNumber ) + { + case 0 : // No errors + alert( 'Your file has been successfully uploaded' ) ; + break ; + case 1 : // Custom error + alert( customMsg ) ; + return ; + case 101 : // Custom warning + alert( customMsg ) ; + break ; + case 201 : + alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; + break ; + case 202 : + alert( 'Invalid file type' ) ; + return ; + case 203 : + alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; + return ; + default : + alert( 'Error on file upload. Error number: ' + errorNumber ) ; + return ; + } + + sActualBrowser = '' + SetUrl( fileUrl ) ; + GetE('frmUpload').reset() ; +} + +var oUploadAllowedExtRegex = new RegExp( FCKConfig.ImageUploadAllowedExtensions, 'i' ) ; +var oUploadDeniedExtRegex = new RegExp( FCKConfig.ImageUploadDeniedExtensions, 'i' ) ; + +function CheckUpload() +{ + var sFile = GetE('txtUploadFile').value ; + + if ( sFile.length == 0 ) + { + alert( 'Please select a file to upload' ) ; + return false ; + } + + if ( ( FCKConfig.ImageUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) || + ( FCKConfig.ImageUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) ) + { + OnUploadCompleted( 202 ) ; + return false ; + } + + return true ; +} \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_image/fck_image_preview.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_image/fck_image_preview.html new file mode 100644 index 00000000..d63cf508 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_image/fck_image_preview.html @@ -0,0 +1,61 @@ + + + + + + + + + + + + Lorem + ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas feugiat consequat + diam. Maecenas metus. Vivamus diam purus, cursus a, commodo non, facilisis + vitae, nulla. Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis + aliquam, orci felis euismod neque, sed ornare massa mauris sed velit. Nulla + pretium mi et risus. Fusce mi pede, tempor id, cursus ac, ullamcorper nec, + enim. Sed tortor. Curabitur molestie. Duis velit augue, condimentum at, + ultrices a, luctus ut, orci. Donec pellentesque egestas eros. Integer cursus, + augue in cursus faucibus, eros pede bibendum sem, in tempus tellus justo quis + ligula. Etiam eget tortor. Vestibulum rutrum, est ut placerat elementum, lectus + nisl aliquam velit, tempor aliquam eros nunc nonummy metus. In eros metus, + gravida a, gravida sed, lobortis id, turpis. Ut ultrices, ipsum at venenatis + fringilla, sem nulla lacinia tellus, eget aliquet turpis mauris non enim. Nam + turpis. Suspendisse lacinia. Curabitur ac tortor ut ipsum egestas elementum. + Nunc imperdiet gravida mauris. + + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_link.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_link.html new file mode 100644 index 00000000..33a56b63 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_link.html @@ -0,0 +1,289 @@ + + + + + Link Properties + + + + + + + + + + + + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_link/fck_link.js b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_link/fck_link.js new file mode 100644 index 00000000..f17e4b37 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_link/fck_link.js @@ -0,0 +1,588 @@ +/* + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2005 Frederico Caldeira Knabben + * + * Licensed under the terms of the GNU Lesser General Public License: + * http://www.opensource.org/licenses/lgpl-license.php + * + * For further information visit: + * http://www.fckeditor.net/ + * + * "Support Open Source software. What about a donation today?" + * + * File Name: fck_link.js + * Scripts related to the Link dialog window (see fck_link.html). + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +var oEditor = window.parent.InnerDialogLoaded() ; +var FCK = oEditor.FCK ; +var FCKLang = oEditor.FCKLang ; +var FCKConfig = oEditor.FCKConfig ; + +//#### Dialog Tabs + +// Set the dialog tabs. +window.parent.AddTab( 'Info', FCKLang.DlgLnkInfoTab ) ; + +if ( !FCKConfig.LinkDlgHideTarget ) + window.parent.AddTab( 'Target', FCKLang.DlgLnkTargetTab, true ) ; + +if ( FCKConfig.LinkUpload ) + window.parent.AddTab( 'Upload', FCKLang.DlgLnkUpload, true ) ; + +if ( !FCKConfig.LinkDlgHideAdvanced ) + window.parent.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ; + +// Function called when a dialog tag is selected. +function OnDialogTabChange( tabCode ) +{ + ShowE('divInfo' , ( tabCode == 'Info' ) ) ; + ShowE('divTarget' , ( tabCode == 'Target' ) ) ; + ShowE('divUpload' , ( tabCode == 'Upload' ) ) ; + ShowE('divAttribs' , ( tabCode == 'Advanced' ) ) ; +} + +//#### Regular Expressions library. +var oRegex = new Object() ; + +oRegex.UriProtocol = new RegExp('') ; +oRegex.UriProtocol.compile( '^(((http|https|ftp|news):\/\/)|mailto:)', 'gi' ) ; + +oRegex.UrlOnChangeProtocol = new RegExp('') ; +oRegex.UrlOnChangeProtocol.compile( '^(http|https|ftp|news)://(?=.)', 'gi' ) ; + +oRegex.UrlOnChangeTestOther = new RegExp('') ; +//oRegex.UrlOnChangeTestOther.compile( '^(javascript:|#|/)', 'gi' ) ; +oRegex.UrlOnChangeTestOther.compile( '^((javascript:)|[#/\.])', 'gi' ) ; + +oRegex.ReserveTarget = new RegExp('') ; +oRegex.ReserveTarget.compile( '^_(blank|self|top|parent)$', 'i' ) ; + +oRegex.PopupUri = new RegExp('') ; +oRegex.PopupUri.compile( "^javascript:void\\(\\s*window.open\\(\\s*'([^']+)'\\s*,\\s*(?:'([^']*)'|null)\\s*,\\s*'([^']*)'\\s*\\)\\s*\\)\\s*$" ) ; + +oRegex.PopupFeatures = new RegExp('') ; +oRegex.PopupFeatures.compile( '(?:^|,)([^=]+)=(\\d+|yes|no)', 'gi' ) ; + +//#### Parser Functions + +var oParser = new Object() ; + +oParser.ParseEMailUrl = function( emailUrl ) +{ + // Initializes the EMailInfo object. + var oEMailInfo = new Object() ; + oEMailInfo.Address = '' ; + oEMailInfo.Subject = '' ; + oEMailInfo.Body = '' ; + + var oParts = emailUrl.match( /^([^\?]+)\??(.+)?/ ) ; + if ( oParts ) + { + // Set the e-mail address. + oEMailInfo.Address = oParts[1] ; + + // Look for the optional e-mail parameters. + if ( oParts[2] ) + { + var oMatch = oParts[2].match( /(^|&)subject=([^&]+)/i ) ; + if ( oMatch ) oEMailInfo.Subject = unescape( oMatch[2] ) ; + + oMatch = oParts[2].match( /(^|&)body=([^&]+)/i ) ; + if ( oMatch ) oEMailInfo.Body = unescape( oMatch[2] ) ; + } + } + + return oEMailInfo ; +} + +oParser.CreateEMailUri = function( address, subject, body ) +{ + var sBaseUri = 'mailto:' + address ; + + var sParams = '' ; + + if ( subject.length > 0 ) + sParams = '?subject=' + escape( subject ) ; + + if ( body.length > 0 ) + { + sParams += ( sParams.length == 0 ? '?' : '&' ) ; + sParams += 'body=' + escape( body ) ; + } + + return sBaseUri + sParams ; +} + +//#### Initialization Code + +// oLink: The actual selected link in the editor. +var oLink = FCK.Selection.MoveToAncestorNode( 'A' ) ; +if ( oLink ) + FCK.Selection.SelectNode( oLink ) ; + +window.onload = function() +{ + // Translate the dialog box texts. + oEditor.FCKLanguageManager.TranslatePage(document) ; + + // Fill the Anchor Names and Ids combos. + LoadAnchorNamesAndIds() ; + + // Load the selected link information (if any). + LoadSelection() ; + + // Update the dialog box. + SetLinkType( GetE('cmbLinkType').value ) ; + + // Show/Hide the "Browse Server" button. + GetE('divBrowseServer').style.display = FCKConfig.LinkBrowser ? '' : 'none' ; + + // Show the initial dialog content. + GetE('divInfo').style.display = '' ; + + // Set the actual uploader URL. + if ( FCKConfig.LinkUpload ) + GetE('frmUpload').action = FCKConfig.LinkUploadURL ; + + // Activate the "OK" button. + window.parent.SetOkButton( true ) ; +} + +var bHasAnchors ; + +function LoadAnchorNamesAndIds() +{ + // Since version 2.0, the anchors are replaced in the DOM by IMGs so the user see the icon + // to edit them. So, we must look for that images now. + var aAnchors = new Array() ; + + var oImages = oEditor.FCK.EditorDocument.getElementsByTagName( 'IMG' ) ; + for( var i = 0 ; i < oImages.length ; i++ ) + { + if ( oImages[i].getAttribute('_fckanchor') ) + aAnchors[ aAnchors.length ] = oEditor.FCK.GetRealElement( oImages[i] ) ; + } + + var aIds = oEditor.FCKTools.GetAllChildrenIds( oEditor.FCK.EditorDocument.body ) ; + + bHasAnchors = ( aAnchors.length > 0 || aIds.length > 0 ) ; + + for ( var i = 0 ; i < aAnchors.length ; i++ ) + { + var sName = aAnchors[i].name ; + if ( sName && sName.length > 0 ) + oEditor.FCKTools.AddSelectOption( document, GetE('cmbAnchorName'), sName, sName ) ; + } + + for ( var i = 0 ; i < aIds.length ; i++ ) + { + oEditor.FCKTools.AddSelectOption( document, GetE('cmbAnchorId'), aIds[i], aIds[i] ) ; + } + + ShowE( 'divSelAnchor' , bHasAnchors ) ; + ShowE( 'divNoAnchor' , !bHasAnchors ) ; +} + +function LoadSelection() +{ + if ( !oLink ) return ; + + var sType = 'url' ; + + // Get the actual Link href. + var sHRef = oLink.getAttribute( '_fcksavedurl' ) ; + if ( !sHRef || sHRef.length == 0 ) + sHRef = oLink.getAttribute( 'href' , 2 ) + '' ; + + // TODO: Wait stable version and remove the following commented lines. +// if ( sHRef.startsWith( FCK.BaseUrl ) ) +// sHRef = sHRef.remove( 0, FCK.BaseUrl.length ) ; + + // Look for a popup javascript link. + var oPopupMatch = oRegex.PopupUri.exec( sHRef ) ; + if( oPopupMatch ) + { + GetE('cmbTarget').value = 'popup' ; + sHRef = oPopupMatch[1] ; + FillPopupFields( oPopupMatch[2], oPopupMatch[3] ) ; + SetTarget( 'popup' ) ; + } + + // Search for the protocol. + var sProtocol = oRegex.UriProtocol.exec( sHRef ) ; + + if ( sProtocol ) + { + sProtocol = sProtocol[0].toLowerCase() ; + GetE('cmbLinkProtocol').value = sProtocol ; + + // Remove the protocol and get the remainig URL. + var sUrl = sHRef.replace( oRegex.UriProtocol, '' ) ; + + if ( sProtocol == 'mailto:' ) // It is an e-mail link. + { + sType = 'email' ; + + var oEMailInfo = oParser.ParseEMailUrl( sUrl ) ; + GetE('txtEMailAddress').value = oEMailInfo.Address ; + GetE('txtEMailSubject').value = oEMailInfo.Subject ; + GetE('txtEMailBody').value = oEMailInfo.Body ; + } + else // It is a normal link. + { + sType = 'url' ; + GetE('txtUrl').value = sUrl ; + } + } + else if ( sHRef.substr(0,1) == '#' && sHRef.length > 1 ) // It is an anchor link. + { + sType = 'anchor' ; + GetE('cmbAnchorName').value = GetE('cmbAnchorId').value = sHRef.substr(1) ; + } + else // It is another type of link. + { + sType = 'url' ; + + GetE('cmbLinkProtocol').value = '' ; + GetE('txtUrl').value = sHRef ; + } + + if ( !oPopupMatch ) + { + // Get the target. + var sTarget = oLink.target ; + + if ( sTarget && sTarget.length > 0 ) + { + if ( oRegex.ReserveTarget.test( sTarget ) ) + { + sTarget = sTarget.toLowerCase() ; + GetE('cmbTarget').value = sTarget ; + } + else + GetE('cmbTarget').value = 'frame' ; + GetE('txtTargetFrame').value = sTarget ; + } + } + + // Get Advances Attributes + GetE('txtAttId').value = oLink.id ; + GetE('txtAttName').value = oLink.name ; + GetE('cmbAttLangDir').value = oLink.dir ; + GetE('txtAttLangCode').value = oLink.lang ; + GetE('txtAttAccessKey').value = oLink.accessKey ; + GetE('txtAttTabIndex').value = oLink.tabIndex <= 0 ? '' : oLink.tabIndex ; + GetE('txtAttTitle').value = oLink.title ; + GetE('txtAttContentType').value = oLink.type ; + GetE('txtAttCharSet').value = oLink.charset ; + + if ( oEditor.FCKBrowserInfo.IsIE ) + { + GetE('txtAttClasses').value = oLink.getAttribute('className',2) || '' ; + GetE('txtAttStyle').value = oLink.style.cssText ; + } + else + { + GetE('txtAttClasses').value = oLink.getAttribute('class',2) || '' ; + GetE('txtAttStyle').value = oLink.getAttribute('style',2) ; + } + + // Update the Link type combo. + GetE('cmbLinkType').value = sType ; +} + +//#### Link type selection. +function SetLinkType( linkType ) +{ + ShowE('divLinkTypeUrl' , (linkType == 'url') ) ; + ShowE('divLinkTypeAnchor' , (linkType == 'anchor') ) ; + ShowE('divLinkTypeEMail' , (linkType == 'email') ) ; + + if ( !FCKConfig.LinkDlgHideTarget ) + window.parent.SetTabVisibility( 'Target' , (linkType == 'url') ) ; + + if ( FCKConfig.LinkUpload ) + window.parent.SetTabVisibility( 'Upload' , (linkType == 'url') ) ; + + if ( !FCKConfig.LinkDlgHideAdvanced ) + window.parent.SetTabVisibility( 'Advanced' , (linkType != 'anchor' || bHasAnchors) ) ; + + if ( linkType == 'email' ) + window.parent.SetAutoSize( true ) ; +} + +//#### Target type selection. +function SetTarget( targetType ) +{ + GetE('tdTargetFrame').style.display = ( targetType == 'popup' ? 'none' : '' ) ; + GetE('tdPopupName').style.display = + GetE('tablePopupFeatures').style.display = ( targetType == 'popup' ? '' : 'none' ) ; + + switch ( targetType ) + { + case "_blank" : + case "_self" : + case "_parent" : + case "_top" : + GetE('txtTargetFrame').value = targetType ; + break ; + case "" : + GetE('txtTargetFrame').value = '' ; + break ; + } + + if ( targetType == 'popup' ) + window.parent.SetAutoSize( true ) ; +} + +//#### Called while the user types the URL. +function OnUrlChange() +{ + var sUrl = GetE('txtUrl').value ; + var sProtocol = oRegex.UrlOnChangeProtocol.exec( sUrl ) ; + + if ( sProtocol ) + { + sUrl = sUrl.substr( sProtocol[0].length ) ; + GetE('txtUrl').value = sUrl ; + GetE('cmbLinkProtocol').value = sProtocol[0].toLowerCase() ; + } + else if ( oRegex.UrlOnChangeTestOther.test( sUrl ) ) + { + GetE('cmbLinkProtocol').value = '' ; + } +} + +//#### Called while the user types the target name. +function OnTargetNameChange() +{ + var sFrame = GetE('txtTargetFrame').value ; + + if ( sFrame.length == 0 ) + GetE('cmbTarget').value = '' ; + else if ( oRegex.ReserveTarget.test( sFrame ) ) + GetE('cmbTarget').value = sFrame.toLowerCase() ; + else + GetE('cmbTarget').value = 'frame' ; +} + +//#### Builds the javascript URI to open a popup to the specified URI. +function BuildPopupUri( uri ) +{ + var oReg = new RegExp( "'", "g" ) ; + var sWindowName = "'" + GetE('txtPopupName').value.replace(oReg, "\\'") + "'" ; + + var sFeatures = '' ; + var aChkFeatures = document.getElementsByName('chkFeature') ; + for ( var i = 0 ; i < aChkFeatures.length ; i++ ) + { + if ( i > 0 ) sFeatures += ',' ; + sFeatures += aChkFeatures[i].value + '=' + ( aChkFeatures[i].checked ? 'yes' : 'no' ) ; + } + + if ( GetE('txtPopupWidth').value.length > 0 ) sFeatures += ',width=' + GetE('txtPopupWidth').value ; + if ( GetE('txtPopupHeight').value.length > 0 ) sFeatures += ',height=' + GetE('txtPopupHeight').value ; + if ( GetE('txtPopupLeft').value.length > 0 ) sFeatures += ',left=' + GetE('txtPopupLeft').value ; + if ( GetE('txtPopupTop').value.length > 0 ) sFeatures += ',top=' + GetE('txtPopupTop').value ; + + return ( "javascript:void(window.open('" + uri + "'," + sWindowName + ",'" + sFeatures + "'))" ) ; +} + +//#### Fills all Popup related fields. +function FillPopupFields( windowName, features ) +{ + if ( windowName ) + GetE('txtPopupName').value = windowName ; + + var oFeatures = new Object() ; + var oFeaturesMatch ; + while( ( oFeaturesMatch = oRegex.PopupFeatures.exec( features ) ) != null ) + { + var sValue = oFeaturesMatch[2] ; + if ( sValue == ( 'yes' || '1' ) ) + oFeatures[ oFeaturesMatch[1] ] = true ; + else if ( ! isNaN( sValue ) && sValue != 0 ) + oFeatures[ oFeaturesMatch[1] ] = sValue ; + } + + // Update all features check boxes. + var aChkFeatures = document.getElementsByName('chkFeature') ; + for ( var i = 0 ; i < aChkFeatures.length ; i++ ) + { + if ( oFeatures[ aChkFeatures[i].value ] ) + aChkFeatures[i].checked = true ; + } + + // Update position and size text boxes. + if ( oFeatures['width'] ) GetE('txtPopupWidth').value = oFeatures['width'] ; + if ( oFeatures['height'] ) GetE('txtPopupHeight').value = oFeatures['height'] ; + if ( oFeatures['left'] ) GetE('txtPopupLeft').value = oFeatures['left'] ; + if ( oFeatures['top'] ) GetE('txtPopupTop').value = oFeatures['top'] ; +} + +//#### The OK button was hit. +function Ok() +{ + var sUri ; + + switch ( GetE('cmbLinkType').value ) + { + case 'url' : + sUri = GetE('txtUrl').value ; + + if ( sUri.length == 0 ) + { + alert( FCKLang.DlnLnkMsgNoUrl ) ; + return false ; + } + + sUri = GetE('cmbLinkProtocol').value + sUri ; + + if( GetE('cmbTarget').value == 'popup' ) + sUri = BuildPopupUri( sUri ) ; + + break ; + + case 'email' : + sUri = GetE('txtEMailAddress').value ; + + if ( sUri.length == 0 ) + { + alert( FCKLang.DlnLnkMsgNoEMail ) ; + return false ; + } + + sUri = oParser.CreateEMailUri( + sUri, + GetE('txtEMailSubject').value, + GetE('txtEMailBody').value ) ; + break ; + + case 'anchor' : + var sAnchor = GetE('cmbAnchorName').value ; + if ( sAnchor.length == 0 ) sAnchor = GetE('cmbAnchorId').value ; + + if ( sAnchor.length == 0 ) + { + alert( FCKLang.DlnLnkMsgNoAnchor ) ; + return false ; + } + + sUri = '#' + sAnchor ; + break ; + } + + if ( oLink ) // Modifying an existent link. + { + oEditor.FCKUndo.SaveUndoStep() ; + oLink.href = sUri ; + } + else // Creating a new link. + { + oLink = oEditor.FCK.CreateLink( sUri ) ; + if ( ! oLink ) + return true ; + } + + SetAttribute( oLink, '_fcksavedurl', sUri ) ; + + // Target + if( GetE('cmbTarget').value != 'popup' ) + SetAttribute( oLink, 'target', GetE('txtTargetFrame').value ) ; + else + SetAttribute( oLink, 'target', null ) ; + + // Advances Attributes + SetAttribute( oLink, 'id' , GetE('txtAttId').value ) ; + SetAttribute( oLink, 'name' , GetE('txtAttName').value ) ; // No IE. Set but doesnt't update the outerHTML. + SetAttribute( oLink, 'dir' , GetE('cmbAttLangDir').value ) ; + SetAttribute( oLink, 'lang' , GetE('txtAttLangCode').value ) ; + SetAttribute( oLink, 'accesskey', GetE('txtAttAccessKey').value ) ; + SetAttribute( oLink, 'tabindex' , ( GetE('txtAttTabIndex').value > 0 ? GetE('txtAttTabIndex').value : null ) ) ; + SetAttribute( oLink, 'title' , GetE('txtAttTitle').value ) ; + SetAttribute( oLink, 'type' , GetE('txtAttContentType').value ) ; + SetAttribute( oLink, 'charset' , GetE('txtAttCharSet').value ) ; + + if ( oEditor.FCKBrowserInfo.IsIE ) + { + SetAttribute( oLink, 'className', GetE('txtAttClasses').value ) ; + oLink.style.cssText = GetE('txtAttStyle').value ; + } + else + { + SetAttribute( oLink, 'class', GetE('txtAttClasses').value ) ; + SetAttribute( oLink, 'style', GetE('txtAttStyle').value ) ; + } + + return true ; +} + +function BrowseServer() +{ + OpenFileBrowser( FCKConfig.LinkBrowserURL, FCKConfig.LinkBrowserWindowWidth, FCKConfig.LinkBrowserWindowHeight ) ; +} + +function SetUrl( url ) +{ + document.getElementById('txtUrl').value = url ; + OnUrlChange() ; + window.parent.SetSelectedTab( 'Info' ) ; +} + +function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) +{ + switch ( errorNumber ) + { + case 0 : // No errors + alert( 'Your file has been successfully uploaded' ) ; + break ; + case 1 : // Custom error + alert( customMsg ) ; + return ; + case 101 : // Custom warning + alert( customMsg ) ; + break ; + case 201 : + alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; + break ; + case 202 : + alert( 'Invalid file type' ) ; + return ; + case 203 : + alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; + return ; + default : + alert( 'Error on file upload. Error number: ' + errorNumber ) ; + return ; + } + + SetUrl( fileUrl ) ; + GetE('frmUpload').reset() ; +} + +var oUploadAllowedExtRegex = new RegExp( FCKConfig.LinkUploadAllowedExtensions, 'i' ) ; +var oUploadDeniedExtRegex = new RegExp( FCKConfig.LinkUploadDeniedExtensions, 'i' ) ; + +function CheckUpload() +{ + var sFile = GetE('txtUploadFile').value ; + + if ( sFile.length == 0 ) + { + alert( 'Please select a file to upload' ) ; + return false ; + } + + if ( ( FCKConfig.LinkUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) || + ( FCKConfig.LinkUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) ) + { + OnUploadCompleted( 202 ) ; + return false ; + } + + return true ; +} \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_listprop.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_listprop.html new file mode 100644 index 00000000..b79f2f14 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_listprop.html @@ -0,0 +1,101 @@ + + + + + Bulleted List Properties + + + + + + + + + + +
+ + + + +
+ List Type
+ + +   +
+
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_paste.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_paste.html new file mode 100644 index 00000000..1f1dc4e2 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_paste.html @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + +
+ Please paste inside the following box using the + keyboard (Ctrl+V) and hit OK. +
+   +
+ + +
+ + + + + +
+ +
+ +
+ +
+
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_radiobutton.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_radiobutton.html new file mode 100644 index 00000000..97383f58 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_radiobutton.html @@ -0,0 +1,103 @@ + + + + + Radio Button Properties + + + + + + + + + + +
+ + + + + + + + + + +
+ Name
+ +
+ Value
+ +
+
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_replace.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_replace.html new file mode 100644 index 00000000..fda15a16 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_replace.html @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
  +
+   +
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_select.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_select.html new file mode 100644 index 00000000..b8f40410 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_select.html @@ -0,0 +1,172 @@ + + + + + Select Properties + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
Name 
Value 
Size  lines
+
+
+  Available + Options  + + + + + + + + + + + + + + + + + + +
Text
+ +
Value
+ +
+ + +
+
+ +
   +
+
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_select/fck_select.js b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_select/fck_select.js new file mode 100644 index 00000000..88e67a7d --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_select/fck_select.js @@ -0,0 +1,165 @@ +/* + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2005 Frederico Caldeira Knabben + * + * Licensed under the terms of the GNU Lesser General Public License: + * http://www.opensource.org/licenses/lgpl-license.php + * + * For further information visit: + * http://www.fckeditor.net/ + * + * "Support Open Source software. What about a donation today?" + * + * File Name: fck_select.js + * Scripts for the fck_select.html page. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +function Select( combo ) +{ + var iIndex = combo.selectedIndex ; + + oListText.selectedIndex = iIndex ; + oListValue.selectedIndex = iIndex ; + + var oTxtText = document.getElementById( "txtText" ) ; + var oTxtValue = document.getElementById( "txtValue" ) ; + + oTxtText.value = oListText.value ; + oTxtValue.value = oListValue.value ; +} + +function Add() +{ + var oTxtText = document.getElementById( "txtText" ) ; + var oTxtValue = document.getElementById( "txtValue" ) ; + + AddComboOption( oListText, oTxtText.value, oTxtText.value ) ; + AddComboOption( oListValue, oTxtValue.value, oTxtValue.value ) ; + + oListText.selectedIndex = oListText.options.length - 1 ; + oListValue.selectedIndex = oListValue.options.length - 1 ; + + oTxtText.value = '' ; + oTxtValue.value = '' ; + + oTxtText.focus() ; +} + +function Modify() +{ + var iIndex = oListText.selectedIndex ; + + if ( iIndex < 0 ) return ; + + var oTxtText = document.getElementById( "txtText" ) ; + var oTxtValue = document.getElementById( "txtValue" ) ; + + oListText.options[ iIndex ].innerHTML = oTxtText.value ; + oListText.options[ iIndex ].value = oTxtText.value ; + + oListValue.options[ iIndex ].innerHTML = oTxtValue.value ; + oListValue.options[ iIndex ].value = oTxtValue.value ; + + oTxtText.value = '' ; + oTxtValue.value = '' ; + + oTxtText.focus() ; +} + +function Move( steps ) +{ + ChangeOptionPosition( oListText, steps ) ; + ChangeOptionPosition( oListValue, steps ) ; +} + +function Delete() +{ + RemoveSelectedOptions( oListText ) ; + RemoveSelectedOptions( oListValue ) ; +} + +function SetSelectedValue() +{ + var iIndex = oListValue.selectedIndex ; + if ( iIndex < 0 ) return ; + + var oTxtValue = document.getElementById( "txtSelValue" ) ; + + oTxtValue.value = oListValue.options[ iIndex ].value ; +} + +// Moves the selected option by a number of steps (also negative) +function ChangeOptionPosition( combo, steps ) +{ + var iActualIndex = combo.selectedIndex ; + + if ( iActualIndex < 0 ) + return ; + + var iFinalIndex = iActualIndex + steps ; + + if ( iFinalIndex < 0 ) + iFinalIndex = 0 ; + + if ( iFinalIndex > ( combo.options.lenght - 1 ) ) + iFinalIndex = combo.options.lenght - 1 ; + + if ( iActualIndex == iFinalIndex ) + return ; + + var oOption = combo.options[ iActualIndex ] ; + var sText = oOption.innerHTML ; + var sValue = oOption.value ; + + combo.remove( iActualIndex ) ; + + oOption = AddComboOption( combo, sText, sValue, null, iFinalIndex ) ; + + oOption.selected = true ; +} + +// Remove all selected options from a SELECT object +function RemoveSelectedOptions(combo) +{ + // Save the selected index + var iSelectedIndex = combo.selectedIndex ; + + var oOptions = combo.options ; + + // Remove all selected options + for ( var i = oOptions.length - 1 ; i >= 0 ; i-- ) + { + if (oOptions[i].selected) combo.remove(i) ; + } + + // Reset the selection based on the original selected index + if ( combo.options.length > 0 ) + { + if ( iSelectedIndex >= combo.options.length ) iSelectedIndex = combo.options.length - 1 ; + combo.selectedIndex = iSelectedIndex ; + } +} + +// Add a new option to a SELECT object (combo or list) +function AddComboOption( combo, optionText, optionValue, documentObject, index ) +{ + var oOption ; + + if ( documentObject ) + oOption = documentObject.createElement("OPTION") ; + else + oOption = document.createElement("OPTION") ; + + if ( index != null ) + combo.options.add( oOption, index ) ; + else + combo.options.add( oOption ) ; + + oOption.innerHTML = optionText.length > 0 ? optionText : ' ' ; + oOption.value = optionValue ; + + return oOption ; +} \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_smiley.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_smiley.html new file mode 100644 index 00000000..19737e7c --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_smiley.html @@ -0,0 +1,91 @@ + + + + + + + + + + + + +
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_source.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_source.html new file mode 100644 index 00000000..310ed34a --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_source.html @@ -0,0 +1,61 @@ + + + + + Source + + + + + + + + + + +
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_specialchar.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_specialchar.html new file mode 100644 index 00000000..3839181e --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_specialchar.html @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + +
+ + +
+
     + + + + +
 
+
+ + \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages.html new file mode 100644 index 00000000..526a8ff6 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages.html @@ -0,0 +1,59 @@ + + + + + Spell Check + + + + + + + + + + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/blank.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/blank.html new file mode 100644 index 00000000..e69de29b diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/controlWindow.js b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/controlWindow.js new file mode 100644 index 00000000..6ba8cf03 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/controlWindow.js @@ -0,0 +1,87 @@ +//////////////////////////////////////////////////// +// controlWindow object +//////////////////////////////////////////////////// +function controlWindow( controlForm ) { + // private properties + this._form = controlForm; + + // public properties + this.windowType = "controlWindow"; +// this.noSuggestionSelection = "- No suggestions -"; // by FredCK + this.noSuggestionSelection = FCKLang.DlgSpellNoSuggestions ; + // set up the properties for elements of the given control form + this.suggestionList = this._form.sugg; + this.evaluatedText = this._form.misword; + this.replacementText = this._form.txtsugg; + this.undoButton = this._form.btnUndo; + + // public methods + this.addSuggestion = addSuggestion; + this.clearSuggestions = clearSuggestions; + this.selectDefaultSuggestion = selectDefaultSuggestion; + this.resetForm = resetForm; + this.setSuggestedText = setSuggestedText; + this.enableUndo = enableUndo; + this.disableUndo = disableUndo; +} + +function resetForm() { + if( this._form ) { + this._form.reset(); + } +} + +function setSuggestedText() { + var slct = this.suggestionList; + var txt = this.replacementText; + var str = ""; + if( (slct.options[0].text) && slct.options[0].text != this.noSuggestionSelection ) { + str = slct.options[slct.selectedIndex].text; + } + txt.value = str; +} + +function selectDefaultSuggestion() { + var slct = this.suggestionList; + var txt = this.replacementText; + if( slct.options.length == 0 ) { + this.addSuggestion( this.noSuggestionSelection ); + } else { + slct.options[0].selected = true; + } + this.setSuggestedText(); +} + +function addSuggestion( sugg_text ) { + var slct = this.suggestionList; + if( sugg_text ) { + var i = slct.options.length; + var newOption = new Option( sugg_text, 'sugg_text'+i ); + slct.options[i] = newOption; + } +} + +function clearSuggestions() { + var slct = this.suggestionList; + for( var j = slct.length - 1; j > -1; j-- ) { + if( slct.options[j] ) { + slct.options[j] = null; + } + } +} + +function enableUndo() { + if( this.undoButton ) { + if( this.undoButton.disabled == true ) { + this.undoButton.disabled = false; + } + } +} + +function disableUndo() { + if( this.undoButton ) { + if( this.undoButton.disabled == false ) { + this.undoButton.disabled = true; + } + } +} diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/controls.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/controls.html new file mode 100644 index 00000000..42d70414 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/controls.html @@ -0,0 +1,153 @@ + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
Not in dictionary:
Change to:
+ + + + + + + +
+ +
+ +
+
   + + + + + + + + + + + + + + + + + + + + + + +
+ +    + +
+ +    + +
+ +    + +
+
+
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.cfm b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.cfm new file mode 100644 index 00000000..9564ed62 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.cfm @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php new file mode 100644 index 00000000..340ba9be --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php @@ -0,0 +1,193 @@ +$val ) { + # $val = str_replace( "'", "%27", $val ); + echo "textinputs[$key] = decodeURIComponent(\"" . $val . "\");\n"; + } +} + +# make declarations for the text input index +function print_textindex_decl( $text_input_idx ) { + echo "words[$text_input_idx] = [];\n"; + echo "suggs[$text_input_idx] = [];\n"; +} + +# set an element of the JavaScript 'words' array to a misspelled word +function print_words_elem( $word, $index, $text_input_idx ) { + echo "words[$text_input_idx][$index] = '" . escape_quote( $word ) . "';\n"; +} + + +# set an element of the JavaScript 'suggs' array to a list of suggestions +function print_suggs_elem( $suggs, $index, $text_input_idx ) { + echo "suggs[$text_input_idx][$index] = ["; + foreach( $suggs as $key=>$val ) { + if( $val ) { + echo "'" . escape_quote( $val ) . "'"; + if ( $key+1 < count( $suggs )) { + echo ", "; + } + } + } + echo "];\n"; +} + +# escape single quote +function escape_quote( $str ) { + return preg_replace ( "/'/", "\\'", $str ); +} + + +# handle a server-side error. +function error_handler( $err ) { + echo "error = '" . escape_quote( $err ) . "';\n"; +} + +## get the list of misspelled words. Put the results in the javascript words array +## for each misspelled word, get suggestions and put in the javascript suggs array +function print_checker_results() { + + global $aspell_prog; + global $aspell_opts; + global $tempfiledir; + global $textinputs; + global $input_separator; + $aspell_err = ""; + # create temp file + $tempfile = tempnam( $tempfiledir, 'aspell_data_' ); + + # open temp file, add the submitted text. + if( $fh = fopen( $tempfile, 'w' )) { + for( $i = 0; $i < count( $textinputs ); $i++ ) { + $text = urldecode( $textinputs[$i] ); + $lines = explode( "\n", $text ); + fwrite ( $fh, "%\n" ); # exit terse mode + fwrite ( $fh, "^$input_separator\n" ); + fwrite ( $fh, "!\n" ); # enter terse mode + foreach( $lines as $key=>$value ) { + # use carat on each line to escape possible aspell commands + fwrite( $fh, "^$value\n" ); + } + } + fclose( $fh ); + + # exec aspell command - redirect STDERR to STDOUT + $cmd = "$aspell_prog $aspell_opts < $tempfile 2>&1"; + if( $aspellret = shell_exec( $cmd )) { + $linesout = explode( "\n", $aspellret ); + $index = 0; + $text_input_index = -1; + # parse each line of aspell return + foreach( $linesout as $key=>$val ) { + $chardesc = substr( $val, 0, 1 ); + # if '&', then not in dictionary but has suggestions + # if '#', then not in dictionary and no suggestions + # if '*', then it is a delimiter between text inputs + # if '@' then version info + if( $chardesc == '&' || $chardesc == '#' ) { + $line = explode( " ", $val, 5 ); + print_words_elem( $line[1], $index, $text_input_index ); + if( isset( $line[4] )) { + $suggs = explode( ", ", $line[4] ); + } else { + $suggs = array(); + } + print_suggs_elem( $suggs, $index, $text_input_index ); + $index++; + } elseif( $chardesc == '*' ) { + $text_input_index++; + print_textindex_decl( $text_input_index ); + $index = 0; + } elseif( $chardesc != '@' && $chardesc != "" ) { + # assume this is error output + $aspell_err .= $val; + } + } + if( $aspell_err ) { + $aspell_err = "Error executing `$cmd`\\n$aspell_err"; + error_handler( $aspell_err ); + } + } else { + error_handler( "System error: Aspell program execution failed (`$cmd`)" ); + } + } else { + error_handler( "System error: Could not open file '$tempfile' for writing" ); + } + + # close temp file, delete file + unlink( $tempfile ); +} + + +?> + + + + + + + + + + + + + + + + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.pl b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.pl new file mode 100644 index 00000000..cf712005 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.pl @@ -0,0 +1,180 @@ +#!/usr/bin/perl + +use CGI qw/ :standard /; +use File::Temp qw/ tempfile tempdir /; + +# my $spellercss = '/speller/spellerStyle.css'; # by FredCK +my $spellercss = '../spellerStyle.css'; # by FredCK +# my $wordWindowSrc = '/speller/wordWindow.js'; # by FredCK +my $wordWindowSrc = '../wordWindow.js'; # by FredCK +my @textinputs = param( 'textinputs[]' ); # array +# my $aspell_cmd = 'aspell'; # by FredCK (for Linux) +my $aspell_cmd = '"C:\Program Files\Aspell\bin\aspell.exe"'; # by FredCK (for Windows) +my $lang = 'en_US'; +# my $aspell_opts = "-a --lang=$lang --encoding=utf-8"; # by FredCK +my $aspell_opts = "-a --lang=$lang --encoding=utf-8 -H"; # by FredCK +my $input_separator = "A"; + +# set the 'wordtext' JavaScript variable to the submitted text. +sub printTextVar { + for( my $i = 0; $i <= $#textinputs; $i++ ) { + print "textinputs[$i] = decodeURIComponent('" . escapeQuote( $textinputs[$i] ) . "')\n"; + } +} + +sub printTextIdxDecl { + my $idx = shift; + print "words[$idx] = [];\n"; + print "suggs[$idx] = [];\n"; +} + +sub printWordsElem { + my( $textIdx, $wordIdx, $word ) = @_; + print "words[$textIdx][$wordIdx] = '" . escapeQuote( $word ) . "';\n"; +} + +sub printSuggsElem { + my( $textIdx, $wordIdx, @suggs ) = @_; + print "suggs[$textIdx][$wordIdx] = ["; + for my $i ( 0..$#suggs ) { + print "'" . escapeQuote( $suggs[$i] ) . "'"; + if( $i < $#suggs ) { + print ", "; + } + } + print "];\n"; +} + +sub printCheckerResults { + my $textInputIdx = -1; + my $wordIdx = 0; + my $unhandledText; + # create temp file + my $dir = tempdir( CLEANUP => 1 ); + my( $fh, $tmpfilename ) = tempfile( DIR => $dir ); + + # temp file was created properly? + + # open temp file, add the submitted text. + for( my $i = 0; $i <= $#textinputs; $i++ ) { + $text = url_decode( $textinputs[$i] ); + @lines = split( /\n/, $text ); + print $fh "\%\n"; # exit terse mode + print $fh "^$input_separator\n"; + print $fh "!\n"; # enter terse mode + for my $line ( @lines ) { + # use carat on each line to escape possible aspell commands + print $fh "^$line\n"; + } + + } + # exec aspell command + my $cmd = "$aspell_cmd $aspell_opts < $tmpfilename 2>&1"; + open ASPELL, "$cmd |" or handleError( "Could not execute `$cmd`\\n$!" ) and return; + # parse each line of aspell return + for my $ret ( ) { + chomp( $ret ); + # if '&', then not in dictionary but has suggestions + # if '#', then not in dictionary and no suggestions + # if '*', then it is a delimiter between text inputs + if( $ret =~ /^\*/ ) { + $textInputIdx++; + printTextIdxDecl( $textInputIdx ); + $wordIdx = 0; + + } elsif( $ret =~ /^(&|#)/ ) { + my @tokens = split( " ", $ret, 5 ); + printWordsElem( $textInputIdx, $wordIdx, $tokens[1] ); + my @suggs = (); + if( $tokens[4] ) { + @suggs = split( ", ", $tokens[4] ); + } + printSuggsElem( $textInputIdx, $wordIdx, @suggs ); + $wordIdx++; + } else { + $unhandledText .= $ret; + } + } + close ASPELL or handleError( "Error executing `$cmd`\\n$unhandledText" ) and return; +} + +sub escapeQuote { + my $str = shift; + $str =~ s/'/\\'/g; + return $str; +} + +sub handleError { + my $err = shift; + print "error = '" . escapeQuote( $err ) . "';\n"; +} + +sub url_decode { + local $_ = @_ ? shift : $_; + defined or return; + # change + signs to spaces + tr/+/ /; + # change hex escapes to the proper characters + s/%([a-fA-F0-9]{2})/pack "H2", $1/eg; + return $_; +} + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# Display HTML +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + +print < + + + + + + + + + + + + + +EOF + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellChecker.js b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellChecker.js new file mode 100644 index 00000000..11c8d95d --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellChecker.js @@ -0,0 +1,458 @@ +//////////////////////////////////////////////////// +// spellChecker.js +// +// spellChecker object +// +// This file is sourced on web pages that have a textarea object to evaluate +// for spelling. It includes the implementation for the spellCheckObject. +// +//////////////////////////////////////////////////// + + +// constructor +function spellChecker( textObject ) { + + // public properties - configurable +// this.popUpUrl = '/speller/spellchecker.html'; // by FredCK + this.popUpUrl = 'fck_spellerpages/spellerpages/spellchecker.html'; // by FredCK + this.popUpName = 'spellchecker'; +// this.popUpProps = "menu=no,width=440,height=350,top=70,left=120,resizable=yes,status=yes"; // by FredCK + this.popUpProps = null ; // by FredCK +// this.spellCheckScript = '/speller/server-scripts/spellchecker.php'; // by FredCK + this.spellCheckScript = 'server-scripts/spellchecker.php'; // by FredCK + //this.spellCheckScript = '/cgi-bin/spellchecker.pl'; + + // values used to keep track of what happened to a word + this.replWordFlag = "R"; // single replace + this.ignrWordFlag = "I"; // single ignore + this.replAllFlag = "RA"; // replace all occurances + this.ignrAllFlag = "IA"; // ignore all occurances + this.fromReplAll = "~RA"; // an occurance of a "replace all" word + this.fromIgnrAll = "~IA"; // an occurance of a "ignore all" word + // properties set at run time + this.wordFlags = new Array(); + this.currentTextIndex = 0; + this.currentWordIndex = 0; + this.spellCheckerWin = null; + this.controlWin = null; + this.wordWin = null; + this.textArea = textObject; // deprecated + this.textInputs = arguments; + + // private methods + this._spellcheck = _spellcheck; + this._getSuggestions = _getSuggestions; + this._setAsIgnored = _setAsIgnored; + this._getTotalReplaced = _getTotalReplaced; + this._setWordText = _setWordText; + this._getFormInputs = _getFormInputs; + + // public methods + this.openChecker = openChecker; + this.startCheck = startCheck; + this.checkTextBoxes = checkTextBoxes; + this.checkTextAreas = checkTextAreas; + this.spellCheckAll = spellCheckAll; + this.ignoreWord = ignoreWord; + this.ignoreAll = ignoreAll; + this.replaceWord = replaceWord; + this.replaceAll = replaceAll; + this.terminateSpell = terminateSpell; + this.undo = undo; + + // set the current window's "speller" property to the instance of this class. + // this object can now be referenced by child windows/frames. + window.speller = this; +} + +// call this method to check all text boxes (and only text boxes) in the HTML document +function checkTextBoxes() { + this.textInputs = this._getFormInputs( "^text$" ); + this.openChecker(); +} + +// call this method to check all textareas (and only textareas ) in the HTML document +function checkTextAreas() { + this.textInputs = this._getFormInputs( "^textarea$" ); + this.openChecker(); +} + +// call this method to check all text boxes and textareas in the HTML document +function spellCheckAll() { + this.textInputs = this._getFormInputs( "^text(area)?$" ); + this.openChecker(); +} + +// call this method to check text boxe(s) and/or textarea(s) that were passed in to the +// object's constructor or to the textInputs property +function openChecker() { + this.spellCheckerWin = window.open( this.popUpUrl, this.popUpName, this.popUpProps ); + if( !this.spellCheckerWin.opener ) { + this.spellCheckerWin.opener = window; + } +} + +function startCheck( wordWindowObj, controlWindowObj ) { + + // set properties from args + this.wordWin = wordWindowObj; + this.controlWin = controlWindowObj; + + // reset properties + this.wordWin.resetForm(); + this.controlWin.resetForm(); + this.currentTextIndex = 0; + this.currentWordIndex = 0; + // initialize the flags to an array - one element for each text input + this.wordFlags = new Array( this.wordWin.textInputs.length ); + // each element will be an array that keeps track of each word in the text + for( var i=0; i wi ) || i > ti ) { + // future word: set as "from ignore all" if + // 1) do not already have a flag and + // 2) have the same value as current word + if(( this.wordWin.getTextVal( i, j ) == s_word_to_repl ) + && ( !this.wordFlags[i][j] )) { + this._setAsIgnored( i, j, this.fromIgnrAll ); + } + } + } + } + + // finally, move on + this.currentWordIndex++; + this._spellcheck(); +} + +function replaceWord() { + var wi = this.currentWordIndex; + var ti = this.currentTextIndex; + if( !this.wordWin ) { + alert( 'Error: Word frame not available.' ); + return false; + } + if( !this.wordWin.getTextVal( ti, wi )) { + alert( 'Error: "Not in dictionary" text is missing' ); + return false; + } + if( !this.controlWin.replacementText ) { + return; + } + var txt = this.controlWin.replacementText; + if( txt.value ) { + var newspell = new String( txt.value ); + if( this._setWordText( ti, wi, newspell, this.replWordFlag )) { + this.currentWordIndex++; + this._spellcheck(); + } + } +} + +function replaceAll() { + var ti = this.currentTextIndex; + var wi = this.currentWordIndex; + if( !this.wordWin ) { + alert( 'Error: Word frame not available.' ); + return false; + } + var s_word_to_repl = this.wordWin.getTextVal( ti, wi ); + if( !s_word_to_repl ) { + alert( 'Error: "Not in dictionary" text is missing' ); + return false; + } + var txt = this.controlWin.replacementText; + if( !txt.value ) return; + var newspell = new String( txt.value ); + + // set this word as a "replace all" word. + this._setWordText( ti, wi, newspell, this.replAllFlag ); + + // loop through all the words after this word + for( var i = ti; i < this.wordWin.textInputs.length; i++ ) { + for( var j = 0; j < this.wordWin.totalWords( i ); j++ ) { + if(( i == ti && j > wi ) || i > ti ) { + // future word: set word text to s_word_to_repl if + // 1) do not already have a flag and + // 2) have the same value as s_word_to_repl + if(( this.wordWin.getTextVal( i, j ) == s_word_to_repl ) + && ( !this.wordFlags[i][j] )) { + this._setWordText( i, j, newspell, this.fromReplAll ); + } + } + } + } + + // finally, move on + this.currentWordIndex++; + this._spellcheck(); +} + +function terminateSpell() { + // called when we have reached the end of the spell checking. + var msg = ""; // by FredCK + var numrepl = this._getTotalReplaced(); + if( numrepl == 0 ) { + // see if there were no misspellings to begin with + if( !this.wordWin ) { + msg = ""; + } else { + if( this.wordWin.totalMisspellings() ) { +// msg += "No words changed."; // by FredCK + msg += FCKLang.DlgSpellNoChanges ; // by FredCK + } else { +// msg += "No misspellings found."; // by FredCK + msg += FCKLang.DlgSpellNoMispell ; // by FredCK + } + } + } else if( numrepl == 1 ) { +// msg += "One word changed."; // by FredCK + msg += FCKLang.DlgSpellOneChange ; // by FredCK + } else { +// msg += numrepl + " words changed."; // by FredCK + msg += FCKLang.DlgSpellManyChanges.replace( /%1/g, numrepl ) ; + } + if( msg ) { +// msg += "\n"; // by FredCK + alert( msg ); + } + + if( numrepl > 0 ) { + // update the text field(s) on the opener window + for( var i = 0; i < this.textInputs.length; i++ ) { + // this.textArea.value = this.wordWin.text; + if( this.wordWin ) { + if( this.wordWin.textInputs[i] ) { + this.textInputs[i].value = this.wordWin.textInputs[i]; + } + } + } + } + + // return back to the calling window +// this.spellCheckerWin.close(); // by FredCK + if ( typeof( this.OnFinished ) == 'function' ) // by FredCK + this.OnFinished(numrepl) ; // by FredCK + + return true; +} + +function undo() { + // skip if this is the first word! + var ti = this.currentTextIndex; + var wi = this.currentWordIndex + + if( this.wordWin.totalPreviousWords( ti, wi ) > 0 ) { + this.wordWin.removeFocus( ti, wi ); + + // go back to the last word index that was acted upon + do { + // if the current word index is zero then reset the seed + if( this.currentWordIndex == 0 && this.currentTextIndex > 0 ) { + this.currentTextIndex--; + this.currentWordIndex = this.wordWin.totalWords( this.currentTextIndex )-1; + if( this.currentWordIndex < 0 ) this.currentWordIndex = 0; + } else { + if( this.currentWordIndex > 0 ) { + this.currentWordIndex--; + } + } + } while ( + this.wordWin.totalWords( this.currentTextIndex ) == 0 + || this.wordFlags[this.currentTextIndex][this.currentWordIndex] == this.fromIgnrAll + || this.wordFlags[this.currentTextIndex][this.currentWordIndex] == this.fromReplAll + ); + + var text_idx = this.currentTextIndex; + var idx = this.currentWordIndex; + var preReplSpell = this.wordWin.originalSpellings[text_idx][idx]; + + // if we got back to the first word then set the Undo button back to disabled + if( this.wordWin.totalPreviousWords( text_idx, idx ) == 0 ) { + this.controlWin.disableUndo(); + } + + // examine what happened to this current word. + switch( this.wordFlags[text_idx][idx] ) { + // replace all: go through this and all the future occurances of the word + // and revert them all to the original spelling and clear their flags + case this.replAllFlag : + for( var i = text_idx; i < this.wordWin.textInputs.length; i++ ) { + for( var j = 0; j < this.wordWin.totalWords( i ); j++ ) { + if(( i == text_idx && j >= idx ) || i > text_idx ) { + var origSpell = this.wordWin.originalSpellings[i][j]; + if( origSpell == preReplSpell ) { + this._setWordText ( i, j, origSpell, undefined ); + } + } + } + } + break; + + // ignore all: go through all the future occurances of the word + // and clear their flags + case this.ignrAllFlag : + for( var i = text_idx; i < this.wordWin.textInputs.length; i++ ) { + for( var j = 0; j < this.wordWin.totalWords( i ); j++ ) { + if(( i == text_idx && j >= idx ) || i > text_idx ) { + var origSpell = this.wordWin.originalSpellings[i][j]; + if( origSpell == preReplSpell ) { + this.wordFlags[i][j] = undefined; + } + } + } + } + break; + + // replace: revert the word to its original spelling + case this.replWordFlag : + this._setWordText ( text_idx, idx, preReplSpell, undefined ); + break; + } + + // For all four cases, clear the wordFlag of this word. re-start the process + this.wordFlags[text_idx][idx] = undefined; + this._spellcheck(); + } +} + +function _spellcheck() { + var ww = this.wordWin; + + // check if this is the last word in the current text element + if( this.currentWordIndex == ww.totalWords( this.currentTextIndex) ) { + this.currentTextIndex++; + this.currentWordIndex = 0; + // keep going if we're not yet past the last text element + if( this.currentTextIndex < this.wordWin.textInputs.length ) { + this._spellcheck(); + return; + } else { + this.terminateSpell(); + return; + } + } + + // if this is after the first one make sure the Undo button is enabled + if( this.currentWordIndex > 0 ) { + this.controlWin.enableUndo(); + } + + // skip the current word if it has already been worked on + if( this.wordFlags[this.currentTextIndex][this.currentWordIndex] ) { + // increment the global current word index and move on. + this.currentWordIndex++; + this._spellcheck(); + } else { + var evalText = ww.getTextVal( this.currentTextIndex, this.currentWordIndex ); + if( evalText ) { + this.controlWin.evaluatedText.value = evalText; + ww.setFocus( this.currentTextIndex, this.currentWordIndex ); + this._getSuggestions( this.currentTextIndex, this.currentWordIndex ); + } + } +} + +function _getSuggestions( text_num, word_num ) { + this.controlWin.clearSuggestions(); + // add suggestion in list for each suggested word. + // get the array of suggested words out of the + // three-dimensional array containing all suggestions. + var a_suggests = this.wordWin.suggestions[text_num][word_num]; + if( a_suggests ) { + // got an array of suggestions. + for( var ii = 0; ii < a_suggests.length; ii++ ) { + this.controlWin.addSuggestion( a_suggests[ii] ); + } + } + this.controlWin.selectDefaultSuggestion(); +} + +function _setAsIgnored( text_num, word_num, flag ) { + // set the UI + this.wordWin.removeFocus( text_num, word_num ); + // do the bookkeeping + this.wordFlags[text_num][word_num] = flag; + return true; +} + +function _getTotalReplaced() { + var i_replaced = 0; + for( var i = 0; i < this.wordFlags.length; i++ ) { + for( var j = 0; j < this.wordFlags[i].length; j++ ) { + if(( this.wordFlags[i][j] == this.replWordFlag ) + || ( this.wordFlags[i][j] == this.replAllFlag ) + || ( this.wordFlags[i][j] == this.fromReplAll )) { + i_replaced++; + } + } + } + return i_replaced; +} + +function _setWordText( text_num, word_num, newText, flag ) { + // set the UI and form inputs + this.wordWin.setText( text_num, word_num, newText ); + // keep track of what happened to this word: + this.wordFlags[text_num][word_num] = flag; + return true; +} + +function _getFormInputs( inputPattern ) { + var inputs = new Array(); + for( var i = 0; i < document.forms.length; i++ ) { + for( var j = 0; j < document.forms[i].elements.length; j++ ) { + if( document.forms[i].elements[j].type.match( inputPattern )) { + inputs[inputs.length] = document.forms[i].elements[j]; + } + } + } + return inputs; +} + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellchecker.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellchecker.html new file mode 100644 index 00000000..c419d23d --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellchecker.html @@ -0,0 +1,71 @@ + + + + + + +Speller Pages + + + + + + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellerStyle.css b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellerStyle.css new file mode 100644 index 00000000..47bc1efb --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellerStyle.css @@ -0,0 +1,49 @@ +.blend { + font-family: courier new; + font-size: 10pt; + border: 0; + margin-bottom:-1; +} +.normalLabel { + font-size:8pt; +} +.normalText { + font-family:arial, helvetica, sans-serif; + font-size:10pt; + color:000000; + background-color:FFFFFF; +} +.plainText { + font-family: courier new, courier, monospace; + font-size: 10pt; + color:000000; + background-color:FFFFFF; +} +.controlWindowBody { + font-family:arial, helvetica, sans-serif; + font-size:8pt; + padding: 7px ; /* by FredCK */ + margin: 0px ; /* by FredCK */ + /* color:000000; by FredCK */ + /* background-color:DADADA; by FredCK */ +} +.readonlyInput { + background-color:DADADA; + color:000000; + font-size:8pt; + width:392px; +} +.textDefault { + font-size:8pt; + width: 200px; +} +.buttonDefault { + width:90px; + height:22px; + font-size:8pt; +} +.suggSlct { + width:200px; + margin-top:2; + font-size:8pt; +} \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/wordWindow.js b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/wordWindow.js new file mode 100644 index 00000000..a4d464b1 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_spellerpages/spellerpages/wordWindow.js @@ -0,0 +1,271 @@ +//////////////////////////////////////////////////// +// wordWindow object +//////////////////////////////////////////////////// +function wordWindow() { + // private properties + this._forms = []; + + // private methods + this._getWordObject = _getWordObject; + //this._getSpellerObject = _getSpellerObject; + this._wordInputStr = _wordInputStr; + this._adjustIndexes = _adjustIndexes; + this._isWordChar = _isWordChar; + this._lastPos = _lastPos; + + // public properties + this.wordChar = /[a-zA-Z]/; + this.windowType = "wordWindow"; + this.originalSpellings = new Array(); + this.suggestions = new Array(); + this.checkWordBgColor = "pink"; + this.normWordBgColor = "white"; + this.text = ""; + this.textInputs = new Array(); + this.indexes = new Array(); + //this.speller = this._getSpellerObject(); + + // public methods + this.resetForm = resetForm; + this.totalMisspellings = totalMisspellings; + this.totalWords = totalWords; + this.totalPreviousWords = totalPreviousWords; + //this.getTextObjectArray = getTextObjectArray; + this.getTextVal = getTextVal; + this.setFocus = setFocus; + this.removeFocus = removeFocus; + this.setText = setText; + //this.getTotalWords = getTotalWords; + this.writeBody = writeBody; + this.printForHtml = printForHtml; +} + +function resetForm() { + if( this._forms ) { + for( var i = 0; i < this._forms.length; i++ ) { + this._forms[i].reset(); + } + } + return true; +} + +function totalMisspellings() { + var total_words = 0; + for( var i = 0; i < this.textInputs.length; i++ ) { + total_words += this.totalWords( i ); + } + return total_words; +} + +function totalWords( textIndex ) { + return this.originalSpellings[textIndex].length; +} + +function totalPreviousWords( textIndex, wordIndex ) { + var total_words = 0; + for( var i = 0; i <= textIndex; i++ ) { + for( var j = 0; j < this.totalWords( i ); j++ ) { + if( i == textIndex && j == wordIndex ) { + break; + } else { + total_words++; + } + } + } + return total_words; +} + +//function getTextObjectArray() { +// return this._form.elements; +//} + +function getTextVal( textIndex, wordIndex ) { + var word = this._getWordObject( textIndex, wordIndex ); + if( word ) { + return word.value; + } +} + +function setFocus( textIndex, wordIndex ) { + var word = this._getWordObject( textIndex, wordIndex ); + if( word ) { + if( word.type == "text" ) { + word.focus(); + word.style.backgroundColor = this.checkWordBgColor; + } + } +} + +function removeFocus( textIndex, wordIndex ) { + var word = this._getWordObject( textIndex, wordIndex ); + if( word ) { + if( word.type == "text" ) { + word.blur(); + word.style.backgroundColor = this.normWordBgColor; + } + } +} + +function setText( textIndex, wordIndex, newText ) { + var word = this._getWordObject( textIndex, wordIndex ); + var beginStr; + var endStr; + if( word ) { + var pos = this.indexes[textIndex][wordIndex]; + var oldText = word.value; + // update the text given the index of the string + beginStr = this.textInputs[textIndex].substring( 0, pos ); + endStr = this.textInputs[textIndex].substring( + pos + oldText.length, + this.textInputs[textIndex].length + ); + this.textInputs[textIndex] = beginStr + newText + endStr; + + // adjust the indexes on the stack given the differences in + // length between the new word and old word. + var lengthDiff = newText.length - oldText.length; + this._adjustIndexes( textIndex, wordIndex, lengthDiff ); + + word.size = newText.length; + word.value = newText; + this.removeFocus( textIndex, wordIndex ); + } +} + + +function writeBody() { + var d = window.document; + var is_html = false; + + d.open(); + + // iterate through each text input. + for( var txtid = 0; txtid < this.textInputs.length; txtid++ ) { + var end_idx = 0; + var begin_idx = 0; + d.writeln( '
' ); + var wordtxt = this.textInputs[txtid]; + this.indexes[txtid] = []; + + if( wordtxt ) { + var orig = this.originalSpellings[txtid]; + if( !orig ) break; + + //!!! plain text, or HTML mode? + d.writeln( '
' ); + // iterate through each occurrence of a misspelled word. + for( var i = 0; i < orig.length; i++ ) { + // find the position of the current misspelled word, + // starting at the last misspelled word. + // and keep looking if it's a substring of another word + do { + begin_idx = wordtxt.indexOf( orig[i], end_idx ); + end_idx = begin_idx + orig[i].length; + // word not found? messed up! + if( begin_idx == -1 ) break; + // look at the characters immediately before and after + // the word. If they are word characters we'll keep looking. + var before_char = wordtxt.charAt( begin_idx - 1 ); + var after_char = wordtxt.charAt( end_idx ); + } while ( + this._isWordChar( before_char ) + || this._isWordChar( after_char ) + ); + + // keep track of its position in the original text. + this.indexes[txtid][i] = begin_idx; + + // write out the characters before the current misspelled word + for( var j = this._lastPos( txtid, i ); j < begin_idx; j++ ) { + // !!! html mode? make it html compatible + d.write( this.printForHtml( wordtxt.charAt( j ))); + } + + // write out the misspelled word. + d.write( this._wordInputStr( orig[i] )); + + // if it's the last word, write out the rest of the text + if( i == orig.length-1 ){ + d.write( printForHtml( wordtxt.substr( end_idx ))); + } + } + + d.writeln( '
' ); + + } + d.writeln( '
' ); + } + //for ( var j = 0; j < d.forms.length; j++ ) { + // alert( d.forms[j].name ); + // for( var k = 0; k < d.forms[j].elements.length; k++ ) { + // alert( d.forms[j].elements[k].name + ": " + d.forms[j].elements[k].value ); + // } + //} + + // set the _forms property + this._forms = d.forms; + d.close(); +} + +// return the character index in the full text after the last word we evaluated +function _lastPos( txtid, idx ) { + if( idx > 0 ) + return this.indexes[txtid][idx-1] + this.originalSpellings[txtid][idx-1].length; + else + return 0; +} + +function printForHtml( n ) { + return n ; // by FredCK + + var htmlstr = n; + if( htmlstr.length == 1 ) { + // do simple case statement if it's just one character + switch ( n ) { + case "\n": + htmlstr = '
'; + break; + case "<": + htmlstr = '<'; + break; + case ">": + htmlstr = '>'; + break; + } + return htmlstr; + } else { + htmlstr = htmlstr.replace( //g, '>' ); + htmlstr = htmlstr.replace( /\n/g, '
' ); + return htmlstr; + } +} + +function _isWordChar( letter ) { + if( letter.search( this.wordChar ) == -1 ) { + return false; + } else { + return true; + } +} + +function _getWordObject( textIndex, wordIndex ) { + if( this._forms[textIndex] ) { + if( this._forms[textIndex].elements[wordIndex] ) { + return this._forms[textIndex].elements[wordIndex]; + } + } + return null; +} + +function _wordInputStr( word ) { + var str = ''; + return str; +} + +function _adjustIndexes( textIndex, wordIndex, lengthDiff ) { + for( var i = wordIndex + 1; i < this.originalSpellings[textIndex].length; i++ ) { + this.indexes[textIndex][i] = this.indexes[textIndex][i] + lengthDiff; + } +} diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_table.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_table.html new file mode 100644 index 00000000..1d13d40a --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_table.html @@ -0,0 +1,282 @@ + + + + + Table Properties + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
Rows: 
Columns: 
  
Border size: 
Alignment: 
+
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
Width:  
Height:  pixels
   
Cell spacing:  
Cell padding:  
+
+ + + + + + + + + + + + +
Caption:   +
Summary:   +
+
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_tablecell.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_tablecell.html new file mode 100644 index 00000000..53984adc --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_tablecell.html @@ -0,0 +1,217 @@ + + + + + Table Cell Properties + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Width:  
Height:  pixels
  
Word Wrap: 
  
Horizontal Alignment: 
Vertival Alignement: 
+
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
Rows Span: 
Columns Span: 
   
Background Color:  
Border Color:  
+
+
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_template.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_template.html new file mode 100644 index 00000000..c293e463 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_template.html @@ -0,0 +1,210 @@ + + + + + + + + + + + + + + + + + + +
+ Please select the template to open in the editor
+ (the actual contents will be lost):
+
+
+ + +
+
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_textarea.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_textarea.html new file mode 100644 index 00000000..b42b9f75 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_textarea.html @@ -0,0 +1,90 @@ + + + + + Text Area Properties + + + + + + + + + + +
+ + + + +
+ Name
+ + Collumns
+ +
+ Rows
+ +
+
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_textfield.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_textfield.html new file mode 100644 index 00000000..6cc18f6b --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_textfield.html @@ -0,0 +1,131 @@ + + + + + Text Field Properties + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ Name
+ +
+ Value
+ +
+ Character Width
+ +
+ Maximum Characters
+ +
+ Type
+ +
 
+
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey.html b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey.html new file mode 100644 index 00000000..0e95a70d --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey.html @@ -0,0 +1,63 @@ + + + + + Universal Keyboard + + + + + + + + + + + + + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/00.gif b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/00.gif new file mode 100644 index 00000000..fc256098 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/00.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/data.js b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/data.js new file mode 100644 index 00000000..0712ffe2 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/data.js @@ -0,0 +1,70 @@ +/* + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2005 Frederico Caldeira Knabben + * + * Licensed under the terms of the GNU Lesser General Public License: + * http://www.opensource.org/licenses/lgpl-license.php + * + * For further information visit: + * http://www.fckeditor.net/ + * + * "Support Open Source software. What about a donation today?" + * + * File Name: data.js + * Scripts for the fck_universalkey.html page. + * Definition des 104 caracteres en hexa unicode. + * + * File Authors: + * Michel Staelens (michel.staelens@wanadoo.fr) + * Abdul-Aziz Al-Oraij (top7up@hotmail.com) + */ + +var Maj = new Array() ; +var Min = new Array() ; + +Maj["Arabic"] ="0651|0021|0040|0023|0024|0025|005E|0026|002A|0029|0028|005F|002B|064E|064B|064F|064C|0625|0625|2018|00F7|00D7|061B|003C|003E|0650|064D|005D|005B|0623|0623|0640|060C|002F|003A|0022|007E|0652|007D|007B|0622|0622|2019|002C|002E|061F|007C|0020|0020|0020|0020|0020" ; +Min["Arabic"] ="0630|0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|002D|003D|0636|0635|062B|0642|0641|063A|0639|0647|062E|062D|062C|062F|0634|0633|064A|0628|0644|0627|062A|0646|0645|0643|0637|0626|0621|0624|0631|0644|0627|0649|0629|0648|0632|0638|005C|0020|0020|0020|0020" ; +Maj["Belarusian (C)"] ="0401|0021|0022|2116|003B|0025|003A|003F|002A|0028|0029|005F|002B|0419|0426|0423|041A|0415|041D|0413|0428|040E|0417|0425|0027|0424|042B|0412|0410|041F|0420|041E|041B|0414|0416|042D|042F|0427|0421|041C|0406|0422|042C|0411|042E|002C|0020|0020|0020|0020|0020|0020" ; +Min["Belarusian (C)"] ="0451|0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|002D|003D|0439|0446|0443|043A|0435|043D|0433|0448|045E|0437|0445|0027|0444|044B|0432|0430|043F|0440|043E|043B|0434|0436|044D|044F|0447|0441|043C|0456|0442|044C|0431|044E|002E|0020|0020|0020|0020|0020|0020" ; +Maj["Bulgarian (C)"] ="007E|0021|003F|002B|0022|0025|003D|003A|002F|005F|2116|0406|0056|044B|0423|0415|0418|0428|0429|041A|0421|0414|0417|0426|00A7|042C|042F|0410|041E|0416|0413|0422|041D|0412|041C|0427|042E|0419|042A|042D|0424|0425|041F|0420|041B|0411|0029|0020|0020|0020|0020|0020" ; +Min["Bulgarian (C)"] ="0060|0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|002D|002E|002C|0443|0435|0438|0448|0449|043A|0441|0434|0437|0446|003B|044C|044F|0430|043E|0436|0433|0442|043D|0432|043C|0447|044E|0439|044A|044D|0444|0445|043F|0440|043B|0431|0028|0020|0020|0020|0020|0020" ; +Maj["Croatian (L)"] ="00B8|0021|0022|0023|0024|0025|0026|002F|0028|0029|003D|003F|00A8|0051|0057|0045|0052|0054|005A|0055|0049|004F|0050|0160|0110|0041|0053|0044|0046|0047|0048|004A|004B|004C|010C|0106|0059|0058|0043|0056|0042|004E|004D|017D|003B|003A|003C|003E|005F|002D|002A|002B" ; +Min["Croatian (L)"] ="00B8|0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|0027|00A8|0071|0077|0065|0072|0074|007A|0075|0069|006F|0070|0161|0111|0061|0073|0064|0066|0067|0068|006A|006B|006C|010D|0107|0079|0078|0063|0076|0062|006E|006D|017E|002C|002E|003C|003E|005F|002D|002A|002B" ; +Maj["Czech (L)"] ="00B0|0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|0025|02C7|0051|0057|0045|0052|0054|005A|0055|0049|004F|0050|002F|0028|0041|0053|0044|0046|0047|0048|004A|004B|004C|0022|0027|0059|0058|0043|0056|0042|004E|004D|003F|003A|005F|005B|007B|0021|0020|0148|010F" ; +Min["Czech (L)"] ="003B|002B|011B|0161|010D|0159|017E|00FD|00E1|00ED|00E9|003D|00B4|0071|0077|0065|0072|0074|007A|0075|0069|006F|0070|00FA|0029|0061|0073|0064|0066|0067|0068|006A|006B|006C|016F|00A7|0079|0078|0063|0076|0062|006E|006D|002C|002E|002D|005D|007D|00A8|0040|00F3|0165" ; +Maj["Danish (L)"] ="00A7|0021|0022|0023|00A4|0025|0026|002F|0028|0029|003D|003F|0060|0051|0057|0045|0052|0054|0059|0055|0049|004F|0050|00C5|005E|0041|0053|0044|0046|0047|0048|004A|004B|004C|00C6|00D8|003E|005A|0058|0043|0056|0042|004E|004D|003B|003A|002A|005F|007B|007D|005C|007E" ; +Min["Danish (L)"] ="00BD|0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|002B|00B4|0071|0077|0065|0072|0074|0079|0075|0069|006F|0070|00E5|00A8|0061|0073|0064|0066|0067|0068|006A|006B|006C|00E6|00F8|003C|007A|0078|0063|0076|0062|006E|006D|002C|002E|0027|002D|005B|005D|007C|0040" ; +Maj["Farsi"] ="0020|0021|0040|0023|0024|0025|005E|0026|002A|0029|0028|005F|002B|0020|0020|0020|0020|0020|0020|0020|00F7|00D7|0020|007D|007B|0020|0020|005D|005B|0623|0622|0640|060C|061B|003A|0022|007E|0020|0020|0020|0020|0020|2019|003E|003C|061F|007C|0020|0020|0020|0020|0020" +Min["Farsi"] ="067E|0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|002D|003D|0636|0635|062B|0642|0641|063A|0639|0647|062E|062D|062C|0686|0634|0633|064A|0628|0644|0627|062A|0646|0645|0643|06AF|0638|0637|0632|0631|0630|062F|0621|0648|002E|002F|005C|0020|0020|0020|0020|0020" +Maj["Finnish (L)"] ="00A7|0021|0022|0023|00A4|0025|0026|002F|0028|0029|003D|003F|0060|0051|0057|0045|0052|0054|0059|0055|0049|004F|0050|00C5|005E|0041|0053|0044|0046|0047|0048|004A|004B|004C|00D6|00C4|003E|005A|0058|0043|0056|0042|004E|004D|003B|003A|002A|005F|007B|007D|005C|007E" ; +Min["Finnish (L)"] ="00BD|0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|002B|00B4|0071|0077|0065|0072|0074|0079|0075|0069|006F|0070|00E5|00A8|0061|0073|0064|0066|0067|0068|006A|006B|006C|00F6|00E4|003C|007A|0078|0063|0076|0062|006E|006D|002C|002E|0027|002D|005B|005D|007C|0040" ; +Maj["French (L)"] ="0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|00B0|002B|0023|0041|005A|0045|0052|0054|0059|0055|0049|004F|0050|00A8|0025|0051|0053|0044|0046|0047|0048|004A|004B|004C|004D|00B5|0057|0058|0043|0056|0042|004E|003F|002E|002F|00A7|003C|005B|007B|00A3|007E|0020" ; +Min["French (L)"] ="0026|00E9|0022|0027|0028|002D|00E8|005F|00E7|00E0|0029|003D|0040|0061|007A|0065|0072|0074|0079|0075|0069|006F|0070|005E|00F9|0071|0073|0064|0066|0067|0068|006A|006B|006C|006D|002A|0077|0078|0063|0076|0062|006E|002C|003B|003A|0021|003E|005D|007D|0024|007E|0020" ; +Maj["Greek"] ="007E|0021|0040|0023|0024|0025|0390|0026|03B0|0028|0029|005F|002B|003A|03A3|0395|03A1|03A4|03A5|0398|0399|039F|03A0|0386|038F|0391|03A3|0394|03A6|0393|0397|039E|039A|039B|038C|0022|0396|03A7|03A8|03A9|0392|039D|039C|003C|003E|003F|0388|0389|038A|03AA|03AB|038E" ; +Min["Greek"] ="0060|0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|002D|003D|003B|03C2|03B5|03C1|03C4|03C5|03B8|03B9|03BF|03C0|03AC|03CE|03B1|03C3|03B4|03C6|03B3|03B7|03BE|03BA|03BB|03CC|0027|03B6|03C7|03C8|03C9|03B2|03BD|03BC|002C|002E|002F|03AD|03AE|03AF|03CA|03CB|03CD" ; +Maj["Hebrew"] ="007E|0021|0040|0023|0024|0025|005E|0026|002A|0028|0029|005F|002B|0051|0057|0045|0052|0054|0059|0055|0049|004F|0050|007B|007D|0041|0053|0044|0046|0047|0048|004A|004B|004C|003A|0022|005A|0058|0043|0056|0042|004E|004D|003C|003E|003F|0020|0020|0020|0020|0020|0020" ; +Min["Hebrew"] ="0060|0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|002D|003D|002F|0027|05E7|05E8|05D0|05D8|05D5|05DF|05DD|05E4|005B|005D|05E9|05D3|05D2|05DB|05E2|05D9|05D7|05DC|05DA|05E3|002C|05D6|05E1|05D1|05D4|05E0|05DE|05E6|05EA|05E5|002E|0020|0020|0020|0020|0020|0020" ; +Maj["Hungarian (L)"] ="00A7|0027|0022|002B|0021|0025|002F|003D|0028|0029|00ED|00DC|00D3|0051|0057|0045|0052|0054|005A|0055|0049|004F|0050|0150|00DA|0041|0053|0044|0046|0047|0048|004A|004B|004C|00C9|00C1|0170|00CD|0059|0058|0043|0056|0042|004E|004D|003F|002E|003A|002D|005F|007B|007D" ; +Min["Hungarian (L)"] ="0030|0031|0032|0033|0034|0035|0036|0037|0038|0039|00F6|00FC|00F3|0071|0077|0065|0072|0074|007A|0075|0069|006F|0070|0151|00FA|0061|0073|0064|0066|0067|0068|006A|006B|006C|00E9|00E1|0171|00ED|0079|0078|0063|0076|0062|006E|006D|002C|002E|003A|002D|005F|007B|007D" ; +Maj["Diacritical (L)"] ="0060|00B4|005E|00A8|007E|00B0|00B7|00B8|00AF|02D9|02DB|02C7|02D8|0051|0057|0045|0052|0054|005A|0055|0049|004F|0050|00C6|02DD|0041|0053|0044|0046|0047|0048|004A|004B|004C|0141|0152|0059|0058|0043|0056|0042|004E|004D|01A0|01AF|00D8|0126|0110|0132|00DE|00D0|00DF" ; +Min["Diacritical (L)"] ="0060|00B4|005E|00A8|007E|00B0|00B7|00B8|00AF|02D9|02DB|02C7|02D8|0071|0077|0065|0072|0074|007A|0075|0069|006F|0070|00E6|02DD|0061|0073|0064|0066|0067|0068|006A|006B|006C|0142|0153|0079|0078|0063|0076|0062|006E|006D|01A1|01B0|00F8|0127|0111|0133|00FE|00F0|00DF" ; +Maj["Macedonian (C)"] ="007E|0021|201E|201C|2019|0025|2018|0026|002A|0028|0029|005F|002B|0409|040A|0415|0420|0422|0405|0423|0418|041E|041F|0428|0403|0410|0421|0414|0424|0413|0425|0408|041A|041B|0427|040C|0401|0417|040F|0426|0412|0411|041D|041C|0416|003B|003A|003F|002A|005F|007B|007D" ; +Min["Macedonian (C)"] ="0060|0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|002D|003D|0459|045A|0435|0440|0442|0455|0443|0438|043E|043F|0448|0453|0430|0441|0434|0444|0433|0445|0458|043A|043B|0447|045C|0451|0437|045F|0446|0432|0431|043D|043C|0436|002C|002E|002F|0027|002D|005B|005D" ; +Maj["Norwegian (L)"] ="00A7|0021|0022|0023|00A4|0025|0026|002F|0028|0029|003D|003F|0060|0051|0057|0045|0052|0054|0059|0055|0049|004F|0050|00C5|005E|0041|0053|0044|0046|0047|0048|004A|004B|00D8|00C6|00C4|003E|005A|0058|0043|0056|0042|004E|004D|003B|003A|002A|005F|007B|007D|005C|007E" ; +Min["Norwegian (L)"] ="00BD|0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|002B|00B4|0071|0077|0065|0072|0074|0079|0075|0069|006F|0070|00E5|00A8|0061|0073|0064|0066|0067|0068|006A|006B|00F8|00E6|00E4|003C|007A|0078|0063|0076|0062|006E|006D|002C|002E|0027|002D|005B|005D|007C|0040" ; +Maj["Polish (L)"] ="002A|0021|0022|0023|00A4|0025|0026|002F|0028|0029|003D|003F|017A|0051|0057|0045|0052|0054|005A|0055|0049|004F|0050|0144|0107|0041|0053|0044|0046|0047|0048|004A|004B|004C|0141|0119|0059|0058|0043|0056|0042|004E|004D|003B|003A|005F|003C|005B|007B|02D9|00B4|02DB" ; +Min["Polish (L)"] ="0027|0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|002B|00F3|0071|0077|0065|0072|0074|007A|0075|0069|006F|0070|017C|015B|0061|0073|0064|0066|0067|0068|006A|006B|006C|0142|0105|0079|0078|0063|0076|0062|006E|006D|002C|002E|002D|003E|005D|007D|02D9|00B4|02DB" ; +Maj["Russian (C)"] ="0401|0021|0040|0023|2116|0025|005E|0026|002A|0028|0029|005F|002B|0419|0426|0423|041A|0415|041D|0413|0428|0429|0417|0425|042A|0424|042B|0412|0410|041F|0420|041E|041B|0414|0416|042D|042F|0427|0421|041C|0418|0422|042C|0411|042E|003E|002E|003A|0022|005B|005D|003F" ; +Min["Russian (C)"] ="0451|0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|002D|003D|0439|0446|0443|043A|0435|043D|0433|0448|0449|0437|0445|044A|0444|044B|0432|0430|043F|0440|043E|043B|0434|0436|044D|044F|0447|0441|043C|0438|0442|044C|0431|044E|003C|002C|003B|0027|007B|007D|002F" ; +Maj["Serbian (C)"] ="007E|0021|0022|0023|0024|0025|0026|002F|0028|0029|003D|003F|002A|0409|040A|0415|0420|0422|0417|0423|0418|041E|041F|0428|0402|0410|0421|0414|0424|0413|0425|0408|041A|041B|0427|040B|003E|0405|040F|0426|0412|0411|041D|041C|0416|003A|005F|002E|003A|0022|005B|005D" ; +Min["Serbian (C)"] ="0060|0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|0027|002B|0459|045A|0435|0440|0442|0437|0443|0438|043E|043F|0448|0452|0430|0441|0434|0444|0433|0445|0458|043A|043B|0447|045B|003C|0455|045F|0446|0432|0431|043D|043C|0436|002E|002D|002C|003B|0027|007B|007D" ; +Maj["Serbian (L)"] ="007E|0021|0022|0023|0024|0025|0026|002F|0028|0029|003D|003F|002A|0051|0057|0045|0052|0054|005A|0055|0049|004F|0050|0160|0110|0041|0053|0044|0046|0047|0048|004A|004B|004C|010C|0106|003E|0059|0058|0043|0056|0042|004E|004D|017D|003A|005F|002E|003A|0022|005B|005D" ; +Min["Serbian (L)"] ="201A|0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|0027|002B|0071|0077|0065|0072|0074|007A|0075|0069|006F|0070|0161|0111|0061|0073|0064|0066|0067|0068|006A|006B|006C|010D|0107|003C|0079|0078|0063|0076|0062|006E|006D|017E|002E|002D|002C|003B|0027|007B|007D" ; +Maj["Slovak (L)"] ="00B0|0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|0025|02C7|0051|0057|0045|0052|0054|005A|0055|0049|004F|0050|002F|0028|0041|0053|0044|0046|0047|0048|004A|004B|004C|0022|0021|0059|0058|0043|0056|0042|004E|004D|003F|003A|005F|003C|005B|010F|0029|002A|0020" ; +Min["Slovak (L)"] ="003B|002B|013E|0161|010D|0165|017E|00FD|00E1|00ED|00E9|003D|00B4|0071|0077|0065|0072|0074|007A|0075|0069|006F|0070|00FA|00E4|0061|0073|0064|0066|0067|0068|006A|006B|006C|00F4|00A7|0079|0078|0063|0076|0062|006E|006D|002C|002E|002D|003E|005D|00F3|0148|0026|0020" ; +Maj["Spanish (L)"] ="00AA|0021|0022|00B7|0024|0025|0026|002F|0028|0029|003D|003F|00BF|0051|0057|0045|0052|0054|0059|0055|0049|004F|0050|005E|00A8|0041|0053|0044|0046|0047|0048|004A|004B|004C|00D1|00C7|005A|0058|0043|0056|0042|004E|004D|003B|003A|005F|003E|007C|0040|0023|007E|002A" ; +Min["Spanish (L)"] ="00BA|0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|0027|00A1|0071|0077|0065|0072|0074|0079|0075|0069|006F|0070|0060|00B4|0061|0073|0064|0066|0067|0068|006A|006B|006C|00F1|00E7|007A|0078|0063|0076|0062|006E|006D|002C|002E|002D|003C|005C|0040|0023|007E|002B" ; +Maj["Ukrainian (C)"] ="0401|0021|0040|0023|2116|0025|005E|0026|002A|0028|0029|005F|002B|0419|0426|0423|041A|0415|041D|0413|0428|0429|0417|0425|0407|0424|0406|0412|0410|041F|0420|041E|041B|0414|0416|0404|0490|042F|0427|0421|041C|0418|0422|042C|0411|042E|002E|003A|0022|003C|003E|003F" ; +Min["Ukrainian (C)"] ="0451|0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|002D|003D|0439|0446|0443|043A|0435|043D|0433|0448|0449|0437|0445|0457|0444|0456|0432|0430|043F|0440|043E|043B|0434|0436|0454|0491|044F|0447|0441|043C|0438|0442|044C|0431|044E|002C|003B|0027|007B|007D|002F" ; +Maj["Vietnamese (L)"] ="007E|0021|0040|0023|0024|0025|005E|0026|002A|0028|0029|005F|002B|0051|0057|0045|0052|0054|0059|0055|0049|004F|0050|01AF|01A0|0041|0053|0044|0046|0047|0048|004A|004B|004C|0102|00C2|005A|0058|0043|0056|0042|004E|004D|00CA|00D4|0110|003C|003E|003F|007D|003A|0022" ; +Min["Vietnamese (L)"] ="20AB|0031|0032|0033|0034|0035|0036|0037|0038|0039|0030|002D|003D|0071|0077|0065|0072|0074|0079|0075|0069|006F|0070|01B0|01A1|0061|0073|0064|0066|0067|0068|006A|006B|006C|0103|00E2|007A|0078|0063|0076|0062|006E|006D|00EA|00F4|0111|002C|002E|002F|007B|003B|0027" ; \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/diacritic.js b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/diacritic.js new file mode 100644 index 00000000..b00d32cd --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/diacritic.js @@ -0,0 +1,65 @@ +/* + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2005 Frederico Caldeira Knabben + * + * Licensed under the terms of the GNU Lesser General Public License: + * http://www.opensource.org/licenses/lgpl-license.php + * + * For further information visit: + * http://www.fckeditor.net/ + * + * "Support Open Source software. What about a donation today?" + * + * File Name: diacritic.js + * Scripts for the fck_universalkey.html page. + * + * File Authors: + * Michel Staelens (michel.staelens@wanadoo.fr) + * Abdul-Aziz Al-Oraij (top7up@hotmail.com) + */ + +var dia = new Array() + +dia["0060"]=new Array();dia["00B4"]=new Array();dia["005E"]=new Array();dia["00A8"]=new Array();dia["007E"]=new Array();dia["00B0"]=new Array();dia["00B7"]=new Array();dia["00B8"]=new Array();dia["00AF"]=new Array();dia["02D9"]=new Array();dia["02DB"]=new Array();dia["02C7"]=new Array();dia["02D8"]=new Array();dia["02DD"]=new Array();dia["031B"]=new Array(); +dia["0060"]["0061"]="00E0";dia["00B4"]["0061"]="00E1";dia["005E"]["0061"]="00E2";dia["00A8"]["0061"]="00E4";dia["007E"]["0061"]="00E3";dia["00B0"]["0061"]="00E5";dia["00AF"]["0061"]="0101";dia["02DB"]["0061"]="0105";dia["02D8"]["0061"]="0103"; +dia["00B4"]["0063"]="0107";dia["005E"]["0063"]="0109";dia["00B8"]["0063"]="00E7";dia["02D9"]["0063"]="010B";dia["02C7"]["0063"]="010D"; +dia["02C7"]["0064"]="010F"; +dia["0060"]["0065"]="00E8";dia["00B4"]["0065"]="00E9";dia["005E"]["0065"]="00EA";dia["00A8"]["0065"]="00EB";dia["00AF"]["0065"]="0113";dia["02D9"]["0065"]="0117";dia["02DB"]["0065"]="0119";dia["02C7"]["0065"]="011B";dia["02D8"]["0065"]="0115"; +dia["005E"]["0067"]="011D";dia["00B8"]["0067"]="0123";dia["02D9"]["0067"]="0121";dia["02D8"]["0067"]="011F"; +dia["005E"]["0068"]="0125"; +dia["0060"]["0069"]="00EC";dia["00B4"]["0069"]="00ED";dia["005E"]["0069"]="00EE";dia["00A8"]["0069"]="00EF";dia["007E"]["0069"]="0129";dia["00AF"]["0069"]="012B";dia["02DB"]["0069"]="012F";dia["02D8"]["0069"]="012D"; +dia["005E"]["006A"]="0135"; +dia["00B8"]["006B"]="0137"; +dia["00B4"]["006C"]="013A";dia["00B7"]["006C"]="0140";dia["00B8"]["006C"]="013C";dia["02C7"]["006C"]="013E"; +dia["00B4"]["006E"]="0144";dia["007E"]["006E"]="00F1";dia["00B8"]["006E"]="0146";dia["02D8"]["006E"]="0148"; +dia["0060"]["006F"]="00F2";dia["00B4"]["006F"]="00F3";dia["005E"]["006F"]="00F4";dia["00A8"]["006F"]="00F6";dia["007E"]["006F"]="00F5";dia["00AF"]["006F"]="014D";dia["02D8"]["006F"]="014F";dia["02DD"]["006F"]="0151";dia["031B"]["006F"]="01A1"; +dia["00B4"]["0072"]="0155";dia["00B8"]["0072"]="0157";dia["02C7"]["0072"]="0159"; +dia["00B4"]["0073"]="015B";dia["005E"]["0073"]="015D";dia["00B8"]["0073"]="015F";dia["02C7"]["0073"]="0161"; +dia["00B8"]["0074"]="0163";dia["02C7"]["0074"]="0165"; +dia["0060"]["0075"]="00F9";dia["00B4"]["0075"]="00FA";dia["005E"]["0075"]="00FB";dia["00A8"]["0075"]="00FC";dia["007E"]["0075"]="0169";dia["00B0"]["0075"]="016F";dia["00AF"]["0075"]="016B";dia["02DB"]["0075"]="0173";dia["02D8"]["0075"]="016D";dia["02DD"]["0075"]="0171";dia["031B"]["0075"]="01B0"; +dia["005E"]["0077"]="0175"; +dia["00B4"]["0079"]="00FD";dia["005E"]["0079"]="0177";dia["00A8"]["0079"]="00FF"; +dia["00B4"]["007A"]="017A";dia["02D9"]["007A"]="017C";dia["02C7"]["007A"]="017E"; +dia["00B4"]["00E6"]="01FD"; +dia["00B4"]["00F8"]="01FF"; +dia["0060"]["0041"]="00C0";dia["00B4"]["0041"]="00C1";dia["005E"]["0041"]="00C2";dia["00A8"]["0041"]="00C4";dia["007E"]["0041"]="00C3";dia["00B0"]["0041"]="00C5";dia["00AF"]["0041"]="0100";dia["02DB"]["0041"]="0104";dia["02D8"]["0041"]="0102"; +dia["00B4"]["0043"]="0106";dia["005E"]["0043"]="0108";dia["00B8"]["0043"]="00C7";dia["02D9"]["0043"]="010A";dia["02C7"]["0043"]="010C"; +dia["02C7"]["0044"]="010E"; +dia["0060"]["0045"]="00C8";dia["00B4"]["0045"]="00C9";dia["005E"]["0045"]="00CA";dia["00A8"]["0045"]="00CB";dia["00AF"]["0045"]="0112";dia["02D9"]["0045"]="0116";dia["02DB"]["0045"]="0118";dia["02C7"]["0045"]="011A";dia["02D8"]["0045"]="0114"; +dia["005E"]["0047"]="011C";dia["00B8"]["0047"]="0122";dia["02D9"]["0047"]="0120";dia["02D8"]["0047"]="011E"; +dia["005E"]["0048"]="0124"; +dia["0060"]["0049"]="00CC";dia["00B4"]["0049"]="00CD";dia["005E"]["0049"]="00CE";dia["00A8"]["0049"]="00CF";dia["007E"]["0049"]="0128";dia["00AF"]["0049"]="012A";dia["02D9"]["0049"]="0130";dia["02DB"]["0049"]="012E";dia["02D8"]["0049"]="012C"; +dia["005E"]["004A"]="0134"; +dia["00B8"]["004B"]="0136"; +dia["00B4"]["004C"]="0139";dia["00B7"]["004C"]="013F";dia["00B8"]["004C"]="013B";dia["02C7"]["004C"]="013D"; +dia["00B4"]["004E"]="0143";dia["007E"]["004E"]="00D1";dia["00B8"]["004E"]="0145";dia["02D8"]["004E"]="0147"; +dia["0060"]["004F"]="00D2";dia["00B4"]["004F"]="00D3";dia["005E"]["004F"]="00D4";dia["00A8"]["004F"]="00D6";dia["007E"]["004F"]="00D5";dia["00AF"]["004F"]="014C";dia["02D8"]["004F"]="014E";dia["02DD"]["004F"]="0150";dia["031B"]["004F"]="01A0"; +dia["00B4"]["0052"]="0154";dia["00B8"]["0052"]="0156";dia["02C7"]["0052"]="0158"; +dia["00B4"]["0053"]="015A";dia["005E"]["0053"]="015C";dia["00B8"]["0053"]="015E";dia["02C7"]["0053"]="0160"; +dia["00B8"]["0054"]="0162";dia["02C7"]["0054"]="0164"; +dia["0060"]["0055"]="00D9";dia["00B4"]["0055"]="00DA";dia["005E"]["0055"]="00DB";dia["00A8"]["0055"]="00DC";dia["007E"]["0055"]="0168";dia["00B0"]["0055"]="016E";dia["00AF"]["0055"]="016A";dia["02DB"]["0055"]="0172";dia["02D8"]["0055"]="016C";dia["02DD"]["0055"]="0170";dia["031B"]["0055"]="01AF"; +dia["005E"]["0057"]="0174"; +dia["00B4"]["0059"]="00DD";dia["005E"]["0059"]="0176";dia["00A8"]["0059"]="0178"; +dia["00B4"]["005A"]="0179";dia["02D9"]["005A"]="017B";dia["02C7"]["005A"]="017D"; +dia["00B4"]["00C6"]="01FC"; +dia["00B4"]["00D8"]="01FE"; \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/dialogue.js b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/dialogue.js new file mode 100644 index 00000000..2d968b86 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/dialogue.js @@ -0,0 +1,31 @@ +/* + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2005 Frederico Caldeira Knabben + * + * Licensed under the terms of the GNU Lesser General Public License: + * http://www.opensource.org/licenses/lgpl-license.php + * + * For further information visit: + * http://www.fckeditor.net/ + * + * "Support Open Source software. What about a donation today?" + * + * File Name: dialogue.js + * Scripts for the fck_universalkey.html page. + * + * File Authors: + * Michel Staelens (michel.staelens@wanadoo.fr) + * Bernadette Cierzniak + * Abdul-Aziz Al-Oraij (top7up@hotmail.com) + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +function afficher(txt) +{ + document.getElementById( 'uni_area' ).value = txt ; +} + +function rechercher() +{ + return document.getElementById( 'uni_area' ).value ; +} \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/fck_universalkey.css b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/fck_universalkey.css new file mode 100644 index 00000000..c17c5071 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/fck_universalkey.css @@ -0,0 +1,62 @@ +/* + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2005 Frederico Caldeira Knabben + * + * Licensed under the terms of the GNU Lesser General Public License: + * http://www.opensource.org/licenses/lgpl-license.php + * + * For further information visit: + * http://www.fckeditor.net/ + * + * "Support Open Source software. What about a donation today?" + * + * File Name: fck_universalkey.css + * CSS styles for the Universal Keyboard. + * + * File Authors: + * Michel Staelens (michel.staelens@wanadoo.fr) + * Bernadette Cierzniak + * Abdul-Aziz Al-Oraij (top7up@hotmail.com) + */ + +BODY, TEXTAREA, INPUT, TD, SELECT +{ + font-family: Tahoma,verdana,arial,sans-serif; +} +DIV +{ + position: absolute; +} +.simple +{ + font-size: 11pt; +} +.double +{ + font-size: 9pt; +} +.simpledia +{ + color: red; + font-size: 11pt; +} +.doubledia +{ + color: red; + font-size: 9pt; +} +.action +{ + color: white; + font-size: 7pt; +} +.clavier +{ + color: blue; + font-size: 7pt; +} +.sign +{ + color: gray; + font-size: 7pt; +} diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/keyboard_layout.gif b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/keyboard_layout.gif new file mode 100644 index 00000000..2183cc71 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/keyboard_layout.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/multihexa.js b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/multihexa.js new file mode 100644 index 00000000..8c2bfc33 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/dialog/fck_universalkey/multihexa.js @@ -0,0 +1,309 @@ +/* + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2005 Frederico Caldeira Knabben + * + * Licensed under the terms of the GNU Lesser General Public License: + * http://www.opensource.org/licenses/lgpl-license.php + * + * For further information visit: + * http://www.fckeditor.net/ + * + * "Support Open Source software. What about a donation today?" + * + * File Name: multihexa.js + * Scripts for the fck_universalkey.html page. + * Definition des 104 caracteres en hexa unicode. + * + * File Authors: + * Michel Staelens (michel.staelens@wanadoo.fr) + * Bernadette Cierzniak + * Abdul-Aziz Al-Oraij (top7up@hotmail.com) + */ + +var caps=0, lock=0, hexchars="0123456789ABCDEF", accent="0000", keydeb=0 +var key=new Array();j=0;for (i in Maj){key[j]=i;j++} +var ns6=((!document.all)&&(document.getElementById)) +var ie=document.all + +var langue=getCk(); +if (langue==""){ + langue=key[keydeb] +} +CarMaj=Maj[langue].split("|");CarMin=Min[langue].split("|") + +/*unikey*/ +var posUniKeyLeft=0, posUniKeyTop=0 +if (ns6){posUniKeyLeft=0;posUniKeyTop=60} +else if (ie){posUniKeyLeft=0;posUniKeyTop=60} +tracer("fond",posUniKeyLeft,posUniKeyTop,'
',"sign") +/*touches*/ +var posX=new Array(0,28,56,84,112,140,168,196,224,252,280,308,336,42,70,98,126,154,182,210,238,266,294,322,350,50,78,106,134,162,190,218,246,274,302,330,64,92,120,148,176,204,232,260,288,316,28,56,84,294,322,350) +var posY=new Array(14,14,14,14,14,14,14,14,14,14,14,14,14,42,42,42,42,42,42,42,42,42,42,42,42,70,70,70,70,70,70,70,70,70,70,70,98,98,98,98,98,98,98,98,98,98,126,126,126,126,126,126) +var nbTouches=52 +for (i=0;i Lock","Enter","Shift","Shift","<|<","Space",">|>") +var effet=new Array("keyscroll(-3)","keyscroll(3)","faire(\"del\")","RAZ()","faire(\"bck\")","bloq()","faire(\"\\n\")","haut()","haut()","faire(\"ar\")","faire(\" \")","faire(\"av\")") +var nbActions=12 +for (i=0;i') +document.write('') +for (i=0;i') +} +for (i=0;i') +} +for (i=0;i<4;i++){ + document.write('') +} +document.write('') + +/*fonctions*/ +function ecrire(i){ + txt=rechercher()+"|";subtxt=txt.split("|") + ceci=(lock==1)?CarMaj[i]:((caps==1)?CarMaj[i]:CarMin[i]) + if (test(ceci)){subtxt[0]+=cardia(ceci);distinguer(false)} + else if(dia[accent]!=null&&dia[hexa(ceci)]!=null){distinguer(false);accent=hexa(ceci);distinguer(true)} + else if(dia[accent]!=null){subtxt[0]+=fromhexby4tocar(accent)+ceci;distinguer(false)} + else if(dia[hexa(ceci)]!=null){accent=hexa(ceci);distinguer(true)} + else {subtxt[0]+=ceci} + txt=subtxt[0]+"|"+subtxt[1] + afficher(txt) + if (caps==1){caps=0;MinusMajus()} +} +function faire(ceci){ + txt=rechercher()+"|";subtxt=txt.split("|") + l0=subtxt[0].length + l1=subtxt[1].length + c1=subtxt[0].substring(0,(l0-2)) + c2=subtxt[0].substring(0,(l0-1)) + c3=subtxt[1].substring(0,1) + c4=subtxt[1].substring(0,2) + c5=subtxt[0].substring((l0-2),l0) + c6=subtxt[0].substring((l0-1),l0) + c7=subtxt[1].substring(1,l1) + c8=subtxt[1].substring(2,l1) + if(dia[accent]!=null){if(ceci==" "){ceci=fromhexby4tocar(accent)}distinguer(false)} + switch (ceci){ + case("av") :if(escape(c4)!="%0D%0A"){txt=subtxt[0]+c3+"|"+c7}else{txt=subtxt[0]+c4+"|"+c8}break + case("ar") :if(escape(c5)!="%0D%0A"){txt=c2+"|"+c6+subtxt[1]}else{txt=c1+"|"+c5+subtxt[1]}break + case("bck"):if(escape(c5)!="%0D%0A"){txt=c2+"|"+subtxt[1]}else{txt=c1+"|"+subtxt[1]}break + case("del"):if(escape(c4)!="%0D%0A"){txt=subtxt[0]+"|"+c7}else{txt=subtxt[0]+"|"+c8}break + default:txt=subtxt[0]+ceci+"|"+subtxt[1];break + } + afficher(txt) +} +function RAZ(){txt="";if(dia[accent]!=null){distinguer(false)}afficher(txt)} +function haut(){caps=1;MinusMajus()} +function bloq(){lock=(lock==1)?0:1;MinusMajus()} + +/*fonctions de traitement du unikey*/ +function tracer(nom,gauche,haut,ceci,classe){ceci=""+ceci+"";document.write('
'+ceci+'
');if (ns6){document.getElementById(nom).style.left=gauche+"px";document.getElementById(nom).style.top=haut+"px";}else if (ie){document.all(nom).style.left=gauche;document.all(nom).style.top=haut}} +function retracer(nom,ceci,classe){ceci=""+ceci+"";if (ns6){document.getElementById(nom).innerHTML=ceci}else if (ie){doc=document.all(nom);doc.innerHTML=ceci}} +function keyscroll(n){ + keydeb+=n + if (keydeb<0){ + keydeb=0 + } + if (keydeb>key.length-4){ + keydeb=key.length-4 + } + for (i=keydeb;i=0;a--){out+=Math.pow(16,inval.length-a-1)*hexchars.indexOf(inval.charAt(a))}return out} +function fromhexby4tocar(ceci){out4=new String();for (l=0;l-1)|(langue!="Arabic")) return true; + + if (!e) var e = window.event; + if (e.keyCode) keyCode = e.keyCode; + else if (e.which) keyCode = e.which; + var character = String.fromCharCode(keyCode); + + entry = true; + cont=e.srcElement || e.currentTarget || e.target; + if (keyCode>64 && keyCode<91) { + entry=false; + source='ش لاؤ ي ث ب ل ا ه ت ن م ة ى خ ح ض ق س ف ع ر ص ء غ ئ '; + shsource='ِ لآ} ] ُ [ لأأ ÷ ـ ، / آ × ؛ َ ٌ ٍ لإ { ً ْ إ ~'; + + if (e.shiftKey) cont.value += shsource.substr((keyCode-64)*2-2,2); + else + cont.value += source.substr((keyCode-64)*2-2,2); + if (cont.value.substr(cont.value.length-1,1)==' ') cont.value=cont.value.substr(0,cont.value.length-1); + } + if (e.shiftKey) { + if (keyCode==186) {cont.value += ':';entry=false;} + if (keyCode==188) {cont.value += ',';entry=false;} + if (keyCode==190) {cont.value += '.';entry=false;} + if (keyCode==191) {cont.value += '؟';entry=false;} + if (keyCode==192) {cont.value += 'ّ';entry=false;} + if (keyCode==219) {cont.value += '<';entry=false;} + if (keyCode==221) {cont.value += '>';entry=false;} + } else { + if (keyCode==186||keyCode==59) {cont.value += 'ك';entry=false;} + if (keyCode==188) {cont.value += 'و';entry=false;} + if (keyCode==190) {cont.value += 'ز';entry=false;} + if (keyCode==191) {cont.value += 'ظ';entry=false;} + if (keyCode==192) {cont.value += 'ذ';entry=false;} + if (keyCode==219) {cont.value += 'ج';entry=false;} + if (keyCode==221) {cont.value += 'د';entry=false;} + if (keyCode==222) {cont.value += 'ط';entry=false;} + } + return entry; +} +function hold_it(e){ + if ((document.layers)|(navigator.userAgent.indexOf("MSIE 4")>-1)|(langue!="Arabic")) return true; + + var keyCode; + if (!e) var e = window.event; + if (e.keyCode) keyCode = e.keyCode; + else if (e.which) keyCode = e.which; + var character = String.fromCharCode(keyCode); + switch(keyCode){ + case 186: + case 188: + case 190: + case 191: + case 192: + case 219: + case 221: + case 222: + case 116: + case 59: + case 47: + case 46: + case 44: + case 39: + return false; + case 92: + return true; + } + if (keyCode<63) return true; + return false; + } + +var obj = document.getElementById( 'uni_area' ); +if ( obj && langue=="Arabic"){ + with (navigator) { + if (appName=="Netscape") + obj.onkeypress = hold_it; + } + obj.onkeydown = arkey; +} +// Arabic Keystroke Translator End \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/browser.css b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/browser.css new file mode 100644 index 00000000..32714a87 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/browser.css @@ -0,0 +1,84 @@ +/* + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2005 Frederico Caldeira Knabben + * + * Licensed under the terms of the GNU Lesser General Public License: + * http://www.opensource.org/licenses/lgpl-license.php + * + * For further information visit: + * http://www.fckeditor.net/ + * + * "Support Open Source software. What about a donation today?" + * + * File Name: browser.css + * CSS styles used by all pages that compose the File Browser. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +body +{ + background-color: #f1f1e3; +} + +form +{ + margin: 0px 0px 0px 0px ; + padding: 0px 0px 0px 0px ; +} + +.Frame +{ + background-color: #f1f1e3; + border-color: #f1f1e3; + border-right: thin inset; + border-top: thin inset; + border-left: thin inset; + border-bottom: thin inset; +} + +body.FileArea +{ + + background-color: #ffffff; +} + +body, td, input, select +{ + font-size: 11px; + font-family: 'Microsoft Sans Serif' , Arial, Helvetica, Verdana; +} + +.ActualFolder +{ + font-weight: bold; + font-size: 14px; +} + +.PopupButtons +{ + border-top: #d5d59d 1px solid; + background-color: #e3e3c7; + padding: 7px 10px 7px 10px; +} + +.Button, button +{ + border-right: #737357 1px solid; + border-top: #737357 1px solid; + border-left: #737357 1px solid; + color: #3b3b1f; + border-bottom: #737357 1px solid; + background-color: #c7c78f; +} + +.FolderListCurrentFolder img +{ + background-image: url(images/FolderOpened.gif); +} + +.FolderListFolder img +{ + background-image: url(images/Folder.gif); +} \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/browser.html b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/browser.html new file mode 100644 index 00000000..5b82173d --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/browser.html @@ -0,0 +1,148 @@ + + + + + FCKeditor - Resources Browser + + + + + + + + + + + + + + + + + + + + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/basexml.asp b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/basexml.asp new file mode 100644 index 00000000..7441e488 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/basexml.asp @@ -0,0 +1,58 @@ + +<% + +Sub SetXmlHeaders() + ' Cleans the response buffer. + Response.Clear() + + ' Prevent the browser from caching the result. + Response.CacheControl = "no-cache" + + ' Set the response format. + Response.CharSet = "UTF-8" + Response.ContentType = "text/xml" +End Sub + +Sub CreateXmlHeader( command, resourceType, currentFolder ) + ' Create the XML document header. + Response.Write "" + + ' Create the main "Connector" node. + Response.Write "" + + ' Add the current folder node. + Response.Write "" +End Sub + +Sub CreateXmlFooter() + Response.Write "" +End Sub + +Sub SendError( number, text ) + SetXmlHeaders + + ' Create the XML document header. + Response.Write "" + + Response.Write "" + + Response.End +End Sub +%> \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/class_upload.asp b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/class_upload.asp new file mode 100644 index 00000000..dcfe2ba9 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/class_upload.asp @@ -0,0 +1,230 @@ + +<% +'********************************************** +' File: NetRube_Upload.asp +' Version: NetRube Upload Class Version 2.1 Build 20050228 +' Author: NetRube +' Email: NetRube@126.com +' Date: 02/28/2005 +' Comments: The code for the Upload. +' This can free usage, but please +' not to delete this copyright information. +' If you have a modification version, +' Please send out a duplicate to me. +'********************************************** +' 文件名: NetRube_Upload.asp +' 版本: NetRube Upload Class Version 2.1 Build 20050228 +' 作者: NetRube(网络乡巴佬) +' 电子邮件: NetRube@126.com +' 日期: 2005年02月28日 +' 声明: 文件上传类 +' 本上传类可以自由使用,但请保留此版权声明信息 +' 如果您对本上传类进行修改增强, +' 请发送一份给俺。 +'********************************************** + +Class NetRube_Upload + + Public File, Form + Private oSourceData + Private nMaxSize, nErr, sAllowed, sDenied + + Private Sub Class_Initialize + nErr = 0 + nMaxSize = 1048576 + + Set File = Server.CreateObject("Scripting.Dictionary") + File.CompareMode = 1 + Set Form = Server.CreateObject("Scripting.Dictionary") + Form.CompareMode = 1 + + Set oSourceData = Server.CreateObject("ADODB.Stream") + oSourceData.Type = 1 + oSourceData.Mode = 3 + oSourceData.Open + End Sub + + Private Sub Class_Terminate + Form.RemoveAll + Set Form = Nothing + File.RemoveAll + Set File = Nothing + + oSourceData.Close + Set oSourceData = Nothing + End Sub + + Public Property Get Version + Version = "NetRube Upload Class Version 1.0 Build 20041218" + End Property + + Public Property Get ErrNum + ErrNum = nErr + End Property + + Public Property Let MaxSize(nSize) + nMaxSize = nSize + End Property + + Public Property Let Allowed(sExt) + sAllowed = sExt + End Property + + Public Property Let Denied(sExt) + sDenied = sExt + End Property + + Public Sub GetData + Dim aCType + aCType = Split(Request.ServerVariables("HTTP_CONTENT_TYPE"), ";") + If aCType(0) <> "multipart/form-data" Then + nErr = 1 + Exit Sub + End If + + Dim nTotalSize + nTotalSize = Request.TotalBytes + If nTotalSize < 1 Then + nErr = 2 + Exit Sub + End If + If nMaxSize > 0 And nTotalSize > nMaxSize Then + nErr = 3 + Exit Sub + End If + + oSourceData.Write Request.BinaryRead(nTotalSize) + oSourceData.Position = 0 + + Dim oTotalData, oFormStream, sFormHeader, sFormName, bCrLf, nBoundLen, nFormStart, nFormEnd, nPosStart, nPosEnd, sBoundary + + oTotalData = oSourceData.Read + bCrLf = ChrB(13) & ChrB(10) + sBoundary = MidB(oTotalData, 1, InStrB(1, oTotalData, bCrLf) - 1) + nBoundLen = LenB(sBoundary) + 2 + nFormStart = nBoundLen + + Set oFormStream = Server.CreateObject("ADODB.Stream") + + Do While (nFormStart + 2) < nTotalSize + nFormEnd = InStrB(nFormStart, oTotalData, bCrLf & bCrLf) + 3 + + With oFormStream + .Type = 1 + .Mode = 3 + .Open + oSourceData.Position = nFormStart + oSourceData.CopyTo oFormStream, nFormEnd - nFormStart + .Position = 0 + .Type = 2 + .CharSet = "UTF-8" + sFormHeader = .ReadText + .Close + End With + + nFormStart = InStrB(nFormEnd, oTotalData, sBoundary) - 1 + nPosStart = InStr(22, sFormHeader, " name=", 1) + 7 + nPosEnd = InStr(nPosStart, sFormHeader, """") + sFormName = Mid(sFormHeader, nPosStart, nPosEnd - nPosStart) + + If InStr(45, sFormHeader, " filename=", 1) > 0 Then + Set File(sFormName) = New NetRube_FileInfo + File(sFormName).FormName = sFormName + File(sFormName).Start = nFormEnd + File(sFormName).Size = nFormStart - nFormEnd - 2 + nPosStart = InStr(nPosEnd, sFormHeader, " filename=", 1) + 11 + nPosEnd = InStr(nPosStart, sFormHeader, """") + File(sFormName).ClientPath = Mid(sFormHeader, nPosStart, nPosEnd - nPosStart) + File(sFormName).Name = Mid(File(sFormName).ClientPath, InStrRev(File(sFormName).ClientPath, "\") + 1) + File(sFormName).Ext = LCase(Mid(File(sFormName).Name, InStrRev(File(sFormName).Name, ".") + 1)) + nPosStart = InStr(nPosEnd, sFormHeader, "Content-Type: ", 1) + 14 + nPosEnd = InStr(nPosStart, sFormHeader, vbCr) + File(sFormName).MIME = Mid(sFormHeader, nPosStart, nPosEnd - nPosStart) + Else + With oFormStream + .Type = 1 + .Mode = 3 + .Open + oSourceData.Position = nPosEnd + oSourceData.CopyTo oFormStream, nFormStart - nFormEnd - 2 + .Position = 0 + .Type = 2 + .CharSet = "UTF-8" + Form(sFormName) = .ReadText + .Close + End With + End If + + nFormStart = nFormStart + nBoundLen + Loop + + oTotalData = "" + Set oFormStream = Nothing + End Sub + + Public Sub SaveAs(sItem, sFileName) + If File(sItem).Size < 1 Then + nErr = 2 + Exit Sub + End If + + If Not IsAllowed(File(sItem).Ext) Then + nErr = 4 + Exit Sub + End If + + Dim oFileStream + Set oFileStream = Server.CreateObject("ADODB.Stream") + With oFileStream + .Type = 1 + .Mode = 3 + .Open + oSourceData.Position = File(sItem).Start + oSourceData.CopyTo oFileStream, File(sItem).Size + .Position = 0 + .SaveToFile sFileName, 2 + .Close + End With + Set oFileStream = Nothing + End Sub + + Private Function IsAllowed(sExt) + Dim oRE + Set oRE = New RegExp + oRE.IgnoreCase = True + oRE.Global = True + + If sDenied = "" Then + oRE.Pattern = sAllowed + IsAllowed = (sAllowed = "") Or oRE.Test(sExt) + Else + oRE.Pattern = sDenied + IsAllowed = Not oRE.Test(sExt) + End If + + Set oRE = Nothing + End Function +End Class + +Class NetRube_FileInfo + Dim FormName, ClientPath, Path, Name, Ext, Content, Size, MIME, Start +End Class +%> \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/commands.asp b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/commands.asp new file mode 100644 index 00000000..e4d269ca --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/commands.asp @@ -0,0 +1,179 @@ + +<% +Sub GetFolders( resourceType, currentFolder ) + ' Map the virtual path to the local server path. + Dim sServerDir + sServerDir = ServerMapFolder( resourceType, currentFolder ) + + ' Open the "Folders" node. + Response.Write "" + + Dim oFSO, oCurrentFolder, oFolders, oFolder + Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" ) + Set oCurrentFolder = oFSO.GetFolder( sServerDir ) + Set oFolders = oCurrentFolder.SubFolders + + For Each oFolder in oFolders + Response.Write "" + Next + + Set oFSO = Nothing + + ' Close the "Folders" node. + Response.Write "" +End Sub + +Sub GetFoldersAndFiles( resourceType, currentFolder ) + ' Map the virtual path to the local server path. + Dim sServerDir + sServerDir = ServerMapFolder( resourceType, currentFolder ) + + Dim oFSO, oCurrentFolder, oFolders, oFolder, oFiles, oFile + Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" ) + Set oCurrentFolder = oFSO.GetFolder( sServerDir ) + Set oFolders = oCurrentFolder.SubFolders + Set oFiles = oCurrentFolder.Files + + ' Open the "Folders" node. + Response.Write "" + + For Each oFolder in oFolders + Response.Write "" + Next + + ' Close the "Folders" node. + Response.Write "" + + ' Open the "Files" node. + Response.Write "" + + For Each oFile in oFiles + Dim iFileSize + iFileSize = Round( oFile.size / 1024 ) + If ( iFileSize < 1 AND oFile.size <> 0 ) Then iFileSize = 1 + + Response.Write "" + Next + + ' Close the "Files" node. + Response.Write "" +End Sub + +Sub CreateFolder( resourceType, currentFolder ) + Dim sErrorNumber + + Dim sNewFolderName + sNewFolderName = Request.QueryString( "NewFolderName" ) + + If ( sNewFolderName = "" OR InStr( 1, sNewFolderName, ".." ) > 0 ) Then + sErrorNumber = "102" + Else + ' Map the virtual path to the local server path of the current folder. + Dim sServerDir + sServerDir = ServerMapFolder( resourceType, currentFolder & "/" & sNewFolderName ) + + On Error Resume Next + + CreateServerFolder sServerDir + + Dim iErrNumber, sErrDescription + iErrNumber = err.number + sErrDescription = err.Description + + On Error Goto 0 + + Select Case iErrNumber + Case 0 + sErrorNumber = "0" + Case 52 + sErrorNumber = "102" ' Invalid Folder Name. + Case 70 + sErrorNumber = "103" ' Security Error. + Case 76 + sErrorNumber = "102" ' Path too long. + Case Else + sErrorNumber = "110" + End Select + End If + + ' Create the "Error" node. + Response.Write "" +End Sub + +Sub FileUpload( resourceType, currentFolder ) + Dim oUploader + Set oUploader = New NetRube_Upload + oUploader.MaxSize = 0 + oUploader.Allowed = ConfigAllowedExtensions.Item( resourceType ) + oUploader.Denied = ConfigDeniedExtensions.Item( resourceType ) + oUploader.GetData + + Dim sErrorNumber + sErrorNumber = "0" + + Dim sFileName, sOriginalFileName, sExtension + sFileName = "" + + If oUploader.ErrNum > 1 Then + sErrorNumber = "202" + Else + ' Map the virtual path to the local server path. + Dim sServerDir + sServerDir = ServerMapFolder( resourceType, currentFolder ) + + Dim oFSO + Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" ) + + ' Get the uploaded file name. + sFileName = oUploader.File( "NewFile" ).Name + sExtension = oUploader.File( "NewFile" ).Ext + sOriginalFileName = sFileName + + Dim iCounter + iCounter = 0 + + Do While ( True ) + Dim sFilePath + sFilePath = sServerDir & sFileName + + If ( oFSO.FileExists( sFilePath ) ) Then + iCounter = iCounter + 1 + sFileName = RemoveExtension( sOriginalFileName ) & "(" & iCounter & ")." & sExtension + sErrorNumber = "201" + Else + oUploader.SaveAs "NewFile", sFilePath + If oUploader.ErrNum > 0 Then sErrorNumber = "202" + Exit Do + End If + Loop + End If + + Set oUploader = Nothing + + Response.Clear + + Response.Write "" + + Response.End +End Sub +%> \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/config.asp b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/config.asp new file mode 100644 index 00000000..802a89fa --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/config.asp @@ -0,0 +1,45 @@ + +<% + +' SECURITY: You must explicitelly enable this "connector" (set it to "True"). +Dim ConfigIsEnabled +ConfigIsEnabled = False + +' Path to user files relative to the document root. +Dim ConfigUserFilesPath +ConfigUserFilesPath = "/UserFiles/" + +Dim ConfigAllowedExtensions, ConfigDeniedExtensions +Set ConfigAllowedExtensions = CreateObject( "Scripting.Dictionary" ) +Set ConfigDeniedExtensions = CreateObject( "Scripting.Dictionary" ) + +ConfigAllowedExtensions.Add "File", "" +ConfigDeniedExtensions.Add "File", "php|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|com|dll|vbs|js|reg" + +ConfigAllowedExtensions.Add "Image", "jpg|gif|jpeg|png|bmp" +ConfigDeniedExtensions.Add "Image", "" + +ConfigAllowedExtensions.Add "Flash", "swf|fla" +ConfigDeniedExtensions.Add "Flash", "" + +ConfigAllowedExtensions.Add "Media", "swf|fla|jpg|gif|jpeg|png|avi|mpg|mpeg|mp(1-4)|wma|wmv|wav|mid|midi|rmi|rm|ram|rmvb|mov|qt" +ConfigDeniedExtensions.Add "Media", "" + +%> \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/connector.asp b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/connector.asp new file mode 100644 index 00000000..e11c9235 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/connector.asp @@ -0,0 +1,119 @@ +<%@ CodePage=65001 Language="VBScript"%> +<% +Option Explicit +%> + + + + + + + +<% + +If ( ConfigIsEnabled = False ) Then + SendError 1, "This connector is disabled. Please check the ""editor/filemanager/browser/default/connectors/asp/config.asp"" file" +End If + +' Get the "UserFiles" path. +Dim sUserFilesPath + +If ( Not IsEmpty( ConfigUserFilesPath ) ) Then + sUserFilesPath = ConfigUserFilesPath + + If ( Right( sUserFilesPath, 1 ) <> "/" ) Then + sUserFilesPath = sUserFilesPath & "/" + End If +Else + sUserFilesPath = "/UserFiles/" +End If + +' Map the "UserFiles" path to a local directory. +Dim sUserFilesDirectory +sUserFilesDirectory = Server.MapPath( sUserFilesPath ) + +If ( Right( sUserFilesDirectory, 1 ) <> "\" ) Then + sUserFilesDirectory = sUserFilesDirectory & "\" +End If + +DoResponse + +Sub DoResponse() + Dim sCommand, sResourceType, sCurrentFolder + + ' Get the main request information. + sCommand = Request.QueryString("Command") + If ( sCommand = "" ) Then Exit Sub + + sResourceType = Request.QueryString("Type") + If ( sResourceType = "" ) Then Exit Sub + + sCurrentFolder = Request.QueryString("CurrentFolder") + If ( sCurrentFolder = "" ) Then Exit Sub + + ' Check if it is an allower resource type. + if ( Not IsAllowedType( sResourceType ) ) Then Exit Sub + + ' Check the current folder syntax (must begin and start with a slash). + If ( Right( sCurrentFolder, 1 ) <> "/" ) Then sCurrentFolder = sCurrentFolder & "/" + If ( Left( sCurrentFolder, 1 ) <> "/" ) Then sCurrentFolder = "/" & sCurrentFolder + + ' Check for invalid folder paths (..) + If ( InStr( 1, sCurrentFolder, ".." ) <> 0 OR InStr( 1, sResourceType, ".." ) <> 0 ) Then + SendError 102, "" + End If + + ' File Upload doesn't have to Return XML, so it must be intercepted before anything. + If ( sCommand = "FileUpload" ) Then + FileUpload sResourceType, sCurrentFolder + Exit Sub + End If + + SetXmlHeaders + + CreateXmlHeader sCommand, sResourceType, sCurrentFolder + + ' Execute the required command. + Select Case sCommand + Case "GetFolders" + GetFolders sResourceType, sCurrentFolder + Case "GetFoldersAndFiles" + GetFoldersAndFiles sResourceType, sCurrentFolder + Case "CreateFolder" + CreateFolder sResourceType, sCurrentFolder + End Select + + CreateXmlFooter + + Response.End +End Sub + +Function IsAllowedType( resourceType ) + Dim oRE + Set oRE = New RegExp + oRE.IgnoreCase = True + oRE.Global = True + oRE.Pattern = "^(File|Image|Flash|Media)$" + + IsAllowedType = oRE.Test( resourceType ) + + Set oRE = Nothing +End Function +%> \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/io.asp b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/io.asp new file mode 100644 index 00000000..572a5ec2 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/io.asp @@ -0,0 +1,85 @@ + +<% +Function GetUrlFromPath( resourceType, folderPath ) + If resourceType = "" Then + GetUrlFromPath = RemoveFromEnd( sUserFilesPath, "/" ) & folderPath + Else + GetUrlFromPath = sUserFilesPath & resourceType & folderPath + End If +End Function + +Function RemoveExtension( fileName ) + RemoveExtension = Left( fileName, InStrRev( fileName, "." ) - 1 ) +End Function + +Function ServerMapFolder( resourceType, folderPath ) + ' Get the resource type directory. + Dim sResourceTypePath + sResourceTypePath = sUserFilesDirectory & resourceType & "\" + + ' Ensure that the directory exists. + CreateServerFolder sResourceTypePath + + ' Return the resource type directory combined with the required path. + ServerMapFolder = sResourceTypePath & RemoveFromStart( folderPath, "/" ) +End Function + +Sub CreateServerFolder( folderPath ) + Dim oFSO + Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" ) + + Dim sParent + sParent = oFSO.GetParentFolderName( folderPath ) + + ' Check if the parent exists, or create it. + If ( NOT oFSO.FolderExists( sParent ) ) Then CreateServerFolder( sParent ) + + If ( oFSO.FolderExists( folderPath ) = False ) Then + oFSO.CreateFolder( folderPath ) + End If + + Set oFSO = Nothing +End Sub + +Function IsAllowedExt( extension, resourceType ) + Dim oRE + Set oRE = New RegExp + oRE.IgnoreCase = True + oRE.Global = True + + Dim sAllowed, sDenied + sAllowed = ConfigAllowedExtensions.Item( resourceType ) + sDenied = ConfigDeniedExtensions.Item( resourceType ) + + IsAllowedExt = True + + If sDenied <> "" Then + oRE.Pattern = sDenied + IsAllowedExt = Not oRE.Test( extension ) + End If + + If IsAllowedExt And sAllowed <> "" Then + oRE.Pattern = sAllowed + IsAllowedExt = oRE.Test( extension ) + End If + + Set oRE = Nothing +End Function +%> \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/util.asp b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/util.asp new file mode 100644 index 00000000..e5dd3044 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/asp/util.asp @@ -0,0 +1,51 @@ + +<% +Function RemoveFromStart( sourceString, charToRemove ) + Dim oRegex + Set oRegex = New RegExp + oRegex.Pattern = "^" & charToRemove & "+" + + RemoveFromStart = oRegex.Replace( sourceString, "" ) +End Function + +Function RemoveFromEnd( sourceString, charToRemove ) + Dim oRegex + Set oRegex = New RegExp + oRegex.Pattern = charToRemove & "+$" + + RemoveFromEnd = oRegex.Replace( sourceString, "" ) +End Function + +Function ConvertToXmlAttribute( value ) + ConvertToXmlAttribute = Replace( value, "&", "&" ) +End Function + +Function InArray( value, sourceArray ) + Dim i + For i = 0 to UBound( sourceArray ) + If sourceArray(i) = value Then + InArray = True + Exit Function + End If + Next + InArray = False +End Function + +%> \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/aspx/connector.aspx b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/aspx/connector.aspx new file mode 100644 index 00000000..e27bcef2 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/aspx/connector.aspx @@ -0,0 +1,26 @@ +<%@ Page language="c#" Inherits="FredCK.FCKeditorV2.FileBrowserConnector" AutoEventWireup="false" %> +<%-- + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2005 Frederico Caldeira Knabben + * + * Licensed under the terms of the GNU Lesser General Public License: + * http://www.opensource.org/licenses/lgpl-license.php + * + * For further information visit: + * http://www.fckeditor.net/ + * + * "Support Open Source software. What about a donation today?" + * + * File Name: connector.aspx + * This is the File Browser Connector for ASP.NET. + * + * The code of this page if included in the FCKeditor.Net package, + * in the FredCK.FCKeditorV2.dll assemblyfile. So to use it you must + * include that DLL in your "bin" directory. + * + * To download the FCKeditor.Net package, go to our official web site: + * http://www.fckeditor.net + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) +--%> \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/cfm/config.cfm b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/cfm/config.cfm new file mode 100644 index 00000000..1a744988 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/cfm/config.cfm @@ -0,0 +1,80 @@ + + + + config = structNew(); + + // SECURITY: You must explicitly enable this "connector". (Set enabled to "true") + config.enabled = false; + + config.userFilesPath = "/UserFiles/"; + + config.serverPath = ""; // use this to force the server path if FCKeditor is not running directly off the root of the application or the FCKeditor directory in the URL is a virtual directory or a symbolic link / junction + + config.allowedExtensions = structNew(); + config.deniedExtensions = structNew(); + + // config.allowedExtensions["File"] = "doc,rtf,pdf,ppt,pps,xls,csv,vnd,zip"; + config.allowedExtensions["File"] = ""; + config.deniedExtensions["File"] = "php,asp,aspx,ascx,jsp,cfm,cfc,pl,bat,exe,com,dll,vbs,js,reg"; + + config.allowedExtensions["Image"] = "png,gif,jpg,jpeg,bmp"; + config.deniedExtensions["Image"] = ""; + + config.allowedExtensions["Flash"] = "swf,fla"; + config.deniedExtensions["Flash"] = ""; + + config.allowedExtensions["Media"] = "swf,fla,jpg,gif,jpeg,png,avi,mpg,mpeg,mp3,mp4,m4a,wma,wmv,wav,mid,midi,rmi,rm,ram,rmvb,mov,qt"; + config.deniedExtensions["Media"] = ""; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + function structCopyKeys(stFrom, stTo) { + for ( key in stFrom ) { + if ( isStruct(stFrom[key]) ) { + structCopyKeys(stFrom[key],stTo[key]); + } else { + stTo[key] = stFrom[key]; + } + } + } + structCopyKeys(FCKeditor, config); + + + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/cfm/connector.cfm b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/cfm/connector.cfm new file mode 100644 index 00000000..d10793c6 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/cfm/connector.cfm @@ -0,0 +1,364 @@ + + + + + + + + + + + + userFilesPath = config.userFilesPath; + lAllowedExtensions = config.allowedExtensions[url.type]; + lDeniedExtensions = config.deniedExtensions[url.type]; + + // make sure the user files path is correctly formatted + userFilesPath = replace(userFilesPath, "\", "/", "ALL"); + userFilesPath = replace(userFilesPath, '//', '/', 'ALL'); + if ( right(userFilesPath,1) neq "/" ) { + userFilesPath = userFilesPath & "/"; + } + if ( left(userFilesPath,1) neq "/" ) { + userFilesPath = "/" & userFilesPath; + } + + // make sure the current folder is correctly formatted + url.currentFolder = replace(url.currentFolder, "\", "/", "ALL"); + url.currentFolder = replace(url.currentFolder, '//', '/', 'ALL'); + if ( right(url.currentFolder,1) neq "/" ) { + url.currentFolder = url.currentFolder & "/"; + } + if ( left(url.currentFolder,1) neq "/" ) { + url.currentFolder = "/" & url.currentFolder; + } + + if ( find("/",getBaseTemplatePath()) neq 0 ) { + fs = "/"; + } else { + fs = "\"; + } + + // Get the base physical path to the web root for this application. The code to determine the path automatically assumes that + // the "FCKeditor" directory in the http request path is directly off the web root for the application and that it's not a + // virtual directory or a symbolic link / junction. Use the serverPath config setting to force a physical path if necessary. + if ( len(config.serverPath) ) { + serverPath = config.serverPath; + } else { + serverPath = replaceNoCase(getBaseTemplatePath(),replace(cgi.script_name,"/",fs,"all"),""); + } + + // map the user files path to a physical directory + userFilesServerPath = serverPath & replace(userFilesPath,"/",fs,"all"); + + xmlContent = ""; // append to this string to build content + + + + + "> + + + + "> + + + + + + + + + + + + + + + + + + + + + + + + + + + + "> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + errorNumber = 0; + fileName = cffile.ClientFileName; + fileExt = cffile.ServerFileExt; + + // munge filename for html download. Only a-z, 0-9, _, - and . are allowed + if( reFind("[^A-Za-z0-9_\-\.]", fileName) ) { + fileName = reReplace(fileName, "[^A-Za-z0-9\-\.]", "_", "ALL"); + fileName = reReplace(fileName, "_{2,}", "_", "ALL"); + fileName = reReplace(fileName, "([^_]+)_+$", "\1", "ALL"); + fileName = reReplace(fileName, "$_([^_]+)$", "\1", "ALL"); + } + + // When the original filename already exists, add numbers (0), (1), (2), ... at the end of the filename. + if( compare( cffile.ServerFileName, fileName ) ) { + counter = 0; + tmpFileName = fileName; + while( fileExists("#currentFolderPath##fileName#.#fileExt#") ) { + counter = counter + 1; + fileName = tmpFileName & '(#counter#)'; + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + i=1; + folders = ""; + while( i lte qDir.recordCount ) { + if( not compareNoCase( qDir.type[i], "FILE" )) + break; + if( not listFind(".,..", qDir.name[i]) ) + folders = folders & ''; + i=i+1; + } + + xmlContent = xmlContent & '' & folders & ''; + + + + + + + + + + + + i=1; + folders = ""; + files = ""; + while( i lte qDir.recordCount ) { + if( not compareNoCase( qDir.type[i], "DIR" ) and not listFind(".,..", qDir.name[i]) ) { + folders = folders & ''; + } else if( not compareNoCase( qDir.type[i], "FILE" ) ) { + fileSizeKB = round(qDir.size[i] / 1024); + files = files & ''; + } + i=i+1; + } + + xmlContent = xmlContent & '' & folders & ''; + xmlContent = xmlContent & '' & files & ''; + + + + + + + + + + + newFolderName = url.newFolderName; + if( reFind("[^A-Za-z0-9_\-\.]", newFolderName) ) { + // Munge folder name same way as we do the filename + // This means folder names are always US-ASCII so we don't have to worry about CF5 and UTF-8 + newFolderName = reReplace(newFolderName, "[^A-Za-z0-9\-\.]", "_", "all"); + newFolderName = reReplace(newFolderName, "_{2,}", "_", "all"); + newFolderName = reReplace(newFolderName, "([^_]+)_+$", "\1", "all"); + newFolderName = reReplace(newFolderName, "$_([^_]+)$", "\1", "all"); + } + + + + + + + + + + + + + + + + + + + + + '> + + + + + + + + + + + + + + + + + xmlHeader = ''; + xmlHeader = xmlHeader & ''; + xmlFooter = ''; + + + + + + +#xmlHeader##xmlContent##xmlFooter# \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/perl/basexml.pl b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/perl/basexml.pl new file mode 100644 index 00000000..b888f2e5 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/perl/basexml.pl @@ -0,0 +1,59 @@ +##### +# FCKeditor - The text editor for internet +# Copyright (C) 2003-2005 Frederico Caldeira Knabben +# +# Licensed under the terms of the GNU Lesser General Public License: +# http://www.opensource.org/licenses/lgpl-license.php +# +# For further information visit: +# http://www.fckeditor.net/ +# +# "Support Open Source software. What about a donation today?" +# +# File Name: basexml.pl +# This is the File Manager Connector for Perl. +# +# File Authors: +# Takashi Yamaguchi (jack@omakase.net) +##### + +sub CreateXmlHeader +{ + local($command,$resourceType,$currentFolder) = @_; + + # Create the XML document header. + print ''; + + # Create the main "Connector" node. + print ''; + + # Add the current folder node. + print ''; +} + +sub CreateXmlFooter +{ + print ''; +} + +sub SendError +{ + local( $number, $text ) = @_; + + print << "_HTML_HEAD_"; +Content-Type:text/xml; charset=utf-8 +Pragma: no-cache +Cache-Control: no-cache +Expires: Thu, 01 Dec 1994 16:00:00 GMT + +_HTML_HEAD_ + + # Create the XML document header + print '' ; + + print '' ; + + exit ; +} + +1; diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/perl/commands.pl b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/perl/commands.pl new file mode 100644 index 00000000..a8b49a78 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/perl/commands.pl @@ -0,0 +1,154 @@ +##### +# FCKeditor - The text editor for internet +# Copyright (C) 2003-2005 Frederico Caldeira Knabben +# +# Licensed under the terms of the GNU Lesser General Public License: +# http://www.opensource.org/licenses/lgpl-license.php +# +# For further information visit: +# http://www.fckeditor.net/ +# +# "Support Open Source software. What about a donation today?" +# +# File Name: commands.pl +# This is the File Manager Connector for Perl. +# +# File Authors: +# Takashi Yamaguchi (jack@omakase.net) +##### + +sub GetFolders +{ + + local($resourceType, $currentFolder) = @_; + + # Map the virtual path to the local server path. + $sServerDir = &ServerMapFolder($resourceType, $currentFolder); + print ""; # Open the "Folders" node. + + opendir(DIR,"$sServerDir"); + @files = grep(!/^\.\.?$/,readdir(DIR)); + closedir(DIR); + + foreach $sFile (@files) { + if($sFile != '.' && $sFile != '..' && (-d "$sServerDir$sFile")) { + $cnv_filename = &ConvertToXmlAttribute($sFile); + print ''; + } + } + print ""; # Close the "Folders" node. +} + +sub GetFoldersAndFiles +{ + + local($resourceType, $currentFolder) = @_; + # Map the virtual path to the local server path. + $sServerDir = &ServerMapFolder($resourceType,$currentFolder); + + # Initialize the output buffers for "Folders" and "Files". + $sFolders = ''; + $sFiles = ''; + + opendir(DIR,"$sServerDir"); + @files = grep(!/^\.\.?$/,readdir(DIR)); + closedir(DIR); + + foreach $sFile (@files) { + if($sFile ne '.' && $sFile ne '..') { + if(-d "$sServerDir$sFile") { + $cnv_filename = &ConvertToXmlAttribute($sFile); + $sFolders .= '' ; + } else { + ($iFileSize,$refdate,$filedate,$fileperm) = (stat("$sServerDir$sFile"))[7,8,9,2]; + if($iFileSize > 0) { + $iFileSize = int($iFileSize / 1024); + if($iFileSize < 1) { + $iFileSize = 1; + } + } + $cnv_filename = &ConvertToXmlAttribute($sFile); + $sFiles .= '' ; + } + } + } + print $sFolders ; + print ''; # Close the "Folders" node. + print $sFiles ; + print ''; # Close the "Files" node. +} + +sub CreateFolder +{ + + local($resourceType, $currentFolder) = @_; + $sErrorNumber = '0' ; + $sErrorMsg = '' ; + + if($FORM{'NewFolderName'} ne "") { + $sNewFolderName = $FORM{'NewFolderName'}; + # Map the virtual path to the local server path of the current folder. + $sServerDir = &ServerMapFolder($resourceType, $currentFolder); + if(-w $sServerDir) { + $sServerDir .= $sNewFolderName; + $sErrorMsg = &CreateServerFolder($sServerDir); + if($sErrorMsg == 0) { + $sErrorNumber = '0'; + } elsif($sErrorMsg eq 'Invalid argument' || $sErrorMsg eq 'No such file or directory') { + $sErrorNumber = '102'; #// Path too long. + } else { + $sErrorNumber = '110'; + } + } else { + $sErrorNumber = '103'; + } + } else { + $sErrorNumber = '102' ; + } + # Create the "Error" node. + $cnv_errmsg = &ConvertToXmlAttribute($sErrorMsg); + print ''; +} + +sub FileUpload +{ +eval("use File::Copy;"); + + local($resourceType, $currentFolder) = @_; + + $sErrorNumber = '0' ; + $sFileName = '' ; + if($new_fname) { + # Map the virtual path to the local server path. + $sServerDir = &ServerMapFolder($resourceType,$currentFolder); + + # Get the uploaded file name. + $sFileName = $new_fname; + $sOriginalFileName = $sFileName; + + $iCounter = 0; + while(1) { + $sFilePath = $sServerDir . $sFileName; + if(-e $sFilePath) { + $iCounter++ ; + ($path,$BaseName,$ext) = &RemoveExtension($sOriginalFileName); + $sFileName = $BaseName . '(' . $iCounter . ').' . $ext; + $sErrorNumber = '201'; + } else { + copy("$img_dir/$new_fname","$sFilePath"); + chmod(0777,$sFilePath); + unlink("$img_dir/$new_fname"); + last; + } + } + } else { + $sErrorNumber = '202' ; + } + $sFileName =~ s/"/\\"/g; + print "Content-type: text/html\n\n"; + print ''; + exit ; +} +1; diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/perl/connector.cgi b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/perl/connector.cgi new file mode 100644 index 00000000..530cfd26 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/perl/connector.cgi @@ -0,0 +1,134 @@ +#!/usr/bin/env perl + +##### +# FCKeditor - The text editor for internet +# Copyright (C) 2003-2005 Frederico Caldeira Knabben +# +# Licensed under the terms of the GNU Lesser General Public License: +# http://www.opensource.org/licenses/lgpl-license.php +# +# For further information visit: +# http://www.fckeditor.net/ +# +# "Support Open Source software. What about a donation today?" +# +# File Name: connector.cgi +# This is the File Manager Connector for Perl. +# +# File Authors: +# Takashi Yamaguchi (jack@omakase.net) +# Frederico Caldeira Knabben (fredck@fckeditor.net) +##### + +## +# ATTENTION: To enable this connector, look for the "SECURITY" comment in this file. +## + +## START: Hack for Windows (Not important to understand the editor code... Perl specific). +if(Windows_check()) { + chdir(GetScriptPath($0)); +} + +sub Windows_check +{ + # IIS,PWS(NT/95) + $www_server_os = $^O; + # Win98 & NT(SP4) + if($www_server_os eq "") { $www_server_os= $ENV{'OS'}; } + # AnHTTPd/Omni/IIS + if($ENV{'SERVER_SOFTWARE'} =~ /AnWeb|Omni|IIS\//i) { $www_server_os= 'win'; } + # Win Apache + if($ENV{'WINDIR'} ne "") { $www_server_os= 'win'; } + if($www_server_os=~ /win/i) { return(1); } + return(0); +} + +sub GetScriptPath { + local($path) = @_; + if($path =~ /[\:\/\\]/) { $path =~ s/(.*?)[\/\\][^\/\\]+$/$1/; } else { $path = '.'; } + $path; +} +## END: Hack for IIS + +require 'util.pl'; +require 'io.pl'; +require 'basexml.pl'; +require 'commands.pl'; +require 'upload_fck.pl'; + +## +# SECURITY: REMOVE/COMMENT THE FOLLOWING LINE TO ENABLE THIS CONNECTOR. +## +&SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/browser/default/connectors/perl/connector.cgi" file' ) ; + + &read_input(); + + if($FORM{'ServerPath'} ne "") { + $GLOBALS{'UserFilesPath'} = $FORM{'ServerPath'}; + if(!($GLOBALS{'UserFilesPath'} =~ /\/$/)) { + $GLOBALS{'UserFilesPath'} .= '/' ; + } + } else { + $GLOBALS{'UserFilesPath'} = '/UserFiles/'; + } + + # Map the "UserFiles" path to a local directory. + $rootpath = &GetRootPath(); + $GLOBALS{'UserFilesDirectory'} = $rootpath . $GLOBALS{'UserFilesPath'}; + + &DoResponse(); + +sub DoResponse +{ + + if($FORM{'Command'} eq "" || $FORM{'Type'} eq "" || $FORM{'CurrentFolder'} eq "") { + return ; + } + # Get the main request informaiton. + $sCommand = $FORM{'Command'}; + $sResourceType = $FORM{'Type'}; + $sCurrentFolder = $FORM{'CurrentFolder'}; + + # Check the current folder syntax (must begin and start with a slash). + if(!($sCurrentFolder =~ /\/$/)) { + $sCurrentFolder .= '/'; + } + if(!($sCurrentFolder =~ /^\//)) { + $sCurrentFolder = '/' . $sCurrentFolder; + } + + # Check for invalid folder paths (..) + if ( $sCurrentFolder =~ /\.\./ ) { + SendError( 102, "" ) ; + } + + # File Upload doesn't have to Return XML, so it must be intercepted before anything. + if($sCommand eq 'FileUpload') { + FileUpload($sResourceType,$sCurrentFolder); + return ; + } + + print << "_HTML_HEAD_"; +Content-Type:text/xml; charset=utf-8 +Pragma: no-cache +Cache-Control: no-cache +Expires: Thu, 01 Dec 1994 16:00:00 GMT + +_HTML_HEAD_ + + &CreateXmlHeader($sCommand,$sResourceType,$sCurrentFolder); + + # Execute the required command. + if($sCommand eq 'GetFolders') { + &GetFolders($sResourceType,$sCurrentFolder); + } elsif($sCommand eq 'GetFoldersAndFiles') { + &GetFoldersAndFiles($sResourceType,$sCurrentFolder); + } elsif($sCommand eq 'CreateFolder') { + &CreateFolder($sResourceType,$sCurrentFolder); + } + + &CreateXmlFooter(); + + exit ; +} + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/perl/io.pl b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/perl/io.pl new file mode 100644 index 00000000..63557ce3 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/perl/io.pl @@ -0,0 +1,127 @@ +##### +# FCKeditor - The text editor for internet +# Copyright (C) 2003-2005 Frederico Caldeira Knabben +# +# Licensed under the terms of the GNU Lesser General Public License: +# http://www.opensource.org/licenses/lgpl-license.php +# +# For further information visit: +# http://www.fckeditor.net/ +# +# "Support Open Source software. What about a donation today?" +# +# File Name: io.pl +# This is the File Manager Connector for Perl. +# +# File Authors: +# Takashi Yamaguchi (jack@omakase.net) +##### + +sub GetUrlFromPath +{ + local($resourceType, $folderPath) = @_; + + if($resourceType eq '') { + $rmpath = &RemoveFromEnd($GLOBALS{'UserFilesPath'},'/'); + return("$rmpath$folderPath"); + } else { + return("$GLOBALS{'UserFilesPath'}$resourceType$folderPath"); + } +} + +sub RemoveExtension +{ + local($fileName) = @_; + local($path, $base, $ext); + if($fileName !~ /\./) { + $fileName .= '.'; + } + if($fileName =~ /([^\\\/]*)\.(.*)$/) { + $base = $1; + $ext = $2; + if($fileName =~ /(.*)$base\.$ext$/) { + $path = $1; + } + } + return($path,$base,$ext); + +} + +sub ServerMapFolder +{ + local($resourceType,$folderPath) = @_; + + # Get the resource type directory. + $sResourceTypePath = $GLOBALS{'UserFilesDirectory'} . $resourceType . '/'; + + # Ensure that the directory exists. + &CreateServerFolder($sResourceTypePath); + + # Return the resource type directory combined with the required path. + $rmpath = &RemoveFromStart($folderPath,'/'); + return("$sResourceTypePath$rmpath"); +} + +sub GetParentFolder +{ + local($folderPath) = @_; + + $folderPath =~ s/[\/][^\/]+[\/]?$//g; + return $folderPath; +} + +sub CreateServerFolder +{ + local($folderPath) = @_; + + $sParent = &GetParentFolder($folderPath); + # Check if the parent exists, or create it. + if(!(-e $sParent)) { + $sErrorMsg = &CreateServerFolder($sParent); + if($sErrorMsg == 1) { + return(1); + } + } + if(!(-e $folderPath)) { + umask(000); + mkdir("$folderPath",0777); + chmod(0777,"$folderPath"); + return(0); + } else { + return(1); + } +} + +sub GetRootPath +{ +#use Cwd; + +# my $dir = getcwd; +# print $dir; +# $dir =~ s/$ENV{'DOCUMENT_ROOT'}//g; +# print $dir; +# return($dir); + +# $wk = $0; +# $wk =~ s/\/connector\.cgi//g; +# if($wk) { +# $current_dir = $wk; +# } else { +# $current_dir = `pwd`; +# } +# return($current_dir); +use Cwd; + + if($ENV{'DOCUMENT_ROOT'}) { + $dir = $ENV{'DOCUMENT_ROOT'}; + } else { + my $dir = getcwd; + $workdir =~ s/\/connector\.cgi//g; + $dir =~ s/$workdir//g; + } + return($dir); + + + +} +1; diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/perl/upload_fck.pl b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/perl/upload_fck.pl new file mode 100644 index 00000000..21f34a0f --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/perl/upload_fck.pl @@ -0,0 +1,663 @@ +##### +# FCKeditor - The text editor for internet +# Copyright (C) 2003-2005 Frederico Caldeira Knabben +# +# Licensed under the terms of the GNU Lesser General Public License: +# http://www.opensource.org/licenses/lgpl-license.php +# +# For further information visit: +# http://www.fckeditor.net/ +# +# "Support Open Source software. What about a donation today?" +# +# File Name: upload_fck.pl +# This is the File Manager Connector for Perl. +# +# File Authors: +# Takashi Yamaguchi (jack@omakase.net) +##### + +# image data save dir +$img_dir = './temp/'; + + +# File size max(unit KB) +$MAX_CONTENT_SIZE = 30000; + +# Filelock (1=use,0=not use) +$PM{'flock'} = '1'; + + +# upload Content-Type list +my %UPLOAD_CONTENT_TYPE_LIST = ( + 'image/(x-)?png' => 'png', # PNG image + 'image/p?jpe?g' => 'jpg', # JPEG image + 'image/gif' => 'gif', # GIF image + 'image/x-xbitmap' => 'xbm', # XBM image + + 'image/(x-(MS-)?)?bmp' => 'bmp', # Windows BMP image + 'image/pict' => 'pict', # Macintosh PICT image + 'image/tiff' => 'tif', # TIFF image + 'application/pdf' => 'pdf', # PDF image + 'application/x-shockwave-flash' => 'swf', # Shockwave Flash + + 'video/(x-)?msvideo' => 'avi', # Microsoft Video + 'video/quicktime' => 'mov', # QuickTime Video + 'video/mpeg' => 'mpeg', # MPEG Video + 'video/x-mpeg2' => 'mpv2', # MPEG2 Video + + 'audio/(x-)?midi?' => 'mid', # MIDI Audio + 'audio/(x-)?wav' => 'wav', # WAV Audio + 'audio/basic' => 'au', # ULAW Audio + 'audio/mpeg' => 'mpga', # MPEG Audio + + 'application/(x-)?zip(-compressed)?' => 'zip', # ZIP Compress + + 'text/html' => 'html', # HTML + 'text/plain' => 'txt', # TEXT + '(?:application|text)/(?:rtf|richtext)' => 'rtf', # RichText + + 'application/msword' => 'doc', # Microsoft Word + 'application/vnd.ms-excel' => 'xls', # Microsoft Excel + + '' +); + +# Upload is permitted. +# A regular expression is possible. +my %UPLOAD_EXT_LIST = ( + 'png' => 'PNG image', + 'p?jpe?g|jpe|jfif|pjp' => 'JPEG image', + 'gif' => 'GIF image', + 'xbm' => 'XBM image', + + 'bmp|dib|rle' => 'Windows BMP image', + 'pi?ct' => 'Macintosh PICT image', + 'tiff?' => 'TIFF image', + 'pdf' => 'PDF image', + 'swf' => 'Shockwave Flash', + + 'avi' => 'Microsoft Video', + 'moo?v|qt' => 'QuickTime Video', + 'm(p(e?gv?|e|v)|1v)' => 'MPEG Video', + 'mp(v2|2v)' => 'MPEG2 Video', + + 'midi?|kar|smf|rmi|mff' => 'MIDI Audio', + 'wav' => 'WAVE Audio', + 'au|snd' => 'ULAW Audio', + 'mp(e?ga|2|a|3)|abs' => 'MPEG Audio', + + 'zip' => 'ZIP Compress', + 'lzh' => 'LZH Compress', + 'cab' => 'CAB Compress', + + 'd?html?' => 'HTML', + 'rtf|rtx' => 'RichText', + 'txt|text' => 'Text', + + '' +); + + +# sjis or euc +my $CHARCODE = 'sjis'; + +$TRANS_2BYTE_CODE = 0; + +############################################################################## +# Summary +# +# Form Read input +# +# Parameters +# Returns +# Memo +############################################################################## +sub read_input +{ +eval("use File::Copy;"); +eval("use File::Path;"); + + my ($FORM) = @_; + + + mkdir($img_dir,0777); + chmod(0777,$img_dir); + + undef $img_data_exists; + undef @NEWFNAMES; + undef @NEWFNAME_DATA; + + if($ENV{'CONTENT_LENGTH'} > 10000000 || $ENV{'CONTENT_LENGTH'} > $MAX_CONTENT_SIZE * 1024) { + &upload_error( + 'Size Error', + sprintf( + "Transmitting size is too large.MAX %d KB Now Size %d KB(%d bytes Over)", + $MAX_CONTENT_SIZE, + int($ENV{'CONTENT_LENGTH'} / 1024), + $ENV{'CONTENT_LENGTH'} - $MAX_CONTENT_SIZE * 1024 + ) + ); + } + + my $Buffer; + if($ENV{'CONTENT_TYPE'} =~ /multipart\/form-data/) { + # METHOD POST only + return unless($ENV{'CONTENT_LENGTH'}); + + binmode(STDIN); + # STDIN A pause character is detected.'(MacIE3.0 boundary of $ENV{'CONTENT_TYPE'} cannot be trusted.) + my $Boundary = ; + $Boundary =~ s/\x0D\x0A//; + $Boundary = quotemeta($Boundary); + while() { + if(/^\s*Content-Disposition:/i) { + my($name,$ContentType,$FileName); + # form data get + if(/\bname="([^"]+)"/i || /\bname=([^\s:;]+)/i) { + $name = $1; + $name =~ tr/+/ /; + $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + &Encode(\$name); + } + if(/\bfilename="([^"]*)"/i || /\bfilename=([^\s:;]*)/i) { + $FileName = $1 || 'unknown'; + } + # head read + while() { + last if(! /\w/); + if(/^\s*Content-Type:\s*"([^"]+)"/i || /^\s*Content-Type:\s*([^\s:;]+)/i) { + $ContentType = $1; + } + } + # body read + $value = ""; + while() { + last if(/^$Boundary/o); + $value .= $_; + }; + $lastline = $_; + $value =~s /\x0D\x0A$//; + if($value ne '') { + if($FileName || $ContentType) { + $img_data_exists = 1; + ( + $FileName, # + $Ext, # + $Length, # + $ImageWidth, # + $ImageHeight, # + $ContentName # + ) = &CheckContentType(\$value,$FileName,$ContentType); + + $FORM{$name} = $FileName; + $new_fname = $FileName; + push(@NEWFNAME_DATA,"$FileName\t$Ext\t$Length\t$ImageWidth\t$ImageHeight\t$ContentName"); + + # Multi-upload correspondence + push(@NEWFNAMES,$new_fname); + open(OUT,">$img_dir/$new_fname"); + binmode(OUT); + eval "flock(OUT,2);" if($PM{'flock'} == 1); + print OUT $value; + eval "flock(OUT,8);" if($PM{'flock'} == 1); + close(OUT); + + } elsif($name) { + $value =~ tr/+/ /; + $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + &Encode(\$value,'trans'); + $FORM{$name} .= "\0" if(defined($FORM{$name})); + $FORM{$name} .= $value; + } + } + }; + last if($lastline =~ /^$Boundary\-\-/o); + } + } elsif($ENV{'CONTENT_LENGTH'}) { + read(STDIN,$Buffer,$ENV{'CONTENT_LENGTH'}); + } + foreach(split(/&/,$Buffer),split(/&/,$ENV{'QUERY_STRING'})) { + my($name, $value) = split(/=/); + $name =~ tr/+/ /; + $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + $value =~ tr/+/ /; + $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + + &Encode(\$name); + &Encode(\$value,'trans'); + $FORM{$name} .= "\0" if(defined($FORM{$name})); + $FORM{$name} .= $value; + + } + +} + +############################################################################## +# Summary +# +# CheckContentType +# +# Parameters +# Returns +# Memo +############################################################################## +sub CheckContentType +{ + + my($DATA,$FileName,$ContentType) = @_; + my($Ext,$ImageWidth,$ImageHeight,$ContentName,$Infomation); + my $DataLength = length($$DATA); + + # An unknown file type + + $_ = $ContentType; + my $UnknownType = ( + !$_ + || /^application\/(x-)?macbinary$/i + || /^application\/applefile$/i + || /^application\/octet-stream$/i + || /^text\/plane$/i + || /^x-unknown-content-type/i + ); + + # MacBinary(Mac Unnecessary data are deleted.) + if($UnknownType || $ENV{'HTTP_USER_AGENT'} =~ /Macintosh|Mac_/) { + if($DataLength > 128 && !unpack("C",substr($$DATA,0,1)) && !unpack("C",substr($$DATA,74,1)) && !unpack("C",substr($$DATA,82,1)) ) { + my $MacBinary_ForkLength = unpack("N", substr($$DATA, 83, 4)); # ForkLength Get + my $MacBinary_FileName = quotemeta(substr($$DATA, 2, unpack("C",substr($$DATA, 1, 1)))); + if($MacBinary_FileName && $MacBinary_ForkLength && $DataLength >= $MacBinary_ForkLength + 128 + && ($FileName =~ /$MacBinary_FileName/i || substr($$DATA,102,4) eq 'mBIN')) { # DATA TOP 128byte MacBinary!! + $$DATA = substr($$DATA,128,$MacBinary_ForkLength); + my $ResourceLength = $DataLength - $MacBinary_ForkLength - 128; + $DataLength = $MacBinary_ForkLength; + } + } + } + + # A file name is changed into EUC. +# &jcode::convert(\$FileName,'euc',$FormCodeDefault); +# &jcode::h2z_euc(\$FileName); + $FileName =~ s/^.*\\//; # Windows, Mac + $FileName =~ s/^.*\///; # UNIX + $FileName =~ s/&/&/g; + $FileName =~ s/"/"/g; + $FileName =~ s//>/g; +# +# if($CHARCODE ne 'euc') { +# &jcode::convert(\$FileName,$CHARCODE,'euc'); +# } + + # An extension is extracted and it changes into a small letter. + my $FileExt; + if($FileName =~ /\.(\w+)$/) { + $FileExt = $1; + $FileExt =~ tr/A-Z/a-z/; + } + + # Executable file detection (ban on upload) + if($$DATA =~ /^MZ/) { + $Ext = 'exe'; + } + # text + if(!$Ext && ($UnknownType || $ContentType =~ /^text\//i || $ContentType =~ /^application\/(?:rtf|richtext)$/i || $ContentType =~ /^image\/x-xbitmap$/i) + && ! $$DATA =~ /[\000-\006\177\377]/) { +# $$DATA =~ s/\x0D\x0A/\n/g; +# $$DATA =~ tr/\x0D\x0A/\n\n/; +# +# if( +# $$DATA =~ /<\s*SCRIPT(?:.|\n)*?>/i +# || $$DATA =~ /<\s*(?:.|\n)*?\bONLOAD\s*=(?:.|\n)*?>/i +# || $$DATA =~ /<\s*(?:.|\n)*?\bONCLICK\s*=(?:.|\n)*?>/i +# ) { +# $Infomation = '(JavaScript contains)'; +# } +# if($$DATA =~ /<\s*TABLE(?:.|\n)*?>/i +# || $$DATA =~ /<\s*BLINK(?:.|\n)*?>/i +# || $$DATA =~ /<\s*MARQUEE(?:.|\n)*?>/i +# || $$DATA =~ /<\s*OBJECT(?:.|\n)*?>/i +# || $$DATA =~ /<\s*EMBED(?:.|\n)*?>/i +# || $$DATA =~ /<\s*FRAME(?:.|\n)*?>/i +# || $$DATA =~ /<\s*APPLET(?:.|\n)*?>/i +# || $$DATA =~ /<\s*FORM(?:.|\n)*?>/i +# || $$DATA =~ /<\s*(?:.|\n)*?\bSRC\s*=(?:.|\n)*?>/i +# || $$DATA =~ /<\s*(?:.|\n)*?\bDYNSRC\s*=(?:.|\n)*?>/i +# ) { +# $Infomation = '(the HTML tag which is not safe is included)'; +# } + + if($FileExt =~ /^txt$/i || $FileExt =~ /^cgi$/i || $FileExt =~ /^pl$/i) { # Text File + $Ext = 'txt'; + } elsif($ContentType =~ /^text\/html$/i || $FileExt =~ /html?/i || $$DATA =~ /<\s*HTML(?:.|\n)*?>/i) { # HTML File + $Ext = 'html'; + } elsif($ContentType =~ /^image\/x-xbitmap$/i || $FileExt =~ /^xbm$/i) { # XBM(x-BitMap) Image + my $XbmName = $1; + my ($XbmWidth, $XbmHeight); + if($$DATA =~ /\#define\s*$XbmName\_width\s*(\d+)/i) { + $XbmWidth = $1; + } + if($$DATA =~ /\#define\s*$XbmName\_height\s*(\d+)/i) { + $XbmHeight = $1; + } + if($XbmWidth && $XbmHeight) { + $Ext = 'xbm'; + $ImageWidth = $XbmWidth; + $ImageHeight = $XbmHeight; + } + } else { # + $Ext = 'txt'; + } + } + + # image + if(!$Ext && ($UnknownType || $ContentType =~ /^image\//i)) { + # PNG + if($$DATA =~ /^\x89PNG\x0D\x0A\x1A\x0A/) { + if(substr($$DATA, 12, 4) eq 'IHDR') { + $Ext = 'png'; + ($ImageWidth, $ImageHeight) = unpack("N2", substr($$DATA, 16, 8)); + } + } elsif($$DATA =~ /^GIF8(?:9|7)a/) { # GIF89a(modified), GIF89a, GIF87a + $Ext = 'gif'; + ($ImageWidth, $ImageHeight) = unpack("v2", substr($$DATA, 6, 4)); + } elsif($$DATA =~ /^II\x2a\x00\x08\x00\x00\x00/ || $$DATA =~ /^MM\x00\x2a\x00\x00\x00\x08/) { # TIFF + $Ext = 'tif'; + } elsif($$DATA =~ /^BM/) { # BMP + $Ext = 'bmp'; + } elsif($$DATA =~ /^\xFF\xD8\xFF/ || $$DATA =~ /JFIF/) { # JPEG + my $HeaderPoint = index($$DATA, "\xFF\xD8\xFF", 0); + my $Point = $HeaderPoint + 2; + while($Point < $DataLength) { + my($Maker, $MakerType, $MakerLength) = unpack("C2n",substr($$DATA,$Point,4)); + if($Maker != 0xFF || $MakerType == 0xd9 || $MakerType == 0xda) { + last; + } elsif($MakerType >= 0xC0 && $MakerType <= 0xC3) { + $Ext = 'jpg'; + ($ImageHeight, $ImageWidth) = unpack("n2", substr($$DATA, $Point + 5, 4)); + if($HeaderPoint > 0) { + $$DATA = substr($$DATA, $HeaderPoint); + $DataLength = length($$DATA); + } + last; + } else { + $Point += $MakerLength + 2; + } + } + } + } + + # audio + if(!$Ext && ($UnknownType || $ContentType =~ /^audio\//i)) { + # MIDI Audio + if($$DATA =~ /^MThd/) { + $Ext = 'mid'; + } elsif($$DATA =~ /^\x2esnd/) { # ULAW Audio + $Ext = 'au'; + } elsif($$DATA =~ /^RIFF/ || $$DATA =~ /^ID3/ && $$DATA =~ /RIFF/) { + my $HeaderPoint = index($$DATA, "RIFF", 0); + $_ = substr($$DATA, $HeaderPoint + 8, 8); + if(/^WAVEfmt $/) { + # WAVE + if(unpack("V",substr($$DATA, $HeaderPoint + 16, 4)) == 16) { + $Ext = 'wav'; + } else { # RIFF WAVE MP3 + $Ext = 'mp3'; + } + } elsif(/^RMIDdata$/) { # RIFF MIDI + $Ext = 'rmi'; + } elsif(/^RMP3data$/) { # RIFF MP3 + $Ext = 'rmp'; + } + if($ContentType =~ /^audio\//i) { + $Infomation .= '(RIFF '. substr($$DATA, $HeaderPoint + 8, 4). ')'; + } + } + } + + # a binary file + unless ($Ext) { + # PDF image + if($$DATA =~ /^\%PDF/) { + # Picture size is not measured. + $Ext = 'pdf'; + } elsif($$DATA =~ /^FWS/) { # Shockwave Flash + $Ext = 'swf'; + } elsif($$DATA =~ /^RIFF/ || $$DATA =~ /^ID3/ && $$DATA =~ /RIFF/) { + my $HeaderPoint = index($$DATA, "RIFF", 0); + $_ = substr($$DATA,$HeaderPoint + 8, 8); + # AVI + if(/^AVI LIST$/) { + $Ext = 'avi'; + } + if($ContentType =~ /^video\//i) { + $Infomation .= '(RIFF '. substr($$DATA, $HeaderPoint + 8, 4). ')'; + } + } elsif($$DATA =~ /^PK/) { # ZIP Compress File + $Ext = 'zip'; + } elsif($$DATA =~ /^MSCF/) { # CAB Compress File + $Ext = 'cab'; + } elsif($$DATA =~ /^Rar\!/) { # RAR Compress File + $Ext = 'rar'; + } elsif(substr($$DATA, 2, 5) =~ /^\-lh(\d+|d)\-$/) { # LHA Compress File + $Infomation .= "(lh$1)"; + $Ext = 'lzh'; + } elsif(substr($$DATA, 325, 25) eq "Apple Video Media Handler" || substr($$DATA, 325, 30) eq "Apple \x83\x72\x83\x66\x83\x49\x81\x45\x83\x81\x83\x66\x83\x42\x83\x41\x83\x6E\x83\x93\x83\x68\x83\x89") { + # QuickTime + $Ext = 'mov'; + } + } + + # Header analysis failure + unless ($Ext) { + # It will be followed if it applies for the MIME type from the browser. + foreach (keys %UPLOAD_CONTENT_TYPE_LIST) { + next unless ($_); + if($ContentType =~ /^$_$/i) { + $Ext = $UPLOAD_CONTENT_TYPE_LIST{$_}; + $ContentName = &CheckContentExt($Ext); + if( + grep {$_ eq $Ext;} ( + 'png', + 'gif', + 'jpg', + 'xbm', + 'tif', + 'bmp', + 'pdf', + 'swf', + 'mov', + 'zip', + 'cab', + 'lzh', + 'rar', + 'mid', + 'rmi', + 'au', + 'wav', + 'avi', + 'exe' + ) + ) { + $Infomation .= ' / Header analysis failure'; + } + if($Ext ne $FileExt && &CheckContentExt($FileExt) eq $ContentName) { + $Ext = $FileExt; + } + last; + } + } + # a MIME type is unknown--It judges from an extension. + unless ($Ext) { + $ContentName = &CheckContentExt($FileExt); + if($ContentName) { + $Ext = $FileExt; + $Infomation .= ' / MIME type is unknown('. $ContentType. ')'; + last; + } + } + } + +# $ContentName = &CheckContentExt($Ext) unless($ContentName); +# if($Ext && $ContentName) { +# $ContentName .= $Infomation; +# } else { +# &upload_error( +# 'Extension Error', +# "$FileName A not corresponding extension ($Ext)
The extension which can be responded ". join(',', sort values(%UPLOAD_EXT_LIST)) +# ); +# } + +# # SSI Tag Deletion +# if($Ext =~ /.?html?/ && $$DATA =~ /<\!/) { +# foreach ( +# 'config', +# 'echo', +# 'exec', +# 'flastmod', +# 'fsize', +# 'include' +# ) { +# $$DATA =~ s/\#\s*$_/\&\#35\;$_/ig +# } +# } + + return ( + $FileName, + $Ext, + int($DataLength / 1024 + 1), + $ImageWidth, + $ImageHeight, + $ContentName + ); +} + +############################################################################## +# Summary +# +# Extension discernment +# +# Parameters +# Returns +# Memo +############################################################################## + +sub CheckContentExt +{ + + my($Ext) = @_; + my $ContentName; + foreach (keys %UPLOAD_EXT_LIST) { + next unless ($_); + if($_ && $Ext =~ /^$_$/) { + $ContentName = $UPLOAD_EXT_LIST{$_}; + last; + } + } + return $ContentName; + +} + +############################################################################## +# Summary +# +# Form decode +# +# Parameters +# Returns +# Memo +############################################################################## +sub Encode +{ + + my($value,$Trans) = @_; + +# my $FormCode = &jcode::getcode($value) || $FormCodeDefault; +# $FormCodeDefault ||= $FormCode; +# +# if($Trans && $TRANS_2BYTE_CODE) { +# if($FormCode ne 'euc') { +# &jcode::convert($value, 'euc', $FormCode); +# } +# &jcode::tr( +# $value, +# "\xA3\xB0-\xA3\xB9\xA3\xC1-\xA3\xDA\xA3\xE1-\xA3\xFA", +# '0-9A-Za-z' +# ); +# if($CHARCODE ne 'euc') { +# &jcode::convert($value,$CHARCODE,'euc'); +# } +# } else { +# if($CHARCODE ne $FormCode) { +# &jcode::convert($value,$CHARCODE,$FormCode); +# } +# } +# if($CHARCODE eq 'euc') { +# &jcode::h2z_euc($value); +# } elsif($CHARCODE eq 'sjis') { +# &jcode::h2z_sjis($value); +# } + +} + +############################################################################## +# Summary +# +# Error Msg +# +# Parameters +# Returns +# Memo +############################################################################## + +sub upload_error +{ + + local($error_message) = $_[0]; + local($error_message2) = $_[1]; + + print "Content-type: text/html\n\n"; + print< + +Error Message + + + + + +
Error Message
+
    +

    $error_message

    +$error_message2
    +
+ + +EOF + &rm_tmp_uploaded_files; # Image Temporary deletion + exit; +} + +############################################################################## +# Summary +# +# Image Temporary deletion +# +# Parameters +# Returns +# Memo +############################################################################## + +sub rm_tmp_uploaded_files +{ + if($img_data_exists == 1){ + sleep 1; + foreach $fname_list(@NEWFNAMES) { + if(-e "$img_dir/$fname_list") { + unlink("$img_dir/$fname_list"); + } + } + } + +} +1; diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/perl/util.pl b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/perl/util.pl new file mode 100644 index 00000000..287de4f9 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/perl/util.pl @@ -0,0 +1,56 @@ +##### +# FCKeditor - The text editor for internet +# Copyright (C) 2003-2005 Frederico Caldeira Knabben +# +# Licensed under the terms of the GNU Lesser General Public License: +# http://www.opensource.org/licenses/lgpl-license.php +# +# For further information visit: +# http://www.fckeditor.net/ +# +# "Support Open Source software. What about a donation today?" +# +# File Name: util.pl +# This is the File Manager Connector for Perl. +# +# File Authors: +# Takashi Yamaguchi (jack@omakase.net) +##### + +sub RemoveFromStart +{ + local($sourceString, $charToRemove) = @_; + $sPattern = '^' . $charToRemove . '+' ; + $sourceString =~ s/^$charToRemove+//g; + return $sourceString; +} + +sub RemoveFromEnd +{ + local($sourceString, $charToRemove) = @_; + $sPattern = $charToRemove . '+$' ; + $sourceString =~ s/$charToRemove+$//g; + return $sourceString; +} + +sub ConvertToXmlAttribute +{ + local($value) = @_; + return $value; +# return utf8_encode(htmlspecialchars($value)); + +} + +sub specialchar_cnv +{ + local($ch) = @_; + + $ch =~ s/&/&/g; # & + $ch =~ s/\"/"/g; #" + $ch =~ s/\'/'/g; # ' + $ch =~ s//>/g; # > + return($ch); +} + +1; diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/php/basexml.php b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/php/basexml.php new file mode 100644 index 00000000..b21b16c2 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/php/basexml.php @@ -0,0 +1,68 @@ +' ; + + // Create the main "Connector" node. + echo '' ; + + // Add the current folder node. + echo '' ; +} + +function CreateXmlFooter() +{ + echo '' ; +} + +function SendError( $number, $text ) +{ + SetXmlHeaders() ; + + // Create the XML document header + echo '' ; + + echo '' ; + + exit ; +} +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/php/commands.php b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/php/commands.php new file mode 100644 index 00000000..a3f5e41b --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/php/commands.php @@ -0,0 +1,211 @@ +' ; + } + + closedir( $oCurrentFolder ) ; + + // Open the "Folders" node. + echo "" ; + + natcasesort( $aFolders ) ; + foreach ( $aFolders as $sFolder ) + echo $sFolder ; + + // Close the "Folders" node. + echo "" ; +} + +function GetFoldersAndFiles( $resourceType, $currentFolder ) +{ + // Map the virtual path to the local server path. + $sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ; + + // Arrays that will hold the folders and files names. + $aFolders = array() ; + $aFiles = array() ; + + $oCurrentFolder = opendir( $sServerDir ) ; + + while ( $sFile = readdir( $oCurrentFolder ) ) + { + if ( $sFile != '.' && $sFile != '..' ) + { + if ( is_dir( $sServerDir . $sFile ) ) + $aFolders[] = '' ; + else + { + $iFileSize = filesize( $sServerDir . $sFile ) ; + if ( $iFileSize > 0 ) + { + $iFileSize = round( $iFileSize / 1024 ) ; + if ( $iFileSize < 1 ) $iFileSize = 1 ; + } + + $aFiles[] = '' ; + } + } + } + + // Send the folders + natcasesort( $aFolders ) ; + echo '' ; + + foreach ( $aFolders as $sFolder ) + echo $sFolder ; + + echo '' ; + + // Send the files + natcasesort( $aFiles ) ; + echo '' ; + + foreach ( $aFiles as $sFiles ) + echo $sFiles ; + + echo '' ; +} + +function CreateFolder( $resourceType, $currentFolder ) +{ + $sErrorNumber = '0' ; + $sErrorMsg = '' ; + + if ( isset( $_GET['NewFolderName'] ) ) + { + $sNewFolderName = $_GET['NewFolderName'] ; + + if ( strpos( $sNewFolderName, '..' ) !== FALSE ) + $sErrorNumber = '102' ; // Invalid folder name. + else + { + // Map the virtual path to the local server path of the current folder. + $sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ; + + if ( is_writable( $sServerDir ) ) + { + $sServerDir .= $sNewFolderName ; + + $sErrorMsg = CreateServerFolder( $sServerDir ) ; + + switch ( $sErrorMsg ) + { + case '' : + $sErrorNumber = '0' ; + break ; + case 'Invalid argument' : + case 'No such file or directory' : + $sErrorNumber = '102' ; // Path too long. + break ; + default : + $sErrorNumber = '110' ; + break ; + } + } + else + $sErrorNumber = '103' ; + } + } + else + $sErrorNumber = '102' ; + + // Create the "Error" node. + echo '' ; +} + +function FileUpload( $resourceType, $currentFolder ) +{ + $sErrorNumber = '0' ; + $sFileName = '' ; + + if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] ) ) + { + $oFile = $_FILES['NewFile'] ; + + // Map the virtual path to the local server path. + $sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ; + + // Get the uploaded file name. + $sFileName = $oFile['name'] ; + $sOriginalFileName = $sFileName ; + $sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ; + $sExtension = strtolower( $sExtension ) ; + + global $Config ; + + $arAllowed = $Config['AllowedExtensions'][$resourceType] ; + $arDenied = $Config['DeniedExtensions'][$resourceType] ; + + if ( ( count($arAllowed) == 0 || in_array( $sExtension, $arAllowed ) ) && ( count($arDenied) == 0 || !in_array( $sExtension, $arDenied ) ) ) + { + $iCounter = 0 ; + + while ( true ) + { + $sFilePath = $sServerDir . $sFileName ; + + if ( is_file( $sFilePath ) ) + { + $iCounter++ ; + $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ; + $sErrorNumber = '201' ; + } + else + { + move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ; + + if ( is_file( $sFilePath ) ) + { + $oldumask = umask(0) ; + chmod( $sFilePath, 0777 ) ; + umask( $oldumask ) ; + } + + break ; + } + } + } + else + $sErrorNumber = '202' ; + } + else + $sErrorNumber = '202' ; + + echo '' ; + + exit ; +} +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/php/config.php b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/php/config.php new file mode 100644 index 00000000..4c45b7cc --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/php/config.php @@ -0,0 +1,47 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/php/connector.php b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/php/connector.php new file mode 100644 index 00000000..255a459f --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/php/connector.php @@ -0,0 +1,107 @@ + 0 ) +{ + $GLOBALS["UserFilesDirectory"] = $Config['UserFilesAbsolutePath'] ; + + if ( ! ereg( '/$', $GLOBALS["UserFilesDirectory"] ) ) + $GLOBALS["UserFilesDirectory"] .= '/' ; +} +else +{ + // Map the "UserFiles" path to a local directory. + $GLOBALS["UserFilesDirectory"] = GetRootPath() . $GLOBALS["UserFilesPath"] ; +} + +DoResponse() ; + +function DoResponse() +{ + if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) ) + return ; + + // Get the main request informaiton. + $sCommand = $_GET['Command'] ; + $sResourceType = $_GET['Type'] ; + $sCurrentFolder = $_GET['CurrentFolder'] ; + + // Check if it is an allowed type. + if ( !in_array( $sResourceType, array('File','Image','Flash','Media') ) ) + return ; + + // Check the current folder syntax (must begin and start with a slash). + if ( ! ereg( '/$', $sCurrentFolder ) ) $sCurrentFolder .= '/' ; + if ( strpos( $sCurrentFolder, '/' ) !== 0 ) $sCurrentFolder = '/' . $sCurrentFolder ; + + // Check for invalid folder paths (..) + if ( strpos( $sCurrentFolder, '..' ) ) + SendError( 102, "" ) ; + + // File Upload doesn't have to Return XML, so it must be intercepted before anything. + if ( $sCommand == 'FileUpload' ) + { + FileUpload( $sResourceType, $sCurrentFolder ) ; + return ; + } + + CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ) ; + + // Execute the required command. + switch ( $sCommand ) + { + case 'GetFolders' : + GetFolders( $sResourceType, $sCurrentFolder ) ; + break ; + case 'GetFoldersAndFiles' : + GetFoldersAndFiles( $sResourceType, $sCurrentFolder ) ; + break ; + case 'CreateFolder' : + CreateFolder( $sResourceType, $sCurrentFolder ) ; + break ; + } + + CreateXmlFooter() ; + + exit ; +} +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/php/io.php b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/php/io.php new file mode 100644 index 00000000..f4fb51f8 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/php/io.php @@ -0,0 +1,97 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/php/util.php b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/php/util.php new file mode 100644 index 00000000..8b87fcbe --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/php/util.php @@ -0,0 +1,37 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/test.html b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/test.html new file mode 100644 index 00000000..609f59de --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/connectors/test.html @@ -0,0 +1,168 @@ + + + + + FCKeditor - Connectors Tests + + + + + + + + + + +
+ + + + + + + + + + +
Connector:
+
   Current Folder
+
   Resource Type
+
   Server Path
+
+
+ + + + + + + + + + +
Get Folders   Get Folders and Files   Create Folder    +
+ File Upload
+ +
+
+
+ URL: +
+ +
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/frmactualfolder.html b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/frmactualfolder.html new file mode 100644 index 00000000..98de246c --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/frmactualfolder.html @@ -0,0 +1,63 @@ + + + + + + + + + + + + +
+ +
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/frmcreatefolder.html b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/frmcreatefolder.html new file mode 100644 index 00000000..95b2d8bc --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/frmcreatefolder.html @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + +
+ +
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/frmfolders.html b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/frmfolders.html new file mode 100644 index 00000000..d5bf6daf --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/frmfolders.html @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + +
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/frmresourceslist.html b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/frmresourceslist.html new file mode 100644 index 00000000..9c10faba --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/frmresourceslist.html @@ -0,0 +1,152 @@ + + + + + + + + + + +
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/frmresourcetype.html b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/frmresourcetype.html new file mode 100644 index 00000000..85089cea --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/frmresourcetype.html @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + +
+ Resource Type
+ +
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/frmupload.html b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/frmupload.html new file mode 100644 index 00000000..c2bfdda1 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/frmupload.html @@ -0,0 +1,109 @@ + + + + + + + + + +
+ + + + +
+ Upload a new file in this folder
+ + + + + +
 
+
+
+ + diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/ButtonArrow.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/ButtonArrow.gif new file mode 100644 index 00000000..a355e5a4 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/ButtonArrow.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/Folder.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/Folder.gif new file mode 100644 index 00000000..ab6824d7 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/Folder.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/Folder32.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/Folder32.gif new file mode 100644 index 00000000..b93b752c Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/Folder32.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/FolderOpened.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/FolderOpened.gif new file mode 100644 index 00000000..0c5dd413 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/FolderOpened.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/FolderOpened32.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/FolderOpened32.gif new file mode 100644 index 00000000..3e3fcf56 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/FolderOpened32.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/FolderUp.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/FolderUp.gif new file mode 100644 index 00000000..ad5bc202 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/FolderUp.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/ai.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/ai.gif new file mode 100644 index 00000000..699e6a38 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/ai.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/avi.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/avi.gif new file mode 100644 index 00000000..97025bb6 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/avi.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/bmp.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/bmp.gif new file mode 100644 index 00000000..f3c7f82a Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/bmp.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/cs.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/cs.gif new file mode 100644 index 00000000..b62bd026 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/cs.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/default.icon.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/default.icon.gif new file mode 100644 index 00000000..976997b1 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/default.icon.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/dll.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/dll.gif new file mode 100644 index 00000000..9b549645 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/dll.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/doc.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/doc.gif new file mode 100644 index 00000000..b557568b Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/doc.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/exe.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/exe.gif new file mode 100644 index 00000000..75849939 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/exe.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/fla.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/fla.gif new file mode 100644 index 00000000..923079fc Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/fla.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/gif.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/gif.gif new file mode 100644 index 00000000..df5f5795 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/gif.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/htm.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/htm.gif new file mode 100644 index 00000000..a9bdf003 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/htm.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/html.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/html.gif new file mode 100644 index 00000000..a9bdf003 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/html.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/jpg.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/jpg.gif new file mode 100644 index 00000000..de78363f Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/jpg.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/js.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/js.gif new file mode 100644 index 00000000..fe0c98e9 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/js.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/mdb.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/mdb.gif new file mode 100644 index 00000000..d3af9e87 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/mdb.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/mp3.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/mp3.gif new file mode 100644 index 00000000..7d6360f2 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/mp3.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/pdf.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/pdf.gif new file mode 100644 index 00000000..4950ec87 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/pdf.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/ppt.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/ppt.gif new file mode 100644 index 00000000..023431c1 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/ppt.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/rdp.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/rdp.gif new file mode 100644 index 00000000..b9eace7e Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/rdp.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/swf.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/swf.gif new file mode 100644 index 00000000..5df7de57 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/swf.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/swt.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/swt.gif new file mode 100644 index 00000000..7807c075 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/swt.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/txt.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/txt.gif new file mode 100644 index 00000000..4e2c2e3c Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/txt.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/vsd.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/vsd.gif new file mode 100644 index 00000000..7624697c Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/vsd.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/xls.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/xls.gif new file mode 100644 index 00000000..afe724a3 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/xls.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/xml.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/xml.gif new file mode 100644 index 00000000..4fae3566 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/xml.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/zip.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/zip.gif new file mode 100644 index 00000000..7157f72a Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/32/zip.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/ai.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/ai.gif new file mode 100644 index 00000000..ba5a9131 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/ai.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/avi.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/avi.gif new file mode 100644 index 00000000..6f3bac9b Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/avi.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/bmp.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/bmp.gif new file mode 100644 index 00000000..7708dd89 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/bmp.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/cs.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/cs.gif new file mode 100644 index 00000000..4d927230 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/cs.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/default.icon.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/default.icon.gif new file mode 100644 index 00000000..6ce26a4d Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/default.icon.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/dll.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/dll.gif new file mode 100644 index 00000000..48d445ac Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/dll.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/doc.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/doc.gif new file mode 100644 index 00000000..6535b4c0 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/doc.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/exe.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/exe.gif new file mode 100644 index 00000000..315817f5 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/exe.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/fla.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/fla.gif new file mode 100644 index 00000000..8f91a98e Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/fla.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/gif.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/gif.gif new file mode 100644 index 00000000..a5e3e6cf Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/gif.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/htm.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/htm.gif new file mode 100644 index 00000000..0b5d6ba1 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/htm.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/html.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/html.gif new file mode 100644 index 00000000..0b5d6ba1 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/html.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/jpg.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/jpg.gif new file mode 100644 index 00000000..634b3861 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/jpg.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/js.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/js.gif new file mode 100644 index 00000000..4ea17d45 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/js.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/mdb.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/mdb.gif new file mode 100644 index 00000000..0d7c1021 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/mdb.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/mp3.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/mp3.gif new file mode 100644 index 00000000..6f3bac9b Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/mp3.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/pdf.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/pdf.gif new file mode 100644 index 00000000..ca1f94ac Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/pdf.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/ppt.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/ppt.gif new file mode 100644 index 00000000..877a8c86 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/ppt.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/rdp.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/rdp.gif new file mode 100644 index 00000000..916cd7e6 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/rdp.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/swf.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/swf.gif new file mode 100644 index 00000000..314469da Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/swf.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/swt.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/swt.gif new file mode 100644 index 00000000..314469da Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/swt.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/txt.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/txt.gif new file mode 100644 index 00000000..1511ba3e Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/txt.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/vsd.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/vsd.gif new file mode 100644 index 00000000..9be3daae Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/vsd.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/xls.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/xls.gif new file mode 100644 index 00000000..f57715d6 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/xls.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/xml.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/xml.gif new file mode 100644 index 00000000..45599287 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/xml.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/zip.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/zip.gif new file mode 100644 index 00000000..b1e24921 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/icons/zip.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/spacer.gif b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/spacer.gif new file mode 100644 index 00000000..35d42e80 Binary files /dev/null and b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/images/spacer.gif differ diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/js/common.js b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/js/common.js new file mode 100644 index 00000000..76d7cfe7 --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/js/common.js @@ -0,0 +1,34 @@ +/* + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2005 Frederico Caldeira Knabben + * + * Licensed under the terms of the GNU Lesser General Public License: + * http://www.opensource.org/licenses/lgpl-license.php + * + * For further information visit: + * http://www.fckeditor.net/ + * + * "Support Open Source software. What about a donation today?" + * + * File Name: common.js + * Common objects and functions shared by all pages that compose the + * File Browser dialog window. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +function AddSelectOption( selectElement, optionText, optionValue ) +{ + var oOption = document.createElement("OPTION") ; + + oOption.text = optionText ; + oOption.value = optionValue ; + + selectElement.options.add(oOption) ; + + return oOption ; +} + +var oConnector = window.parent.oConnector ; +var oIcons = window.parent.oIcons ; \ No newline at end of file diff --git a/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/js/fckxml.js b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/js/fckxml.js new file mode 100644 index 00000000..1967beaf --- /dev/null +++ b/oss/vtiger/trunk/include/fckeditor/editor/filemanager/browser/default/js/fckxml.js @@ -0,0 +1,109 @@ +/* + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2005 Frederico Caldeira Knabben + * + * Licensed under the terms of the GNU Lesser General Public License: + * http://www.opensource.org/licenses/lgpl-license.php + * + * For further information visit: + * http://www.fckeditor.net/ + * + * "Support Open Source software. What about a donation today?" + * + * File Name: fckxml.js + * Defines the FCKXml object that is used for XML data calls + * and XML processing. + * This script is shared by almost all pages that compose the + * File Browser frameset. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +var FCKXml = function() +{} + +FCKXml.prototype.GetHttpRequest = function() +{ + if ( window.XMLHttpRequest ) // Gecko + return new XMLHttpRequest() ; + else if ( window.ActiveXObject ) // IE + return new ActiveXObject("MsXml2.XmlHttp") ; +} + +FCKXml.prototype.LoadUrl = function( urlToCall, asyncFunctionPointer ) +{ + var oFCKXml = this ; + + var bAsync = ( typeof(asyncFunctionPointer) == 'function' ) ; + + var oXmlHttp = this.GetHttpRequest() ; + + oXmlHttp.open( "GET", urlToCall, bAsync ) ; + + if ( bAsync ) + { + oXmlHttp.onreadystatechange = function() + { + if ( oXmlHttp.readyState == 4 ) + { + oFCKXml.DOMDocument = oXmlHttp.responseXML ; + if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 ) + asyncFunctionPointer( oFCKXml ) ; + else + alert( 'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')' ) ; + } + } + } + + oXmlHttp.send( null ) ; + + if ( ! bAsync ) + { + if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 ) + this.DOMDocument = oXmlHttp.responseXML ; + else + { + alert( 'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')' ) ; + } + } +} + +FCKXml.prototype.SelectNodes = function( xpath ) +{ + if ( document.all ) // IE + return this.DOMDocument.selectNodes( xpath ) ; + else // Gecko + { + var aNodeArray = new Array(); + + var xPathResult = this.DOMDocument.evaluate( xpath, this.DOMDocument, + this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), XPathResult.ORDERED_NODE_ITERATOR_TYPE, null) ; + if ( xPathResult ) + { + var oNode = xPathResult.iterateNext() ; + while( oNode ) + { + aNodeArray[aNodeArray.length] = oNode ; + oNode = xPathResult.iterateNext(); + } + } + return aNodeArray ; + } +} + +FCKXml.prototype.SelectSingleNode = function( xpath ) +{ + if ( document.all ) // IE + return this.DOMDocument.selectSingleNode( xpath ) ; + else // Gecko + { + var xPathResult = this.DOMDocument.evaluate( xpath, this.DOMDocument, + this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), 9, null); + + if ( xPathResult && xPathResult.singleNodeValue ) + return xPathResult.singleNodeValue ; + else + return null ; + } +} diff --git a/oss/vtiger/trunk/include/fpdf/pdfconfig.php b/oss/vtiger/trunk/include/fpdf/pdfconfig.php index aad6f75a..8d9ea137 100644 --- a/oss/vtiger/trunk/include/fpdf/pdfconfig.php +++ b/oss/vtiger/trunk/include/fpdf/pdfconfig.php @@ -19,7 +19,7 @@ $bottom="130";//"130" //how may products per page -$products_per_page="6";//used in modules/{PO/SO/Quotes/Invoice}/CreatePDF.php +$products_per_page="2";//used in modules/{PO/SO/Quotes/Invoice}/CreatePDF.php //where the top line starts diff --git a/oss/vtiger/trunk/include/language/zh_cn.lang.php b/oss/vtiger/trunk/include/language/zh_cn.lang.php index 4c9a9335..babbd0af 100644 --- a/oss/vtiger/trunk/include/language/zh_cn.lang.php +++ b/oss/vtiger/trunk/include/language/zh_cn.lang.php @@ -1112,6 +1112,7 @@ $app_strings = array ( 'Qty'=>'数量', 'Price'=>'单价', 'Discount'=>'折扣', +'LBL_ADD_BUTTON'=>'新建', // Added after 5.0.4 GA //Added to Fix i18N issue in Email Template diff --git a/oss/vtiger/trunk/modules/PickList/language/zh_cn.lang.php b/oss/vtiger/trunk/modules/PickList/language/zh_cn.lang.php index f5ffec17..9a607414 100644 --- a/oss/vtiger/trunk/modules/PickList/language/zh_cn.lang.php +++ b/oss/vtiger/trunk/modules/PickList/language/zh_cn.lang.php @@ -1,34 +1,43 @@ 'Assign', - 'ADD_PICKLIST_VALUES'=>'Add picklist values', - 'LBL_EXISTING_PICKLIST_VALUES'=>'Existing picklist values', - 'LBL_PICKLIST_ADDINFO'=>'Add new entries here', - 'LBL_SELECT_ROLES'=>'Select roles', - 'LBL_NON_EDITABLE_PICKLIST_ENTRIES'=>'Non-editable values', - 'EDIT_PICKLIST_VALUE'=>'Edit picklist values', - 'LBL_EDIT_HERE'=>'Replace with: ', - 'LBL_SELECT_TO_EDIT'=>'Select a value to edit: ', - 'DELETE_PICKLIST_VALUES'=>'Delete picklist values', - 'LBL_REPLACE_WITH'=>'Replace with: ', - 'ASSIGN_PICKLIST_VALUES'=>'Assign Picklist Values', - 'LBL_PICKLIST_VALUES'=>'Available picklist values', - 'LBL_PICKLIST_VALUES_ASSIGNED_TO'=>'Assigned picklist values for ', - 'LBL_ADD_TO_OTHER_ROLES'=>'Add to other roles', - 'LBL_OK_BUTTON_LABEL'=>'Ok', - 'LBL_SELECT_ROLES'=>'Select roles', - 'LBL_DISPLAYED_VALUES'=>'All accessible values for the role are shown below', + 'LBL_ASSIGN_BUTTON'=>'指定下拉选择', + 'ADD_PICKLIST_VALUES'=>'添加下拉选择列表变量', + 'LBL_EXISTING_PICKLIST_VALUES'=>'存在的下拉选择变量', + 'LBL_PICKLIST_ADDINFO'=>'在这里添加新实体', + 'LBL_SELECT_ROLES'=>'选择角色', + 'LBL_NON_EDITABLE_PICKLIST_ENTRIES'=>'不可编辑的变量', + 'EDIT_PICKLIST_VALUE'=>'编辑下拉选择变量', + 'LBL_EDIT_HERE'=>'用下面的下拉选择变量替换:', + 'LBL_SELECT_TO_EDIT'=>'选择一个需要编辑的下拉选择变量:', + 'DELETE_PICKLIST_VALUES'=>'删除下拉选择列表变量', + 'LBL_REPLACE_WITH'=>'用下面的下拉选择变量替换:', + 'ASSIGN_PICKLIST_VALUES'=>'指定下拉选择变量', + 'LBL_PICKLIST_VALUES'=>'可用下拉选择变量', + 'LBL_PICKLIST_VALUES_ASSIGNED_TO'=>'指定下拉选择变量为用户角色: ', + 'LBL_ADD_TO_OTHER_ROLES'=>'为其他角色指定下拉选择变量', + 'LBL_OK_BUTTON_LABEL'=>'确定', + 'LBL_SELECT_ROLES'=>'选择角色', + 'LBL_DISPLAYED_VALUES'=>'下面显示了当前用户角色所有可以被指定的选择变量', ); ?> diff --git a/oss/vtiger/trunk/modules/Settings/language/zh_cn.lang.php b/oss/vtiger/trunk/modules/Settings/language/zh_cn.lang.php index 41c05cc1..964a8729 100644 --- a/oss/vtiger/trunk/modules/Settings/language/zh_cn.lang.php +++ b/oss/vtiger/trunk/modules/Settings/language/zh_cn.lang.php @@ -45,8 +45,10 @@ $mod_strings = Array( 'LBL_MODULE_NAME' => '设定', - 'LBL_MODULE_TITLE' => '设定: 首页', - 'LBL_LIST_CONTACT_ROLE' => '职位', + +'LBL_MODULE_TITLE' => '设定: 首页', + +'LBL_LIST_CONTACT_ROLE' => '职位',