From fcafbde14c7785f5456941b1a43bdf2000f0f00a Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 22 Mar 2017 16:39:01 +0800 Subject: [PATCH] update --- Gruntfile.js | 3 +- demo/config.js | 2 +- demo/js/component/demo.treevaluechooser.js | 39 + demo/js/component/demo.valuechooser.js | 29 + demo/js/config/component.js | 15 + demo/js/widget/demo.multiselecttree.js | 14 - dist/base.css | 58 +- dist/base.js | 40 +- dist/case.js | 14 +- dist/core.js | 645 +++++++++++++++- .../base/third => dist}/farbtastic/marker.png | Bin .../base/third => dist}/farbtastic/mask.png | Bin .../base/third => dist}/farbtastic/wheel.png | Bin dist/widget.js | 728 +++++++++++++++++- .../third => dist}/ztree/img/line_conn.gif | Bin .../base/third => dist}/ztree/img/loading.gif | Bin .../ztree/img/zTreeStandard.gif | Bin .../ztree/img/zTreeStandard.png | Bin src/base/farbtastic/farbtastic.js | 4 +- src/base/foundation/bi.message.js | 2 +- src/base/single/input/file.js | 16 +- src/base/tree/synctree.js | 2 +- src/base/tree/treeview.js | 16 +- src/case/logintimeout/login.timeout.js | 10 +- src/case/zclip/zclip.js | 4 +- src/component/combo.treevaluechooser.js | 599 ++++++++++++++ src/component/combo.valuechooser.js | 127 +++ src/core/alias.js | 591 ++++++++++++++ src/core/base.js | 47 +- src/core/func/function.js | 2 +- src/core/model.js | 2 +- src/core/utils/load.js | 2 +- src/css/base/third/farbtastic/farbtastic.css | 6 +- src/css/base/third/ztree/zTreeStyle.css | 50 +- src/css/base/view/popupview.css | 2 +- .../base/third/farbtastic/farbtastic.less | 8 +- src/less/base/third/ztree/zTreeStyle.less | 46 +- src/less/base/view/popupview.less | 2 +- src/widget/image/uploadimage.js | 2 +- 39 files changed, 2891 insertions(+), 236 deletions(-) create mode 100644 demo/js/component/demo.treevaluechooser.js create mode 100644 demo/js/component/demo.valuechooser.js create mode 100644 demo/js/config/component.js delete mode 100644 demo/js/widget/demo.multiselecttree.js rename {src/less/base/third => dist}/farbtastic/marker.png (100%) rename {src/less/base/third => dist}/farbtastic/mask.png (100%) rename {src/less/base/third => dist}/farbtastic/wheel.png (100%) rename {src/less/base/third => dist}/ztree/img/line_conn.gif (100%) rename {src/less/base/third => dist}/ztree/img/loading.gif (100%) rename {src/less/base/third => dist}/ztree/img/zTreeStandard.gif (100%) rename {src/less/base/third => dist}/ztree/img/zTreeStandard.png (100%) create mode 100644 src/component/combo.treevaluechooser.js create mode 100644 src/component/combo.valuechooser.js create mode 100644 src/core/alias.js diff --git a/Gruntfile.js b/Gruntfile.js index 65acb4824..9e758f414 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -62,7 +62,8 @@ module.exports = function (grunt) { src: [ 'src/widget/paramsettingcombo/popup.param.js', 'src/widget/sequencetable/treenumber.sequencetable.js', - 'src/widget/**/*.js' + 'src/widget/**/*.js', + 'src/component/**/*.js' ], dest: "dist/widget.js" }, diff --git a/demo/config.js b/demo/config.js index ad42d6618..abd87a41e 100644 --- a/demo/config.js +++ b/demo/config.js @@ -1 +1 @@ -Demo.CONFIG = Demo.LAYOUT_CONFIG.concat(Demo.BASE_CONFIG).concat(Demo.CASE_CONFIG).concat(Demo.WIDGET_CONFIG); \ No newline at end of file +Demo.CONFIG = Demo.LAYOUT_CONFIG.concat(Demo.BASE_CONFIG).concat(Demo.CASE_CONFIG).concat(Demo.WIDGET_CONFIG).concat(Demo.COMPONENT_CONFIG); \ No newline at end of file diff --git a/demo/js/component/demo.treevaluechooser.js b/demo/js/component/demo.treevaluechooser.js new file mode 100644 index 000000000..eb3673a3c --- /dev/null +++ b/demo/js/component/demo.treevaluechooser.js @@ -0,0 +1,39 @@ +Demo.TreeValueChooser = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-tree-value-chooser" + }, + render: function () { + + var tree = []; + for (var i = 0; i < 21; i++) { + tree.push({ + value: i + "", + text: i + "", + id: i + "", + pId: null + }); + for (var j = 0; j < 9; j++) { + tree.push({ + value: i + "-" + j, + text: j + "", + id: i + "-" + j, + pId: i + "" + }) + } + } + var widget = BI.createWidget({ + type: "bi.tree_value_chooser_combo", + items: tree, + itemsCreator: function (op, callback) { + callback(tree); + } + }); + return { + type: "bi.vertical", + hgap: 200, + vgap: 10, + items: [widget] + }; + } +}); +$.shortcut("demo.tree_value_chooser", Demo.TreeValueChooser); diff --git a/demo/js/component/demo.valuechooser.js b/demo/js/component/demo.valuechooser.js new file mode 100644 index 000000000..dbb36aa36 --- /dev/null +++ b/demo/js/component/demo.valuechooser.js @@ -0,0 +1,29 @@ +var _strings = " 柳州市城贸金属材料有限责任公司 柳州市建福房屋租赁有限公司 柳州市迅昌数码办公设备有限责任公司 柳州市河海贸易有限责任公司 柳州市花篮制衣厂 柳州市兴溪物资有限公司 柳州市针织总厂 柳州市衡管物资有限公司 柳州市琪成机电设备有限公司 柳州市松林工程机械修理厂 柳州市积玉贸易有限公司 柳州市福运来贸易有限责任公司 柳州市钢义物资有限公司 柳州市洋力化工有限公司 柳州市悦盛贸易有限公司 柳州市雁城钢管物资有限公司 柳州市恒瑞钢材经营部 柳州市科拓电子有限公司 柳州市九方电子有限公司 柳州市桂龙汽车配件厂 柳州市制鞋工厂 柳州市炜力科贸有限公司 柳州市希翼贸易有限公司 柳州市兆金物资有限公司 柳州市和润电子科技有限责任公司 柳州市汇凯贸易有限公司 柳州市好机汇商贸有限公司 柳州市泛源商贸经营部 柳州市利汇达物资有限公司 广西全民药业有限责任公司 柳州超凡物资贸易有限责任公司 柳州市贵宏物资有限责任公司 柳州昊恒贸易有限责任公司 柳州市浦联物资有限公司 柳州市广通园林绿化工程有限责任公司 柳州市松发物资贸易有限责任公司 柳州市奥士达办公设备有限责任公司 柳州市海泰物资有限公司 柳州市金三环针织厂 柳州市钢贸物资有限公司 柳州市明阳纺织有限公司 柳州市世科科技发展有限公司 柳州市禄羊贸易有限公司 柳州市金兆阳商贸有限公司 柳州市汇昌物资经营部 柳州市林泰金属物资供应站 柳州市自来水管道材料设备公司 柳州市丹柳铝板有限公司 柳州市桂冶物资有限公司 柳州市宸业物资经营部 柳州市耀成贸易有限公司 柳州奥易自动化科技有限公司 柳州市萃丰科技有限责任公司 柳州市华储贸易有限责任公司 柳州市黄颜钢材有限责任公司 柳州市银盛物资有限责任公司 柳州市新仪化玻供应站 柳州市晶凯化工有限公司 广西柳州市柳江包装纸厂 柳州市志新物资有限责任公司 柳州市兆钢物资有限公司 柳州市友方科技发展有限责任公司 柳州市缝纫机台板家具总厂 柳州市晖海数码办公设备有限责任公司 柳州市富兰特服饰有限责任公司 柳州市柳北区富兴物资经营部 柳州市柳锌福利厂 柳州市海泉印刷有限责任公司 柳州市乾亨贸易有限公司 柳州市悦宁物资贸易有限公司 柳州市昊天贸易有限公司 广西惠字钢铁有限公司 柳州市名青物资有限公司 柳州市林郝物资有限公司 柳州市民政服装厂 柳州市多维劳保用品厂 柳州市轻工物资供应公司 柳州市程源物资有限责任公司 柳州市寿丰物资贸易有限责任公司 柳州市凯凡物资有限公司 柳州市利晖物资经营部 柳州市恒茂金属物资供应站 柳州市中储物资经营部 柳州市第二医疗器械厂 柳州市来鑫物资经营部 柳州市钢鑫物资贸易有限责任公司 柳州市双合袜业有限责任公司 柳州市茂松经贸有限责任公司 柳州市行行物资贸易有限公司 柳州市方一物资有限公司 柳州成异钢管销售有限公司 柳州广惠佳电脑有限公司 桂林市圣泽鑫物资有限公司柳州分公司 柳州市砼基建材贸易有限公司 柳州市海燕针织厂 上海浦光仪表厂柳州销售处 柳州市能电工贸有限责任公司 柳州市广贸物资有限公司 柳州市柳北区大昌电工灯饰经营部 柳州市金龙印务有限公司 柳州市奇缘婚典服务有限公司 柳州市盛博物资经营部 柳州市项元钢铁贸易有限公司 柳州市虞美人化妆品经营部 柳州市俊彦鞋厂 柳州市聚源特钢有限公司 柳州市迅龙科贸有限责任公司 柳州市恒飞电子有限责任公司 柳州市蓝正现代办公设备有限责任公司 柳州地区农业生产资料公司 柳州华菱钢管销售有限公司 柳州融通物资有限公司 柳州市可仁广告策划有限责任公司 柳州市鸟鑫物资有限责任公司 柳州市五丰钢材供应站 柳州市金江不锈钢有限公司 柳州市美日物资设备有限责任公司 柳州市鑫东物资贸易有限责任公司 柳州地区日用杂品公司 柳州市华纳物资贸易有限公司 柳州乾利金虹物资贸易有限责任公司 柳州市新迈计算机有限公司 柳州市富丽实业发展公司 柳州市石钢金属材料有限公司 柳州市力志传真机销售有限公司 广西宝森投资有限公司 柳州市嵘基商贸有限公司 柳州市景民商贸有限责任公司 柳州市银桥化玻有限责任公司 柳州市宏文糖烟店 柳州市科苑电脑网络有限公司 柳州市两面针旅游用品厂 柳州市立早室内装璜有限责任公司 柳州地化建材有限公司 柳州市涛达贸易有限公司 柳州市兰丰档案服务中心 柳州市惠贸物资有限责任公司 柳州市立文物资有限责任公司 柳州市致和商贸经营部 柳州市金色阳光信息咨询有限公司 柳州市赛利钢材经销部 柳州市日用化工厂 柳州市昆廷物资有限责任公司 柳州市邦盛贸易有限公司 柳州市济华贸易有限公司 柳州昕威橡塑化工经营部 柳州市联业贸易有限公司 柳州市兰钢贸易有限公司 柳州市子欣科技有限公司 柳州市狄龙机电设备有限公司 柳州市方真物资贸易有限公司 柳州市银鸥废旧回收中心 柳州市冠宝贸易有限公司 柳州市鑫盛德商务咨询有限责任公司 柳州市泰汇银通经贸有限公司 广西瀚维智测科技有限公司 柳州市钓鱼郎制衣有限责任公司 柳州溪水物资有限公司 柳州市融峰物资有限责任公司 广西新地科技有限责任公司 柳州市纺织装饰公司 柳州市粤翔冶金炉料有限公司 柳州市远腾贸易有限公司 柳州市东鸿城市改造有限公司 广西丛欣实业有限公司 柳州市服装厂 柳州市立安联合刀片有限公司 广西国扬投资有限责任公司 柳州市铭泰办公设备公司 柳州市桂钢物资供应站 柳州市昱升物资有限责任公司 柳州市鹰飞灿科贸有限公司 柳州市先导科贸有限公司 柳州市金秋建材物资经营部 柳州市童装厂 柳州市民泽物资有限公司 柳州市恒先物资贸易有限公司 柳州市银夏冷气工程有限责任公司 柳州粮食批发有限责任公司 柳州市金银华窗纱制造有限责任公司 柳州市三方贸易有限公司 柳州市丰涛商贸有限责任公司 柳州华智企业管理咨询有限责任公司 柳州市诚正建筑工程施工图审查有限公司 柳州市今科电讯设备营销中心 柳州市闽德电子有限公司 柳州市鑫虹针织厂 柳州市畅通通讯器材有限责任公司 柳州市正钢物资经营部 柳州市新柳饲料有限责任公司 柳州市黄村油库 柳州市天泰电力装饰工程有限公司 柳州市兆吉物资有限责任公司 柳州市八龙纸制品有限责任公司 柳州市巨佳电脑网络科技有限公司 "; +//各种通用数据 +var ITEMS = BI.map(_strings.match(/[^\s]+/g), function (i, v) { + return { + text: v, + value: v, + title: v + } +}); +Demo.ValueChooserCombo = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-value-chooser-combo" + }, + render: function () { + var widget = BI.createWidget({ + type: "bi.value_chooser_combo", + itemsCreator: function (op, callback) { + callback(BI.deepClone(ITEMS)); + } + }); + return { + type: "bi.vertical", + hgap: 200, + vgap: 10, + items: [widget] + }; + } +}); +$.shortcut("demo.value_chooser_combo", Demo.ValueChooserCombo); \ No newline at end of file diff --git a/demo/js/config/component.js b/demo/js/config/component.js new file mode 100644 index 000000000..fe90fe901 --- /dev/null +++ b/demo/js/config/component.js @@ -0,0 +1,15 @@ +/** + * Created by User on 2017/3/22. + */ +Demo.COMPONENT_CONFIG = [{ + id: 15, + text: "部件" +}, { + pId: 15, + text: "bi.value_chooser_combo", + value: "demo.value_chooser_combo" +}, { + pId: 15, + text: "bi.tree_value_chooser_combo", + value: "demo.tree_value_chooser" +}]; \ No newline at end of file diff --git a/demo/js/widget/demo.multiselecttree.js b/demo/js/widget/demo.multiselecttree.js deleted file mode 100644 index 437f12162..000000000 --- a/demo/js/widget/demo.multiselecttree.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Created by User on 2017/3/22. - */ -Demo.MultiSelectTree = BI.inherit(BI.Widget, { - props: { - baseCls: "demo-multi-select-tree" - }, - render: function () { - return { - type: "bi.vertical", - } - } -}); -$.shortcut("demo.multi_select_tree", Demo.MultiSelectTree); \ No newline at end of file diff --git a/dist/base.css b/dist/base.css index 867afd467..0dd7e1c55 100644 --- a/dist/base.css +++ b/dist/base.css @@ -1310,19 +1310,19 @@ li.CodeMirror-hint-active { height: 101px; } .farbtastic .wheel { - background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/farbtastic/wheel.png) no-repeat; + background: url(farbtastic/wheel.png) no-repeat; width: 195px; height: 195px; } .farbtastic .overlay { - background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/farbtastic/mask.png) no-repeat; + background: url(farbtastic/mask.png) no-repeat; } .farbtastic .marker { width: 17px; height: 17px; margin: -8px 0 0 -8px; overflow: hidden; - background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/farbtastic/marker.png) no-repeat; + background: url(farbtastic/marker.png) no-repeat; } /* required styles */ .leaflet-pane, @@ -1846,7 +1846,7 @@ website: http://code.google.com/p/jquerytree/ padding: 0 0 0 18px; } .ztree li ul.line { - background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-1.png) 0 0 repeat-y; + background: url(icon/tree-vertical-line-1.png) 0 0 repeat-y; } .ztree li a { padding: 1px 3px 0 0; @@ -1901,8 +1901,8 @@ website: http://code.google.com/p/jquerytree/ background-color: transparent; background-repeat: no-repeat; background-attachment: scroll; - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.png"); - *background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.gif"); + background-image: url("ztree/img/zTreeStandard.png"); + *background-image: url("ztree/img/zTreeStandard.gif"); } .ztree li span.button.chk { width: 16px; @@ -1911,31 +1911,31 @@ website: http://code.google.com/p/jquerytree/ cursor: auto; } .ztree li span.button.chk.checkbox_false_full { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-normal.png"); + background-image: url("icon/check-box-normal.png"); } .ztree li span.button.chk.checkbox_false_full_focus { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-normal.png"); + background-image: url("icon/check-box-normal.png"); } .ztree li span.button.chk.checkbox_false_part { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png"); + background-image: url("icon/half_selected.png"); } .ztree li span.button.chk.checkbox_false_part_focus { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png"); + background-image: url("icon/half_selected.png"); } .ztree li span.button.chk.checkbox_false_disable { background-position: 0 -56px; } .ztree li span.button.chk.checkbox_true_full { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-active.png"); + background-image: url("icon/check-box-active.png"); } .ztree li span.button.chk.checkbox_true_full_focus { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-active.png"); + background-image: url("icon/check-box-active.png"); } .ztree li span.button.chk.checkbox_true_part { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png"); + background-image: url("icon/half_selected.png"); } .ztree li span.button.chk.checkbox_true_part_focus { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png"); + background-image: url("icon/half_selected.png"); } .ztree li span.button.chk.checkbox_true_disable { background-position: -14px -56px; @@ -1975,28 +1975,28 @@ website: http://code.google.com/p/jquerytree/ height: 25px; } .ztree li span.button.root_open { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-1.png"); + background-image: url("icon/tree-expand-1.png"); } .ztree li span.button.root_close { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-1.png"); + background-image: url("icon/tree-collapse-1.png"); } .ztree li span.button.roots_open { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-2.png"); + background-image: url("icon/tree-expand-2.png"); } .ztree li span.button.roots_close { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-2.png"); + background-image: url("icon/tree-collapse-2.png"); } .ztree li span.button.center_open { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-3.png"); + background-image: url("icon/tree-expand-3.png"); } .ztree li span.button.center_close { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-3.png"); + background-image: url("icon/tree-collapse-3.png"); } .ztree li span.button.bottom_open { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-4.png"); + background-image: url("icon/tree-expand-4.png"); } .ztree li span.button.bottom_close { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-4.png"); + background-image: url("icon/tree-collapse-4.png"); } .ztree li span.button.noline_open { background-position: -92px -72px; @@ -2008,13 +2008,13 @@ website: http://code.google.com/p/jquerytree/ background: none; } .ztree li span.button.roots_docu { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-2.png"); + background-image: url("icon/tree-vertical-line-2.png"); } .ztree li span.button.center_docu { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-3.png"); + background-image: url("icon/tree-vertical-line-3.png"); } .ztree li span.button.bottom_docu { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-4.png"); + background-image: url("icon/tree-vertical-line-4.png"); } .ztree li span.button.noline_docu { background: none; @@ -2052,7 +2052,7 @@ website: http://code.google.com/p/jquerytree/ .ztree li span.button.ico_loading { width: 0px; margin-right: 2px; - background: url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/loading.gif") no-repeat scroll 0 0 transparent; + background: url("ztree/img/loading.gif") no-repeat scroll 0 0 transparent; vertical-align: top; *vertical-align: middle; } @@ -2073,8 +2073,8 @@ span.tmpzTreeMove_arrow { background-repeat: no-repeat; background-attachment: scroll; background-position: -110px -80px; - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.png"); - *background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.gif"); + background-image: url("ztree/img/zTreeStandard.png"); + *background-image: url("ztree/img/zTreeStandard.gif"); } ul.ztree.zTreeDragUL { margin: 0; @@ -2226,7 +2226,7 @@ ul.ztree.zTreeDragUL { /****添加计算宽度的--运算符直接需要space****/ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ -/**********FR.BIListView*************/ +/**********BI.BIListView*************/ .bi-list-view { position: fixed !important; overflow-y: visible !important; diff --git a/dist/base.js b/dist/base.js index 5b491a786..bbb5ca2a2 100644 --- a/dist/base.js +++ b/dist/base.js @@ -21851,9 +21851,9 @@ BI.TreeView = BI.inherit(BI.Pane, { }, _init: function () { BI.TreeView.superclass._init.apply(this, arguments); - FR.$defaultImport('/com/fr/bi/web/js/third/ztree/jquery.ztree.core-3.5.js', 'js'); - FR.$defaultImport('/com/fr/bi/web/js/third/ztree/jquery.ztree.excheck-3.5.js', 'js'); - FR.$defaultImport('/com/fr/bi/web/css/base/third/ztree/zTreeStyle.css', 'css'); + + + this._stop = false; this.container = BI.createWidget(); @@ -21908,7 +21908,7 @@ BI.TreeView = BI.inherit(BI.Pane, { enable: true, url: getUrl, autoParam: ["id", "name"], - otherParam: FR.cjkEncodeDO(paras) + otherParam: BI.cjkEncodeDO(paras) }, check: { enable: true @@ -21950,10 +21950,10 @@ BI.TreeView = BI.inherit(BI.Pane, { treeNode.times = treeNode.times || 1; var param = "id=" + treeNode.id + "×=" + (treeNode.times++) - + "&parent_values= " + window.encodeURIComponent(FR.jsonEncode(parentNode)) - + "&check_state=" + window.encodeURIComponent(FR.jsonEncode(treeNode.getCheckStatus())); + + "&parent_values= " + window.encodeURIComponent(BI.jsonEncode(parentNode)) + + "&check_state=" + window.encodeURIComponent(BI.jsonEncode(treeNode.getCheckStatus())); - return FR.servletURL + '?op=' + self.options.op + '&cmd=' + self.options.cmd + "&" + param; + return BI.servletURL + '?op=' + self.options.op + '&cmd=' + self.options.cmd + "&" + param; } function beforeExpand(treeId, treeNode) { @@ -22002,7 +22002,7 @@ BI.TreeView = BI.inherit(BI.Pane, { function ajaxGetNodes(treeNode, reloadType) { var zTree = self.nodes; if (reloadType == "refresh") { - //treeNode.icon = FR.servletURL +"?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/loading.gif"; + //treeNode.icon = BI.servletURL +"?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/loading.gif"; zTree.updateNode(treeNode); } zTree.reAsyncChildNodes(treeNode, reloadType, true); @@ -22362,7 +22362,7 @@ BI.SyncTree = BI.inherit(BI.TreeView, { var setting = { async: { enable: false, - otherParam: FR.cjkEncodeDO(paras) + otherParam: BI.cjkEncodeDO(paras) }, check: { enable: true @@ -25091,8 +25091,8 @@ BI.Farbtastic = BI.inherit(BI.Widget, { _init: function () { BI.Farbtastic.superclass._init.apply(this, arguments); var self = this; - FR.$defaultImport('/com/fr/bi/web/js/third/farbtastic.js', 'js'); - FR.$defaultImport('/com/fr/bi/web/css/base/third/farbtastic/farbtastic.css', 'css'); + + this.farbtastic = $.farbtastic(this.element, function (v) { self.fireEvent(BI.Farbtastic.EVENT_CHANGE, self.getValue(), self); @@ -34693,7 +34693,7 @@ $.extend(BI, { this._show(true, title, message, callback); }, prompt: function (title, message, value, callback, min_width) { - FR.Msg.prompt(title, message, value, callback, min_width); + BI.Msg.prompt(title, message, value, callback, min_width); }, toast: function (message, level, context) { context = context || $("body"); @@ -38815,7 +38815,7 @@ $.shortcut("bi.checkbox", BI.Checkbox);/** var multipart = function (boundary, name, file) { return "--".concat( boundary, CRLF, - 'Content-Disposition: form-data; name="', name, '"; filename="', FR.cjkEncode(file.fileName), '"', CRLF, + 'Content-Disposition: form-data; name="', name, '"; filename="', BI.cjkEncode(file.fileName), '"', CRLF, "Content-Type: application/octet-stream", CRLF, CRLF, file.getAsBinary(), CRLF, @@ -38884,7 +38884,7 @@ $.shortcut("bi.checkbox", BI.Checkbox);/** }, false ); - xhr.open("post", handler.url + '&filename=' + FR.cjkEncode(handler.file.fileName), true); + xhr.open("post", handler.url + '&filename=' + BI.cjkEncode(handler.file.fileName), true); if (!xhr.upload) { var rpe = {loaded: 0, total: handler.file.fileSize || handler.file.size, simulation: true}; rpe.interval = setInterval(function () { @@ -38915,8 +38915,8 @@ $.shortcut("bi.checkbox", BI.Checkbox);/** upload.onprogress(rpe); if (199 < xhr.status && xhr.status < 400) { upload["onload"]({}); - var attachO = FR.jsonDecode(xhr.responseText); - attachO.filename = FR.cjkDecode(handler.file.fileName); + var attachO = BI.jsonDecode(xhr.responseText); + attachO.filename = BI.cjkDecode(handler.file.fileName); if (handler.file.type.indexOf('image') != -1) { attachO.attach_type = "image"; } @@ -38932,7 +38932,7 @@ $.shortcut("bi.checkbox", BI.Checkbox);/** xhr.onreadystatechange = function () { switch (xhr.readyState) { case 4: - var attachO = FR.jsonDecode(xhr.responseText); + var attachO = BI.jsonDecode(xhr.responseText); if (handler.file.type.indexOf('image') != -1) { attachO.attach_type = "image"; } @@ -38982,13 +38982,13 @@ $.shortcut("bi.checkbox", BI.Checkbox);/** //rpe.loaded = rpe.total; try { var responseText = (iframe.contentWindow.document || iframe.contentWindow.contentDocument).body.innerHTML; - var attachO = FR.jsonDecode(responseText); + var attachO = BI.jsonDecode(responseText); if (handler.file.type.indexOf('image') != -1) { attachO.attach_type = "image"; } //attachO.fileSize = responseText.length; - attachO.filename = FR.cjkDecode(handler.file.fileName); + attachO.filename = BI.cjkDecode(handler.file.fileName); if (handler.maxlength == 1) { handler.attach_array[0] = attachO; } else { @@ -39205,7 +39205,7 @@ $.shortcut("bi.checkbox", BI.Checkbox);/** // enable again the submit button/element }, 1000); }; - _wrap.url = o.url ? o.url : FR.servletURL + _wrap.url = o.url ? o.url : BI.servletURL + '?op=fr_attach&cmd=ah_upload'; _wrap.fileType = o.accept; //文件类型限制 _wrap.attach_array = []; diff --git a/dist/case.js b/dist/case.js index 94545560f..8b80badc9 100644 --- a/dist/case.js +++ b/dist/case.js @@ -5622,9 +5622,9 @@ BI.LoginTimeOut = BI.inherit(BI.BarPopoverSection, { } //反正是登录直接用FR的登录了 - FR.ajax({ - url: FR.servletURL + '?op=fs_load&cmd=login', - data: FR.cjkEncodeDO({ + BI.ajax({ + url: BI.servletURL + '?op=fs_load&cmd=login', + data: BI.cjkEncodeDO({ fr_username: encodeURIComponent(userNameInput.getValue()), fr_password: encodeURIComponent(passwordInput.getValue()), fr_remember: self.keepLoginState.isSelected() @@ -5639,7 +5639,7 @@ BI.LoginTimeOut = BI.inherit(BI.BarPopoverSection, { self._showMes(userNameMask, BI.i18nText("BI-Authentication_Failed")); return; } - var signResult = FR.jsonDecode(res.responseText); + var signResult = BI.jsonDecode(res.responseText); if (signResult.fail) { //用户名和密码不匹配 self._showMes(userNameMask, BI.i18nText("BI-Username_Password_Not_Correct")); @@ -5663,7 +5663,7 @@ BI.LoginTimeOut = BI.inherit(BI.BarPopoverSection, { type: "bi.center_adapt", items: [{ type: "bi.img", - src: FR.servletURL + (logo ? + src: BI.servletURL + (logo ? '?op=fr_attach&cmd=ah_image&id=' + logo + '&isAdjust=false' : '?op=resource&resource=/com/fr/bi/web/images/login/bi_logo.png'), width: 120, @@ -9322,10 +9322,10 @@ BI.ZeroClip = BI.inherit(BI.BasicButton, { _init: function () { BI.ZeroClip.superclass._init.apply(this, arguments); var self = this, o = this.options; - FR.$defaultImport('/com/fr/bi/web/js/third/jquery.zclip.js', 'js'); + BI.nextTick(function () { self.element.zclip({ - path: FR.servletURL + "?op=resource&resource=/com/fr/bi/web/resources/ZeroClipboard.swf", + path: BI.servletURL + "?op=resource&resource=/com/fr/bi/web/resources/ZeroClipboard.swf", copy: o.copy, beforeCopy: o.beforeCopy, afterCopy: o.afterCopy diff --git a/dist/core.js b/dist/core.js index 918dffeab..04bfb6cd4 100644 --- a/dist/core.js +++ b/dist/core.js @@ -12954,30 +12954,6 @@ if (!window.BI) { return widget instanceof BI.Widget || (BI.View && widget instanceof BI.View); }, - createWidget: function (item, options) { - var el; - options || (options = {}); - if (BI.isEmpty(item) && BI.isEmpty(options)) { - return BI.Plugin.getObject("bi.layout", BI.createWidget({ - type: "bi.layout" - })); - } - if (BI.isWidget(item)) { - return item; - } - if (item && (item.type || options.type)) { - el = BI.extend({}, options, item); - return BI.Plugin.getObject(el.type, FR.createWidget(BI.Plugin.getWidget(el.type, el), true)); - } - if (item && item.el && (item.el.type || options.type)) { - el = BI.extend({}, options, item.el); - return BI.Plugin.getObject(el.type, FR.createWidget(BI.Plugin.getWidget(el.type, el), true)); - } - if (item && BI.isWidget(item.el)) { - return item.el; - } - }, - createWidgets: function (items, options) { if (!BI.isArray(items)) { throw new Error("cannot create Widgets") @@ -13802,10 +13778,6 @@ if (!window.BI) { return BI.isString(str) && BI.isEmpty(str); }, - contentFormat: function () { - return FR.contentFormat.apply(FR, arguments); - }, - /** * 对字符串进行加密 {@link #decrypt} * @static @@ -13999,7 +13971,12 @@ if (!window.BI) { } timeoutToast.addReq(option); - FR.ajax({ + + option.data = BI.cjkEncodeDO(option.data); + + + + $.ajax({ url: option.url, type: "POST", data: option.data, @@ -14054,10 +14031,10 @@ if (!window.BI) { loading.showError(); } else if (status === "success" && BI.isFunction(option.success)) { - option.success(FR.jsonDecode(res.responseText)); + option.success(BI.jsonDecode(res.responseText)); } if (BI.isFunction(option.complete)) { - option.complete(FR.jsonDecode(res.responseText), status); + option.complete(BI.jsonDecode(res.responseText), status); } } }); @@ -14069,7 +14046,7 @@ if (!window.BI) { function encodeBIParam(data) { for (var key in data) { if (_.isObject(data[key])) { - data[key] = window.encodeURIComponent(FR.jsonEncode(data[key])); + data[key] = window.encodeURIComponent(BI.jsonEncode(data[key])); } else { data[key] = window.encodeURIComponent(data[key]); } @@ -14080,7 +14057,7 @@ if (!window.BI) { for (var key in data) { data[key] = window.decodeURIComponent(data[key]); if (_.isObject(data[key])) { - data[key] = FR.jsonDecode(data[key]); + data[key] = BI.jsonDecode(data[key]); } } } @@ -14103,7 +14080,7 @@ if (!window.BI) { if (op === "fr_bi_dezi" || op === "fr_bi_configure") { data.sessionID = Data.SharingPool.get("sessionID"); } - var url = FR.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random(); + var url = BI.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random(); return (BI.ajax)({ url: url, type: 'POST', @@ -14139,7 +14116,7 @@ if (!window.BI) { if (op === "fr_bi_dezi") { data.sessionID = Data.SharingPool.get("sessionID"); } - var url = FR.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random(); + var url = BI.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random(); var result = {}; (BI.ajax)({ url: url, @@ -15070,7 +15047,7 @@ BI.Widget = BI.inherit(BI.OB, { }, urlRoot: function () { - return FR.servletURL; + return BI.servletURL; }, parse: function (data) { @@ -17500,7 +17477,7 @@ $.extend(BI, { type: null, must: false }, options); - config.url = FR.servletURL + '?op=' + config.op + '&resource=' + config.path; + config.url = BI.servletURL + '?op=' + config.op + '&resource=' + config.path; this.$import(config.url, config.type,config.must); }, $import: function () { @@ -19660,7 +19637,597 @@ BI.PopoverSection = BI.inherit(BI.Widget, { } }); -BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";/** +BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";BI.cjkEncode = function (text) { + // alex:如果非字符串,返回其本身(cjkEncode(234) 返回 ""是不对的) + if (typeof text !== 'string') { + return text; + } + + var newText = ""; + for (var i = 0; i < text.length; i++) { + var code = text.charCodeAt(i); + if (code >= 128 || code === 91 || code === 93) {//91 is "[", 93 is "]". + newText += "[" + code.toString(16) + "]"; + } else { + newText += text.charAt(i); + } + } + + return newText +}; + +BI.cjkEncodeDO = function (o) { + if (BI.isPlainObject(o)) { + var result = {}; + $.each(o, function (k, v) { + if (!(typeof v == "string")) { + v = BI.jsonEncode(v); + } + //wei:bug 43338,如果key是中文,cjkencode后o的长度就加了1,ie9以下版本死循环,所以新建对象result。 + k = BI.cjkEncode(k); + result[k] = BI.cjkEncode(v); + }); + return result; + } + return o; +}; + +BI.jsonEncode = function (o) { + //james:这个Encode是抄的EXT的 + var useHasOwn = {}.hasOwnProperty ? true : false; + + // crashes Safari in some instances + //var validRE = /^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/; + + var m = { + "\b": '\\b', + "\t": '\\t', + "\n": '\\n', + "\f": '\\f', + "\r": '\\r', + '"': '\\"', + "\\": '\\\\' + }; + + var encodeString = function (s) { + if (/["\\\x00-\x1f]/.test(s)) { + return '"' + s.replace(/([\x00-\x1f\\"])/g, function (a, b) { + var c = m[b]; + if (c) { + return c; + } + c = b.charCodeAt(); + return "\\u00" + + Math.floor(c / 16).toString(16) + + (c % 16).toString(16); + }) + '"'; + } + return '"' + s + '"'; + }; + + var encodeArray = function (o) { + var a = ["["], b, i, l = o.length, v; + for (i = 0; i < l; i += 1) { + v = o[i]; + switch (typeof v) { + case "undefined": + case "function": + case "unknown": + break; + default: + if (b) { + a.push(','); + } + a.push(v === null ? "null" : BI.jsonEncode(v)); + b = true; + } + } + a.push("]"); + return a.join(""); + }; + + if (typeof o == "undefined" || o === null) { + return "null"; + } else if (BI.isArray(o)) { + return encodeArray(o); + } else if (o instanceof Date) { + /* + * alex:原来只是把年月日时分秒简单地拼成一个String,无法decode + * 现在这么处理就可以decode了,但是JS.jsonDecode和Java.JSONObject也要跟着改一下 + */ + return BI.jsonEncode({ + __time__: o.getTime() + }) + } else if (typeof o == "string") { + return encodeString(o); + } else if (typeof o == "number") { + return isFinite(o) ? String(o) : "null"; + } else if (typeof o == "boolean") { + return String(o); + } else if (BI.isFunction(o)) { + return String(o); + } else { + var a = ["{"], b, i, v; + for (i in o) { + if (!useHasOwn || o.hasOwnProperty(i)) { + v = o[i]; + switch (typeof v) { + case "undefined": + case "unknown": + break; + default: + if (b) { + a.push(','); + } + a.push(BI.jsonEncode(i), ":", + v === null ? "null" : BI.jsonEncode(v)); + b = true; + } + } + } + a.push("}"); + return a.join(""); + } +}; + +BI.contentFormat = function (cv, fmt) { + if (BI.isEmpty(cv)) { + //原值为空,返回空字符 + return ''; + } + var text = cv.toString(); + if (BI.isEmpty(fmt)) { + //格式为空,返回原字符 + return text; + } + if (fmt.match(/^T/)) { + //T - 文本格式 + return text; + } else if (fmt.match(/^D/)) { + //D - 日期(时间)格式 + if (!(cv instanceof Date)) { + if (typeof cv === 'number') { + //毫秒数类型 + cv = new Date(cv); + } else { + //字符串类型,如yyyyMMdd、MMddyyyy等这样无分隔符的结构 + cv = Date.parseDate(cv + "", Date.patterns.ISO8601Long); + } + } + if (!BI.isNull(cv)) { + var needTrim = fmt.match(/^DT/); + text = BI.date2Str(cv, fmt.substring(needTrim ? 2 : 1)); + } + } else if (fmt.match(/E/)) { + //科学计数格式 + text = BI._eFormat(text, fmt); + } else { + //数字格式 + text = BI._numberFormat(text, fmt); + } + //¤ - 货币格式 + text = text.replace(/¤/g, '¥'); + return text; +}; + +/** + * 把日期对象按照指定格式转化成字符串 + * + * @example + * var date = new Date('Thu Dec 12 2013 00:00:00 GMT+0800'); + * var result = BI.date2Str(date, 'yyyy-MM-dd');//2013-12-12 + * + * @class BI.date2Str + * @param date 日期 + * @param format 日期格式 + * @returns {String} + */ +date2Str = function (date, format) { + if (!date) { + return ''; + } + // O(len(format)) + var len = format.length, result = ''; + if (len > 0) { + var flagch = format.charAt(0), start = 0, str = flagch; + for (var i = 1; i < len; i++) { + var ch = format.charAt(i); + if (flagch !== ch) { + result += compileJFmt({ + 'char': flagch, + 'str': str, + 'len': i - start + }, date); + flagch = ch; + start = i; + str = flagch; + } else { + str += ch; + } + } + result += compileJFmt({ + 'char': flagch, + 'str': str, + 'len': len - start + }, date); + } + return result; + + function compileJFmt(jfmt, date) { + var str = jfmt.str, len = jfmt.len, ch = jfmt['char']; + switch (ch) { + case 'E': //星期 + str = Date._DN[date.getDay()]; + break; + case 'y': //年 + if (len <= 3) { + str = (date.getFullYear() + '').slice(2, 4); + } else { + str = date.getFullYear(); + } + break; + case 'M': //月 + if (len > 2) { + str = Date._MN[date.getMonth()]; + } else if (len < 2) { + str = date.getMonth() + 1; + } else { + str = String.leftPad(date.getMonth() + 1 + '', 2, '0'); + } + break; + case 'd': //日 + if (len > 1) { + str = String.leftPad(date.getDate() + '', 2, '0'); + } else { + str = date.getDate(); + } + break; + case 'h': //时(12) + var hour = date.getHours() % 12; + if (hour === 0) { + hour = 12; + } + if (len > 1) { + str = String.leftPad(hour + '', 2, '0'); + } else { + str = hour; + } + break; + case 'H': //时(24) + if (len > 1) { + str = String.leftPad(date.getHours() + '', 2, '0'); + } else { + str = date.getHours(); + } + break; + case 'm': + if (len > 1) { + str = String.leftPad(date.getMinutes() + '', 2, '0'); + } else { + str = date.getMinutes(); + } + break; + case 's': + if (len > 1) { + str = String.leftPad(date.getSeconds() + '', 2, '0'); + } else { + str = date.getSeconds(); + } + break; + case 'a': + str = date.getHours() < 12 ? 'am' : 'pm'; + break; + case 'z': + str = date.getTimezone(); + break; + default: + str = jfmt.str; + break; + } + return str; + } +}; + +/** + * 数字格式 + */ +BI._numberFormat = function (text, format) { + var text = text + ''; + //数字格式,区分正负数 + var numMod = format.indexOf(';'); + if (numMod > -1) { + if (text >= 0) { + return BI._numberFormat(text + "", format.substring(0, numMod)); + } else { + return BI._numberFormat((-text) + "", format.substr(numMod + 1)); + } + } + var tp = text.split('.'), fp = format.split('.'), + tleft = tp[0] || '', fleft = fp[0] || '', + tright = tp[1] || '', fright = fp[1] || ''; + //百分比,千分比的小数点移位处理 + if (/[%‰]$/.test(format)) { + var paddingZero = /[%]$/.test(format) ? '00' : '000'; + tright += paddingZero; + tleft += tright.substr(0, paddingZero.length); + tleft = tleft.replace(/^0+/gi, ''); + tright = tright.substr(paddingZero.length).replace(/0+$/gi, ''); + } + var right = BI._dealWithRight(tright, fright); + if (right.leftPlus) { + //小数点后有进位 + tleft = parseInt(tleft) + 1 + ''; + + tleft = isNaN(tleft) ? '1' : tleft; + } + right = right.num; + var left = BI._dealWithLeft(tleft, fleft); + if (!(/[0-9]/.test(left))) { + left = left + '0'; + } + if (!(/[0-9]/.test(right))) { + return left + right; + } else { + return left + '.' + right; + } +}; +/** + * 处理小数点右边小数部分 + * @param tright 右边内容 + * @param fright 右边格式 + * @returns {JSON} 返回处理结果和整数部分是否需要进位 + * @private + */ +BI._dealWithRight = function (tright, fright) { + var right = '', j = 0, i = 0; + for (var len = fright.length; i < len; i++) { + var ch = fright.charAt(i); + var c = tright.charAt(j); + switch (ch) { + case '0': + if (BI.isEmpty(c)) { + c = '0'; + } + right += c; + j++; + break; + case '#': + right += c; + j++; + break; + default : + right += ch; + break; + } + } + var rll = tright.substr(j); + var result = {}; + if (!BI.isEmpty(rll) && rll.charAt(0) > 4) { + //有多余字符,需要四舍五入 + result.leftPlus = true; + var numReg = right.match(/^[0-9]+/); + if (numReg) { + var num = numReg[0]; + var orilen = num.length; + var newnum = BI.parseINT(num) + 1 + ''; + //进位到整数部分 + if (newnum.length > orilen) { + newnum = newnum.substr(1); + } else { + newnum = BI.leftPad(newnum, orilen, '0'); + result.leftPlus = false; + } + right = right.replace(/^[0-9]+/, newnum); + } + } + result.num = right; + return result; +}; + +BI.parseINT = function (str) { + return parseInt(str, 10); +}; + +BI.leftPad = function (val, size, ch) { + var result = String(val); + if (!ch) { + ch = " "; + } + while (result.length < size) { + result = ch + result; + } + return result.toString(); +}; + +/** + * 处理小数点左边整数部分 + * @param tleft 左边内容 + * @param fleft 左边格式 + * @returns {string} 返回处理结果 + * @private + */ +BI._dealWithLeft = function (tleft, fleft) { + var left = ''; + var j = tleft.length - 1; + var combo = -1, last = -1; + var i = fleft.length - 1; + for (; i >= 0; i--) { + var ch = fleft.charAt(i); + var c = tleft.charAt(j); + switch (ch) { + case '0': + if (BI.isEmpty(c)) { + c = '0'; + } + last = -1; + left = c + left; + j--; + break; + case '#': + last = i; + left = c + left; + j--; + break; + case ',': + if (!BI.isEmpty(c)) { + //计算一个,分隔区间的长度 + var com = fleft.match(/,[#0]+/); + if (com) { + combo = com[0].length - 1; + } + left = ',' + left; + } + break; + default : + left = ch + left; + break; + } + } + if (last > -1) { + //处理剩余字符 + var tll = tleft.substr(0, j + 1); + left = left.substr(0, last) + tll + left.substr(last); + } + if (combo > 0) { + //处理,分隔区间 + var res = left.match(/[0-9]+,/); + if (res) { + res = res[0]; + var newstr = '', n = res.length - 1 - combo; + for (; n >= 0; n = n - combo) { + newstr = res.substr(n, combo) + ',' + newstr; + } + var lres = res.substr(0, n + combo); + if (!BI.isEmpty(lres)) { + newstr = lres + ',' + newstr; + } + } + left = left.replace(/[0-9]+,/, newstr); + } + return left; +}; + +BI.object2Number = function (value) { + if (value == null) { + return 0; + } + if (typeof value == 'number') { + return value; + } else { + var str = value + ""; + if (str.indexOf(".") === -1) { + return parseInt(str); + } else { + return parseFloat(str); + } + } +}; + +BI.object2Date = function (obj) { + if (obj == null) { + return new Date(); + } + if (obj instanceof Date) { + return obj; + } else if (typeof obj == 'number') { + return new Date(obj); + } else { + var str = obj + ""; + str = str.replace(/-/g, '/'); + var dt = new Date(str); + if (!BI.isInvalidDate(dt)) { + return dt; + } + + return new Date(); + } +}; + +BI.isArray = function (a) { + return Object.prototype.toString.call(a) == '[object Array]'; +}; + +BI.object2Time = function (obj) { + if (obj == null) { + return new Date(); + } + if (obj instanceof Date) { + return obj; + } else { + var str = obj + ""; + str = str.replace(/-/g, '/'); + var dt = new Date(str); + if (!BI.isInvalidDate(dt)) { + return dt; + } + if (str.indexOf('/') === -1 && str.indexOf(':') !== -1) { + dt = new Date("1970/01/01 " + str); + if (!BI.isInvalidDate(dt)) { + return dt; + } + } + dt = BI.str2Date(str, "HH:mm:ss"); + if (!BI.isInvalidDate(dt)) { + return dt; + } + return new Date(); + } +}; + +// 判断是否是无效的日期 +BI.isInvalidDate = function (date) { + return date == "Invalid Date" || date == "NaN"; +}; + + +/** + * 科学计数格式 + */ +BI._eFormat = function (text, fmt) { + var e = fmt.indexOf("E"); + var eleft = fmt.substr(0, e), eright = fmt.substr(e + 1); + if (/^[0\.-]+$/.test(text)) { + text = BI._numberFormat(0.0, eleft) + 'E' + BI._numberFormat(0, eright) + } else { + var isNegative = text < 0; + if (isNegative) { + text = text.substr(1); + } + var elvl = (eleft.split('.')[0] || '').length; + var point = text.indexOf("."); + if (point < 0) { + point = text.length; + } + var i = 0; //第一个不为0的数的位置 + text = text.replace('.', ''); + for (var len = text.length; i < len; i++) { + var ech = text.charAt(i); + if (ech <= '9' && ech >= '1') { + break; + } + } + var right = point - i - elvl; + var left = text.substr(i, elvl); + var dis = i + elvl - text.length; + if (dis > 0) { + //末位补全0 + for (var k = 0; k < dis; k++) { + left += '0'; + } + } else { + left += '.' + text.substr(i + elvl); + } + left = left.replace(/^[0]+/, ''); + if (right < 0 && eright.indexOf('-') < 0) { + eright += ';-' + eright; + } + text = BI._numberFormat(left, eleft) + 'E' + BI._numberFormat(right, eright); + if (isNegative) { + text = '-' + text; + } + } + return text; +};/** * guy * * @class BI.HighlightBehavior @@ -21940,7 +22507,7 @@ $(function () { }, getCompleteImageUrl: function (url) { - return FR.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + url; + return BI.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + url; } }); diff --git a/src/less/base/third/farbtastic/marker.png b/dist/farbtastic/marker.png similarity index 100% rename from src/less/base/third/farbtastic/marker.png rename to dist/farbtastic/marker.png diff --git a/src/less/base/third/farbtastic/mask.png b/dist/farbtastic/mask.png similarity index 100% rename from src/less/base/third/farbtastic/mask.png rename to dist/farbtastic/mask.png diff --git a/src/less/base/third/farbtastic/wheel.png b/dist/farbtastic/wheel.png similarity index 100% rename from src/less/base/third/farbtastic/wheel.png rename to dist/farbtastic/wheel.png diff --git a/dist/widget.js b/dist/widget.js index 057bfed2b..d3839ccaa 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -12981,7 +12981,7 @@ BI.UploadImage = BI.inherit(BI.Widget, { BI.extend(BI.UploadImage, { getImageSrc: function (src) { - return FR.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + src; + return BI.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + src; } }); @@ -30143,4 +30143,728 @@ BI.YearQuarterCombo = BI.inherit(BI.Widget, { } }); BI.YearQuarterCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; -$.shortcut('bi.year_quarter_combo', BI.YearQuarterCombo); \ No newline at end of file +$.shortcut('bi.year_quarter_combo', BI.YearQuarterCombo);/** + * 简单的复选下拉树控件, 适用于数据量少的情况 + * + * Created by GUY on 2015/10/29. + * @class BI.TreeValueChooserCombo + * @extends BI.Widget + */ +BI.TreeValueChooserCombo = BI.inherit(BI.Widget, { + + _const: { + perPage: 10 + }, + + _defaultConfig: function () { + return BI.extend(BI.TreeValueChooserCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-tree-value-chooser-combo", + width: 200, + height: 30, + items: null, + itemsCreator: BI.emptyFn + }); + }, + + _init: function () { + BI.TreeValueChooserCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + if (BI.isNotNull(o.items)) { + this._initData(o.items); + } + this.combo = BI.createWidget({ + type: 'bi.multi_tree_combo', + element: this.element, + itemsCreator: BI.bind(this._itemsCreator, this), + width: o.width, + height: o.height + }); + + this.combo.on(BI.MultiTreeCombo.EVENT_CONFIRM, function () { + self.fireEvent(BI.TreeValueChooserCombo.EVENT_CONFIRM); + }); + }, + + _initData: function (items) { + this.items = items; + var nodes = BI.Tree.transformToTreeFormat(items); + this.tree = new BI.Tree(); + this.tree.initTree(nodes); + this._initMap(); + this._initFloors(); + }, + + _initMap: function () { + var map = this.map = {}; + BI.each(this.items, function (i, item) { + map[item.value] = item; + }); + }, + + _initFloors: function () { + this.floors = -1; + var root = this.tree.getRoot(); + while (root) { + this.floors++; + root = root.getChildren()[0]; + } + }, + + _itemsCreator: function (options, callback) { + var self = this, o = this.options; + if (!this.items) { + o.itemsCreator({}, function (items) { + self._initData(items); + call(); + }); + } else { + call(); + } + function call() { + switch (options.type) { + case BI.TreeView.REQ_TYPE_INIT_DATA: + self._reqInitTreeNode(options, callback); + break; + case BI.TreeView.REQ_TYPE_ADJUST_DATA: + self._reqAdjustTreeNode(options, callback); + break; + case BI.TreeView.REQ_TYPE_CALCULATE_SELECT_DATA: + self._reqSelectedTreeNode(options, callback); + break; + case BI.TreeView.REQ_TYPE_SELECTED_DATA: + self._reqDisplayTreeNode(options, callback); + break; + default : + self._reqTreeNode(options, callback); + break; + } + } + }, + + _reqDisplayTreeNode: function (op, callback) { + var self = this; + var result = []; + var selected_values = op.selected_values; + + if (selected_values == null || BI.isEmpty(selected_values)) { + callback({}); + return; + } + + doCheck(0, [], selected_values); + + callback({ + items: result + }); + + function doCheck(floor, parent_values, selected) { + if (floor >= self.floors) { + return; + } + if (selected == null || BI.isEmpty(selected)) { + var children = self._getChildren(parent_values); + BI.each(children, function (i, child) { + var newParents = BI.clone(parent_values); + newParents.push(child.value); + var llen = self._getChildCount(newParents); + createOneJson(child, llen); + doCheck(floor + 1, newParents, {}); + }); + return; + } + BI.each(selected, function (k) { + var node = self._getNode(k); + var newParents = BI.clone(parent_values); + newParents.push(node.value); + createOneJson(node, getCount(selected[k], newParents)); + doCheck(floor + 1, newParents, selected[k]); + }) + } + + function getCount(jo, parent_values) { + if (jo == null) { + return 0; + } + if (BI.isEmpty(jo)) { + return self._getChildCount(parent_values); + } + + return BI.size(jo); + } + + function createOneJson(node, llen) { + result.push({ + id: node.id, + pId: node.pId, + text: node.text + (llen > 0 ? ("(" + BI.i18nText("BI-Basic_Altogether") + llen + BI.i18nText("BI-Basic_Count") + ")") : ""), + value: node.value, + open: true + }); + } + }, + + _reqSelectedTreeNode: function (op, callback) { + var self = this; + var selected_values = op.selected_values; + var not_selected_value = op.not_selected_value || {}; + var keyword = op.keyword || ""; + var parent_values = op.parent_values || []; + + if (selected_values == null || BI.isEmpty(selected_values)) { + callback({}); + return; + } + + dealWithSelectedValues(selected_values); + callback(selected_values); + + + function dealWithSelectedValues(selected_values) { + var p = BI.clone(parent_values); + p.push(not_selected_value); + + if (isChild(selected_values, p)) { + var result = []; + var finded = search(parent_values.length + 1, parent_values, not_selected_value, result); + + if (finded === true) { + var next = selected_values; + BI.each(p, function (i, v) { + var t = next[v]; + if (t == null) { + if (BI.isEmpty(next)) { + var split = p.slice(0, i); + var expanded = self._getChildren(split); + BI.each(expanded, function (m, child) { + if (i === p.length - 1 && child.value === not_selected_value) { + return true; + } + next[child.value] = {}; + }); + next = next[v]; + } else { + next = {}; + next[v] = {}; + } + } else { + next = t; + } + }); + + if (result.length > 0) { + BI.each(result, function (i, strs) { + self._buildTree(selected_values, strs); + }) + } + } + } + + } + + function search(deep, parents, current, result) { + var newParents = BI.clone(parents); + newParents.push(current); + if (self._isMatch(current, keyword)) { + return true; + } + if (deep >= self.floors) { + return false; + } + + var children = self._getChildren(newParents); + + var notSearch = []; + var can = false; + + BI.each(children, function (i, child) { + if (search(deep + 1, newParents, child.value, result)) { + can = true; + } else { + notSearch.push(child.value); + } + }); + if (can === true) { + BI.each(notSearch, function (i, v) { + var next = BI.clone(newParents); + next.push(v); + result.push(next); + }); + } + return can; + } + + function isChild(selected_values, parents) { + var t = selected_values; + for (var i = 0; i < parents.length; i++) { + var v = parents[i]; + if (!BI.has(t, v)) { + return false; + } + t = t[v]; + if (t == null || BI.isEmpty(t)) { + return true; + } + } + return true; + } + }, + + _reqAdjustTreeNode: function (op, callback) { + var self = this; + var result = []; + var selected_values = op.selected_values; + if (selected_values == null || BI.isEmpty(selected_values)) { + callback({}); + return; + } + BI.each(selected_values, function (k, v) { + result.push([k]); + }); + + dealWithSelectedValues(selected_values, []); + + var jo = {}; + BI.each(result, function (i, strs) { + self._buildTree(jo, strs); + }); + callback(jo); + + function dealWithSelectedValues(selected, parents) { + if (selected == null || BI.isEmpty(selected)) { + return true; + } + var can = true; + BI.each(selected, function (k, v) { + var p = BI.clone(parents); + p.push(k); + if (!dealWithSelectedValues(selected[k], p)) { + BI.each(selected[k], function (nk, nv) { + var t = BI.clone(p); + t.push(nk); + result.push(t); + }); + can = false; + } + }); + return can && isAllSelected(selected, parents); + } + + function isAllSelected(selected, parents) { + return BI.isEmpty(selected) || self._getChildCount(parents) === BI.size(selected); + } + }, + + _reqInitTreeNode: function (op, callback) { + var self = this; + var result = []; + var keyword = op.keyword || ""; + var selected_values = op.selected_values; + var last_search_value = op.last_search_value || ""; + var output = search(); + BI.nextTick(function () { + callback({ + hasNext: output.length > self._const.perPage, + items: result, + last_search_value: BI.last(output) + }) + }); + + function search() { + var children = self._getChildren([]); + var start = children.length; + if (last_search_value !== "") { + for (var j = 0, len = start; j < len; j++) { + if (children[j].value === last_search_value) { + start = j + 1; + break; + } + } + } else { + start = 0; + } + var output = []; + for (var i = start, len = children.length; i < len; i++) { + if (output.length < self._const.perPage) { + var find = nodeSearch(1, [], children[i].value, false, result); + } else if (output.length === self._const.perPage) { + var find = nodeSearch(1, [], children[i].value, false, []); + } + if (find[0] === true) { + output.push(children[i].value); + } + if (output.length > self._const.perPage) { + break; + } + } + return output; + } + + function nodeSearch(deep, parent_values, current, isAllSelect, result) { + if (self._isMatch(current, keyword)) { + var checked = isAllSelect || isSelected(parent_values, current); + createOneJson(parent_values, current, false, checked, !isAllSelect && isHalf(parent_values, current), true, result); + return [true, checked]; + } + if (deep >= self.floors) { + return [false, false]; + } + var newParents = BI.clone(parent_values); + newParents.push(current); + var children = self._getChildren(newParents); + + var can = false, checked = false; + + var isCurAllSelected = isAllSelect || isAllSelected(parent_values, current); + BI.each(children, function (i, child) { + var state = nodeSearch(deep + 1, newParents, child.value, isCurAllSelected, result); + if (state[1] === true) { + checked = true; + } + if (state[0] === true) { + can = true; + } + }); + if (can === true) { + checked = isCurAllSelected || (isSelected(parent_values, current) && checked); + createOneJson(parent_values, current, true, checked, false, false, result); + } + return [can, checked]; + } + + function createOneJson(parent_values, value, isOpen, checked, half, flag, result) { + var node = self.map[value]; + result.push({ + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + title: node.title, + isParent: parent_values.length + 1 < self.floors, + open: isOpen, + checked: checked, + halfCheck: half, + flag: flag + }); + } + + function isHalf(parent_values, value) { + var find = findSelectedObj(parent_values); + if (find == null) { + return null; + } + return BI.any(find, function (v, ob) { + if (v === value) { + if (ob != null && !BI.isEmpty(ob)) { + return true; + } + } + }); + } + + function isAllSelected(parent_values, value) { + var find = findSelectedObj(parent_values); + if (find == null) { + return null; + } + return BI.any(find, function (v, ob) { + if (v === value) { + if (ob != null && BI.isEmpty(ob)) { + return true; + } + } + }); + } + + function isSelected(parent_values, value) { + var find = findSelectedObj(parent_values); + if (find == null) { + return false; + } + return BI.any(find, function (v) { + if (v === value) { + return true; + } + }); + } + + function findSelectedObj(parent_values) { + var find = selected_values; + if (find == null) { + return null; + } + BI.every(parent_values, function (i, v) { + find = find[v]; + if (find == null) { + return false; + } + return true; + }); + return find; + } + }, + + _reqTreeNode: function (op, callback) { + var self = this; + var result = []; + var times = op.times; + var check_state = op.check_state || {}; + var parent_values = op.parent_values || []; + var selected_values = op.selected_values; + var valueMap = {}; + if (judgeState(parent_values, selected_values, check_state)) { + valueMap = dealWidthSelectedValue(parent_values, selected_values); + } + var nodes = this._getChildren(parent_values); + for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) { + var state = getCheckState(nodes[i].value, parent_values, valueMap, check_state); + result.push({ + id: nodes[i].id, + pId: nodes[i].pId, + value: nodes[i].value, + text: nodes[i].text, + times: 1, + isParent: parent_values.length + 1 < this.floors, + checked: state[0], + halfCheck: state[1] + }) + } + BI.nextTick(function () { + callback({ + items: result, + hasNext: nodes.length > times * self._const.perPage + }); + }); + + function judgeState(parent_values, selected_value, check_state) { + var checked = check_state.checked, half = check_state.half; + if (parent_values.length > 0 && !checked) { + return false; + } + return (parent_values.length === 0 || (checked && half) && !BI.isEmpty(selected_value)); + } + + function dealWidthSelectedValue(parent_values, selected_values) { + var valueMap = {}; + BI.each(parent_values, function (i, v) { + selected_values = selected_values[v]; + }); + BI.each(selected_values, function (value, obj) { + if (BI.isNull(obj)) { + valueMap[value] = [0, 0]; + return; + } + if (BI.isEmpty(obj)) { + valueMap[value] = [2, 0]; + return; + } + var nextNames = {}; + BI.each(obj, function (t, o) { + if (BI.isNull(o) || BI.isEmpty(o)) { + nextNames[t] = true; + } + }); + valueMap[value] = [1, BI.size(nextNames)]; + }); + return valueMap; + } + + function getCheckState(current, parent_values, valueMap, check_state) { + var checked = check_state.checked, half = check_state.half; + var hasChild = parent_values.length + 1 < self.floors; + var tempCheck = false, halfCheck = false; + if (BI.has(valueMap, current)) { + //可能是半选 + if (valueMap[current][0] === 1) { + var values = BI.clone(parent_values); + values.push(current); + if (hasChild && self._getChildCount(values) != valueMap[current][1]) { + halfCheck = true; + } + } else if (valueMap[current][0] === 2) { + tempCheck = true; + } + } + var check; + if (!checked && !halfCheck && !tempCheck) { + check = BI.has(valueMap, current); + } else { + check = ((tempCheck || checked) && !half) || BI.has(valueMap, current); + } + return [check, halfCheck]; + } + }, + + + _buildTree: function (jo, values) { + var t = jo; + BI.each(values, function (i, v) { + if (!BI.has(t, v)) { + t[v] = {}; + } + t = t[v]; + }); + }, + + _isMatch: function (value, keyword) { + var finded = BI.Func.getSearchResult([value], keyword); + return finded.finded.length > 0 || finded.matched.length > 0; + }, + + _getNode: function (v) { + return this.tree.search(v, "value"); + }, + + _getChildren: function (parent_values) { + if (parent_values.length > 0) { + var value = BI.last(parent_values); + var parent = this.tree.search(value, "value"); + } else { + var parent = this.tree.getRoot(); + } + return parent.getChildren(); + }, + + _getChildCount: function (parent_values) { + return this._getChildren(parent_values).length; + }, + + setValue: function (v) { + this.combo.setValue(v); + }, + + getValue: function () { + return this.combo.getValue(); + }, + + populate: function () { + this.combo.populate.apply(this, arguments); + } +}); +BI.TreeValueChooserCombo.EVENT_CONFIRM = "TreeValueChooserCombo.EVENT_CONFIRM"; +$.shortcut('bi.tree_value_chooser_combo', BI.TreeValueChooserCombo);/** + * 简单的复选下拉框控件, 适用于数据量少的情况 + * 封装了字段处理逻辑 + * + * Created by GUY on 2015/10/29. + * @class BI.ValueChooserCombo + * @extends BI.Widget + */ +BI.ValueChooserCombo = BI.inherit(BI.Widget, { + + _const: { + perPage: 10 + }, + _defaultConfig: function () { + return BI.extend(BI.ValueChooserCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-value-chooser-combo", + width: 200, + height: 30, + items: null, + itemsCreator: BI.emptyFn, + cache: true + }); + }, + + _init: function () { + BI.ValueChooserCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + if (BI.isNotNull(o.items)) { + this.items = o.items; + } + this.combo = BI.createWidget({ + type: 'bi.multi_select_combo', + element: this.element, + itemsCreator: BI.bind(this._itemsCreator, this), + valueFormatter: function (v) { + var text = v; + if (BI.isNotNull(self.items)) { + BI.some(self.items, function (i, item) { + if (item.value === v) { + text = item.text; + return true; + } + }); + } + return text; + }, + width: o.width, + height: o.height + }); + + this.combo.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () { + self.fireEvent(BI.ValueChooserCombo.EVENT_CONFIRM); + }); + }, + + _getItemsByTimes: function (items, times) { + var res = []; + for (var i = (times - 1) * this._const.perPage; items[i] && i < times * this._const.perPage; i++) { + res.push(items[i]); + } + return res; + }, + + _hasNextByTimes: function (items, times) { + return times * this._const.perPage < items.length; + }, + + _itemsCreator: function (options, callback) { + var self = this, o = this.options; + if (!o.cache || !this.items) { + o.itemsCreator({}, function (items) { + self.items = items; + call(items); + }); + } else { + call(this.items); + } + function call(items) { + var keywords = (options.keywords || []).slice(); + if (options.keyword) { + keywords.push(options.keyword); + } + BI.each(keywords, function (i, kw) { + var search = BI.Func.getSearchResult(items, kw); + items = search.matched.concat(search.finded); + }); + if (options.selected_values) {//过滤 + var filter = BI.makeObject(options.selected_values, true); + items = BI.filter(items, function (i, ob) { + return !filter[ob.value]; + }); + } + if (options.type == BI.MultiSelectCombo.REQ_GET_ALL_DATA) { + callback({ + items: items + }); + return; + } + if (options.type == BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { + callback({count: items.length}); + return; + } + callback({ + items: self._getItemsByTimes(items, options.times), + hasNext: self._hasNextByTimes(items, options.times) + }); + } + }, + + setValue: function (v) { + this.combo.setValue(v); + }, + + getValue: function () { + var val = this.combo.getValue() || {}; + return { + type: val.type, + value: val.value + } + }, + + populate: function () { + this.combo.populate.apply(this, arguments); + } +}); +BI.ValueChooserCombo.EVENT_CONFIRM = "ValueChooserCombo.EVENT_CONFIRM"; +$.shortcut('bi.value_chooser_combo', BI.ValueChooserCombo); \ No newline at end of file diff --git a/src/less/base/third/ztree/img/line_conn.gif b/dist/ztree/img/line_conn.gif similarity index 100% rename from src/less/base/third/ztree/img/line_conn.gif rename to dist/ztree/img/line_conn.gif diff --git a/src/less/base/third/ztree/img/loading.gif b/dist/ztree/img/loading.gif similarity index 100% rename from src/less/base/third/ztree/img/loading.gif rename to dist/ztree/img/loading.gif diff --git a/src/less/base/third/ztree/img/zTreeStandard.gif b/dist/ztree/img/zTreeStandard.gif similarity index 100% rename from src/less/base/third/ztree/img/zTreeStandard.gif rename to dist/ztree/img/zTreeStandard.gif diff --git a/src/less/base/third/ztree/img/zTreeStandard.png b/dist/ztree/img/zTreeStandard.png similarity index 100% rename from src/less/base/third/ztree/img/zTreeStandard.png rename to dist/ztree/img/zTreeStandard.png diff --git a/src/base/farbtastic/farbtastic.js b/src/base/farbtastic/farbtastic.js index a243d31ee..ad49b5439 100644 --- a/src/base/farbtastic/farbtastic.js +++ b/src/base/farbtastic/farbtastic.js @@ -18,8 +18,8 @@ BI.Farbtastic = BI.inherit(BI.Widget, { _init: function () { BI.Farbtastic.superclass._init.apply(this, arguments); var self = this; - FR.$defaultImport('/com/fr/bi/web/js/third/farbtastic.js', 'js'); - FR.$defaultImport('/com/fr/bi/web/css/base/third/farbtastic/farbtastic.css', 'css'); + + this.farbtastic = $.farbtastic(this.element, function (v) { self.fireEvent(BI.Farbtastic.EVENT_CHANGE, self.getValue(), self); diff --git a/src/base/foundation/bi.message.js b/src/base/foundation/bi.message.js index e79e1bae7..1c17c2e1e 100644 --- a/src/base/foundation/bi.message.js +++ b/src/base/foundation/bi.message.js @@ -16,7 +16,7 @@ $.extend(BI, { this._show(true, title, message, callback); }, prompt: function (title, message, value, callback, min_width) { - FR.Msg.prompt(title, message, value, callback, min_width); + BI.Msg.prompt(title, message, value, callback, min_width); }, toast: function (message, level, context) { context = context || $("body"); diff --git a/src/base/single/input/file.js b/src/base/single/input/file.js index 2aa47b878..d1faf94d0 100644 --- a/src/base/single/input/file.js +++ b/src/base/single/input/file.js @@ -84,7 +84,7 @@ var multipart = function (boundary, name, file) { return "--".concat( boundary, CRLF, - 'Content-Disposition: form-data; name="', name, '"; filename="', FR.cjkEncode(file.fileName), '"', CRLF, + 'Content-Disposition: form-data; name="', name, '"; filename="', BI.cjkEncode(file.fileName), '"', CRLF, "Content-Type: application/octet-stream", CRLF, CRLF, file.getAsBinary(), CRLF, @@ -153,7 +153,7 @@ }, false ); - xhr.open("post", handler.url + '&filename=' + FR.cjkEncode(handler.file.fileName), true); + xhr.open("post", handler.url + '&filename=' + BI.cjkEncode(handler.file.fileName), true); if (!xhr.upload) { var rpe = {loaded: 0, total: handler.file.fileSize || handler.file.size, simulation: true}; rpe.interval = setInterval(function () { @@ -184,8 +184,8 @@ upload.onprogress(rpe); if (199 < xhr.status && xhr.status < 400) { upload["onload"]({}); - var attachO = FR.jsonDecode(xhr.responseText); - attachO.filename = FR.cjkDecode(handler.file.fileName); + var attachO = BI.jsonDecode(xhr.responseText); + attachO.filename = BI.cjkDecode(handler.file.fileName); if (handler.file.type.indexOf('image') != -1) { attachO.attach_type = "image"; } @@ -201,7 +201,7 @@ xhr.onreadystatechange = function () { switch (xhr.readyState) { case 4: - var attachO = FR.jsonDecode(xhr.responseText); + var attachO = BI.jsonDecode(xhr.responseText); if (handler.file.type.indexOf('image') != -1) { attachO.attach_type = "image"; } @@ -251,13 +251,13 @@ //rpe.loaded = rpe.total; try { var responseText = (iframe.contentWindow.document || iframe.contentWindow.contentDocument).body.innerHTML; - var attachO = FR.jsonDecode(responseText); + var attachO = BI.jsonDecode(responseText); if (handler.file.type.indexOf('image') != -1) { attachO.attach_type = "image"; } //attachO.fileSize = responseText.length; - attachO.filename = FR.cjkDecode(handler.file.fileName); + attachO.filename = BI.cjkDecode(handler.file.fileName); if (handler.maxlength == 1) { handler.attach_array[0] = attachO; } else { @@ -474,7 +474,7 @@ // enable again the submit button/element }, 1000); }; - _wrap.url = o.url ? o.url : FR.servletURL + _wrap.url = o.url ? o.url : BI.servletURL + '?op=fr_attach&cmd=ah_upload'; _wrap.fileType = o.accept; //文件类型限制 _wrap.attach_array = []; diff --git a/src/base/tree/synctree.js b/src/base/tree/synctree.js index 52486fa83..a0d04cfc3 100644 --- a/src/base/tree/synctree.js +++ b/src/base/tree/synctree.js @@ -19,7 +19,7 @@ BI.SyncTree = BI.inherit(BI.TreeView, { var setting = { async: { enable: false, - otherParam: FR.cjkEncodeDO(paras) + otherParam: BI.cjkEncodeDO(paras) }, check: { enable: true diff --git a/src/base/tree/treeview.js b/src/base/tree/treeview.js index c65c5e730..f39a22c70 100644 --- a/src/base/tree/treeview.js +++ b/src/base/tree/treeview.js @@ -14,9 +14,9 @@ BI.TreeView = BI.inherit(BI.Pane, { }, _init: function () { BI.TreeView.superclass._init.apply(this, arguments); - FR.$defaultImport('/com/fr/bi/web/js/third/ztree/jquery.ztree.core-3.5.js', 'js'); - FR.$defaultImport('/com/fr/bi/web/js/third/ztree/jquery.ztree.excheck-3.5.js', 'js'); - FR.$defaultImport('/com/fr/bi/web/css/base/third/ztree/zTreeStyle.css', 'css'); + + + this._stop = false; this.container = BI.createWidget(); @@ -71,7 +71,7 @@ BI.TreeView = BI.inherit(BI.Pane, { enable: true, url: getUrl, autoParam: ["id", "name"], - otherParam: FR.cjkEncodeDO(paras) + otherParam: BI.cjkEncodeDO(paras) }, check: { enable: true @@ -113,10 +113,10 @@ BI.TreeView = BI.inherit(BI.Pane, { treeNode.times = treeNode.times || 1; var param = "id=" + treeNode.id + "×=" + (treeNode.times++) - + "&parent_values= " + window.encodeURIComponent(FR.jsonEncode(parentNode)) - + "&check_state=" + window.encodeURIComponent(FR.jsonEncode(treeNode.getCheckStatus())); + + "&parent_values= " + window.encodeURIComponent(BI.jsonEncode(parentNode)) + + "&check_state=" + window.encodeURIComponent(BI.jsonEncode(treeNode.getCheckStatus())); - return FR.servletURL + '?op=' + self.options.op + '&cmd=' + self.options.cmd + "&" + param; + return BI.servletURL + '?op=' + self.options.op + '&cmd=' + self.options.cmd + "&" + param; } function beforeExpand(treeId, treeNode) { @@ -165,7 +165,7 @@ BI.TreeView = BI.inherit(BI.Pane, { function ajaxGetNodes(treeNode, reloadType) { var zTree = self.nodes; if (reloadType == "refresh") { - //treeNode.icon = FR.servletURL +"?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/loading.gif"; + //treeNode.icon = BI.servletURL +"?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/loading.gif"; zTree.updateNode(treeNode); } zTree.reAsyncChildNodes(treeNode, reloadType, true); diff --git a/src/case/logintimeout/login.timeout.js b/src/case/logintimeout/login.timeout.js index 17dbafd01..075d5c740 100644 --- a/src/case/logintimeout/login.timeout.js +++ b/src/case/logintimeout/login.timeout.js @@ -130,9 +130,9 @@ BI.LoginTimeOut = BI.inherit(BI.BarPopoverSection, { } //反正是登录直接用FR的登录了 - FR.ajax({ - url: FR.servletURL + '?op=fs_load&cmd=login', - data: FR.cjkEncodeDO({ + BI.ajax({ + url: BI.servletURL + '?op=fs_load&cmd=login', + data: BI.cjkEncodeDO({ fr_username: encodeURIComponent(userNameInput.getValue()), fr_password: encodeURIComponent(passwordInput.getValue()), fr_remember: self.keepLoginState.isSelected() @@ -147,7 +147,7 @@ BI.LoginTimeOut = BI.inherit(BI.BarPopoverSection, { self._showMes(userNameMask, BI.i18nText("BI-Authentication_Failed")); return; } - var signResult = FR.jsonDecode(res.responseText); + var signResult = BI.jsonDecode(res.responseText); if (signResult.fail) { //用户名和密码不匹配 self._showMes(userNameMask, BI.i18nText("BI-Username_Password_Not_Correct")); @@ -171,7 +171,7 @@ BI.LoginTimeOut = BI.inherit(BI.BarPopoverSection, { type: "bi.center_adapt", items: [{ type: "bi.img", - src: FR.servletURL + (logo ? + src: BI.servletURL + (logo ? '?op=fr_attach&cmd=ah_image&id=' + logo + '&isAdjust=false' : '?op=resource&resource=/com/fr/bi/web/images/login/bi_logo.png'), width: 120, diff --git a/src/case/zclip/zclip.js b/src/case/zclip/zclip.js index ee4b724f2..c2c527f03 100644 --- a/src/case/zclip/zclip.js +++ b/src/case/zclip/zclip.js @@ -16,10 +16,10 @@ BI.ZeroClip = BI.inherit(BI.BasicButton, { _init: function () { BI.ZeroClip.superclass._init.apply(this, arguments); var self = this, o = this.options; - FR.$defaultImport('/com/fr/bi/web/js/third/jquery.zclip.js', 'js'); + BI.nextTick(function () { self.element.zclip({ - path: FR.servletURL + "?op=resource&resource=/com/fr/bi/web/resources/ZeroClipboard.swf", + path: BI.servletURL + "?op=resource&resource=/com/fr/bi/web/resources/ZeroClipboard.swf", copy: o.copy, beforeCopy: o.beforeCopy, afterCopy: o.afterCopy diff --git a/src/component/combo.treevaluechooser.js b/src/component/combo.treevaluechooser.js new file mode 100644 index 000000000..e0011cbf7 --- /dev/null +++ b/src/component/combo.treevaluechooser.js @@ -0,0 +1,599 @@ +/** + * 简单的复选下拉树控件, 适用于数据量少的情况 + * + * Created by GUY on 2015/10/29. + * @class BI.TreeValueChooserCombo + * @extends BI.Widget + */ +BI.TreeValueChooserCombo = BI.inherit(BI.Widget, { + + _const: { + perPage: 10 + }, + + _defaultConfig: function () { + return BI.extend(BI.TreeValueChooserCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-tree-value-chooser-combo", + width: 200, + height: 30, + items: null, + itemsCreator: BI.emptyFn + }); + }, + + _init: function () { + BI.TreeValueChooserCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + if (BI.isNotNull(o.items)) { + this._initData(o.items); + } + this.combo = BI.createWidget({ + type: 'bi.multi_tree_combo', + element: this.element, + itemsCreator: BI.bind(this._itemsCreator, this), + width: o.width, + height: o.height + }); + + this.combo.on(BI.MultiTreeCombo.EVENT_CONFIRM, function () { + self.fireEvent(BI.TreeValueChooserCombo.EVENT_CONFIRM); + }); + }, + + _initData: function (items) { + this.items = items; + var nodes = BI.Tree.transformToTreeFormat(items); + this.tree = new BI.Tree(); + this.tree.initTree(nodes); + this._initMap(); + this._initFloors(); + }, + + _initMap: function () { + var map = this.map = {}; + BI.each(this.items, function (i, item) { + map[item.value] = item; + }); + }, + + _initFloors: function () { + this.floors = -1; + var root = this.tree.getRoot(); + while (root) { + this.floors++; + root = root.getChildren()[0]; + } + }, + + _itemsCreator: function (options, callback) { + var self = this, o = this.options; + if (!this.items) { + o.itemsCreator({}, function (items) { + self._initData(items); + call(); + }); + } else { + call(); + } + function call() { + switch (options.type) { + case BI.TreeView.REQ_TYPE_INIT_DATA: + self._reqInitTreeNode(options, callback); + break; + case BI.TreeView.REQ_TYPE_ADJUST_DATA: + self._reqAdjustTreeNode(options, callback); + break; + case BI.TreeView.REQ_TYPE_CALCULATE_SELECT_DATA: + self._reqSelectedTreeNode(options, callback); + break; + case BI.TreeView.REQ_TYPE_SELECTED_DATA: + self._reqDisplayTreeNode(options, callback); + break; + default : + self._reqTreeNode(options, callback); + break; + } + } + }, + + _reqDisplayTreeNode: function (op, callback) { + var self = this; + var result = []; + var selected_values = op.selected_values; + + if (selected_values == null || BI.isEmpty(selected_values)) { + callback({}); + return; + } + + doCheck(0, [], selected_values); + + callback({ + items: result + }); + + function doCheck(floor, parent_values, selected) { + if (floor >= self.floors) { + return; + } + if (selected == null || BI.isEmpty(selected)) { + var children = self._getChildren(parent_values); + BI.each(children, function (i, child) { + var newParents = BI.clone(parent_values); + newParents.push(child.value); + var llen = self._getChildCount(newParents); + createOneJson(child, llen); + doCheck(floor + 1, newParents, {}); + }); + return; + } + BI.each(selected, function (k) { + var node = self._getNode(k); + var newParents = BI.clone(parent_values); + newParents.push(node.value); + createOneJson(node, getCount(selected[k], newParents)); + doCheck(floor + 1, newParents, selected[k]); + }) + } + + function getCount(jo, parent_values) { + if (jo == null) { + return 0; + } + if (BI.isEmpty(jo)) { + return self._getChildCount(parent_values); + } + + return BI.size(jo); + } + + function createOneJson(node, llen) { + result.push({ + id: node.id, + pId: node.pId, + text: node.text + (llen > 0 ? ("(" + BI.i18nText("BI-Basic_Altogether") + llen + BI.i18nText("BI-Basic_Count") + ")") : ""), + value: node.value, + open: true + }); + } + }, + + _reqSelectedTreeNode: function (op, callback) { + var self = this; + var selected_values = op.selected_values; + var not_selected_value = op.not_selected_value || {}; + var keyword = op.keyword || ""; + var parent_values = op.parent_values || []; + + if (selected_values == null || BI.isEmpty(selected_values)) { + callback({}); + return; + } + + dealWithSelectedValues(selected_values); + callback(selected_values); + + + function dealWithSelectedValues(selected_values) { + var p = BI.clone(parent_values); + p.push(not_selected_value); + + if (isChild(selected_values, p)) { + var result = []; + var finded = search(parent_values.length + 1, parent_values, not_selected_value, result); + + if (finded === true) { + var next = selected_values; + BI.each(p, function (i, v) { + var t = next[v]; + if (t == null) { + if (BI.isEmpty(next)) { + var split = p.slice(0, i); + var expanded = self._getChildren(split); + BI.each(expanded, function (m, child) { + if (i === p.length - 1 && child.value === not_selected_value) { + return true; + } + next[child.value] = {}; + }); + next = next[v]; + } else { + next = {}; + next[v] = {}; + } + } else { + next = t; + } + }); + + if (result.length > 0) { + BI.each(result, function (i, strs) { + self._buildTree(selected_values, strs); + }) + } + } + } + + } + + function search(deep, parents, current, result) { + var newParents = BI.clone(parents); + newParents.push(current); + if (self._isMatch(current, keyword)) { + return true; + } + if (deep >= self.floors) { + return false; + } + + var children = self._getChildren(newParents); + + var notSearch = []; + var can = false; + + BI.each(children, function (i, child) { + if (search(deep + 1, newParents, child.value, result)) { + can = true; + } else { + notSearch.push(child.value); + } + }); + if (can === true) { + BI.each(notSearch, function (i, v) { + var next = BI.clone(newParents); + next.push(v); + result.push(next); + }); + } + return can; + } + + function isChild(selected_values, parents) { + var t = selected_values; + for (var i = 0; i < parents.length; i++) { + var v = parents[i]; + if (!BI.has(t, v)) { + return false; + } + t = t[v]; + if (t == null || BI.isEmpty(t)) { + return true; + } + } + return true; + } + }, + + _reqAdjustTreeNode: function (op, callback) { + var self = this; + var result = []; + var selected_values = op.selected_values; + if (selected_values == null || BI.isEmpty(selected_values)) { + callback({}); + return; + } + BI.each(selected_values, function (k, v) { + result.push([k]); + }); + + dealWithSelectedValues(selected_values, []); + + var jo = {}; + BI.each(result, function (i, strs) { + self._buildTree(jo, strs); + }); + callback(jo); + + function dealWithSelectedValues(selected, parents) { + if (selected == null || BI.isEmpty(selected)) { + return true; + } + var can = true; + BI.each(selected, function (k, v) { + var p = BI.clone(parents); + p.push(k); + if (!dealWithSelectedValues(selected[k], p)) { + BI.each(selected[k], function (nk, nv) { + var t = BI.clone(p); + t.push(nk); + result.push(t); + }); + can = false; + } + }); + return can && isAllSelected(selected, parents); + } + + function isAllSelected(selected, parents) { + return BI.isEmpty(selected) || self._getChildCount(parents) === BI.size(selected); + } + }, + + _reqInitTreeNode: function (op, callback) { + var self = this; + var result = []; + var keyword = op.keyword || ""; + var selected_values = op.selected_values; + var last_search_value = op.last_search_value || ""; + var output = search(); + BI.nextTick(function () { + callback({ + hasNext: output.length > self._const.perPage, + items: result, + last_search_value: BI.last(output) + }) + }); + + function search() { + var children = self._getChildren([]); + var start = children.length; + if (last_search_value !== "") { + for (var j = 0, len = start; j < len; j++) { + if (children[j].value === last_search_value) { + start = j + 1; + break; + } + } + } else { + start = 0; + } + var output = []; + for (var i = start, len = children.length; i < len; i++) { + if (output.length < self._const.perPage) { + var find = nodeSearch(1, [], children[i].value, false, result); + } else if (output.length === self._const.perPage) { + var find = nodeSearch(1, [], children[i].value, false, []); + } + if (find[0] === true) { + output.push(children[i].value); + } + if (output.length > self._const.perPage) { + break; + } + } + return output; + } + + function nodeSearch(deep, parent_values, current, isAllSelect, result) { + if (self._isMatch(current, keyword)) { + var checked = isAllSelect || isSelected(parent_values, current); + createOneJson(parent_values, current, false, checked, !isAllSelect && isHalf(parent_values, current), true, result); + return [true, checked]; + } + if (deep >= self.floors) { + return [false, false]; + } + var newParents = BI.clone(parent_values); + newParents.push(current); + var children = self._getChildren(newParents); + + var can = false, checked = false; + + var isCurAllSelected = isAllSelect || isAllSelected(parent_values, current); + BI.each(children, function (i, child) { + var state = nodeSearch(deep + 1, newParents, child.value, isCurAllSelected, result); + if (state[1] === true) { + checked = true; + } + if (state[0] === true) { + can = true; + } + }); + if (can === true) { + checked = isCurAllSelected || (isSelected(parent_values, current) && checked); + createOneJson(parent_values, current, true, checked, false, false, result); + } + return [can, checked]; + } + + function createOneJson(parent_values, value, isOpen, checked, half, flag, result) { + var node = self.map[value]; + result.push({ + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + title: node.title, + isParent: parent_values.length + 1 < self.floors, + open: isOpen, + checked: checked, + halfCheck: half, + flag: flag + }); + } + + function isHalf(parent_values, value) { + var find = findSelectedObj(parent_values); + if (find == null) { + return null; + } + return BI.any(find, function (v, ob) { + if (v === value) { + if (ob != null && !BI.isEmpty(ob)) { + return true; + } + } + }); + } + + function isAllSelected(parent_values, value) { + var find = findSelectedObj(parent_values); + if (find == null) { + return null; + } + return BI.any(find, function (v, ob) { + if (v === value) { + if (ob != null && BI.isEmpty(ob)) { + return true; + } + } + }); + } + + function isSelected(parent_values, value) { + var find = findSelectedObj(parent_values); + if (find == null) { + return false; + } + return BI.any(find, function (v) { + if (v === value) { + return true; + } + }); + } + + function findSelectedObj(parent_values) { + var find = selected_values; + if (find == null) { + return null; + } + BI.every(parent_values, function (i, v) { + find = find[v]; + if (find == null) { + return false; + } + return true; + }); + return find; + } + }, + + _reqTreeNode: function (op, callback) { + var self = this; + var result = []; + var times = op.times; + var check_state = op.check_state || {}; + var parent_values = op.parent_values || []; + var selected_values = op.selected_values; + var valueMap = {}; + if (judgeState(parent_values, selected_values, check_state)) { + valueMap = dealWidthSelectedValue(parent_values, selected_values); + } + var nodes = this._getChildren(parent_values); + for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) { + var state = getCheckState(nodes[i].value, parent_values, valueMap, check_state); + result.push({ + id: nodes[i].id, + pId: nodes[i].pId, + value: nodes[i].value, + text: nodes[i].text, + times: 1, + isParent: parent_values.length + 1 < this.floors, + checked: state[0], + halfCheck: state[1] + }) + } + BI.nextTick(function () { + callback({ + items: result, + hasNext: nodes.length > times * self._const.perPage + }); + }); + + function judgeState(parent_values, selected_value, check_state) { + var checked = check_state.checked, half = check_state.half; + if (parent_values.length > 0 && !checked) { + return false; + } + return (parent_values.length === 0 || (checked && half) && !BI.isEmpty(selected_value)); + } + + function dealWidthSelectedValue(parent_values, selected_values) { + var valueMap = {}; + BI.each(parent_values, function (i, v) { + selected_values = selected_values[v]; + }); + BI.each(selected_values, function (value, obj) { + if (BI.isNull(obj)) { + valueMap[value] = [0, 0]; + return; + } + if (BI.isEmpty(obj)) { + valueMap[value] = [2, 0]; + return; + } + var nextNames = {}; + BI.each(obj, function (t, o) { + if (BI.isNull(o) || BI.isEmpty(o)) { + nextNames[t] = true; + } + }); + valueMap[value] = [1, BI.size(nextNames)]; + }); + return valueMap; + } + + function getCheckState(current, parent_values, valueMap, check_state) { + var checked = check_state.checked, half = check_state.half; + var hasChild = parent_values.length + 1 < self.floors; + var tempCheck = false, halfCheck = false; + if (BI.has(valueMap, current)) { + //可能是半选 + if (valueMap[current][0] === 1) { + var values = BI.clone(parent_values); + values.push(current); + if (hasChild && self._getChildCount(values) != valueMap[current][1]) { + halfCheck = true; + } + } else if (valueMap[current][0] === 2) { + tempCheck = true; + } + } + var check; + if (!checked && !halfCheck && !tempCheck) { + check = BI.has(valueMap, current); + } else { + check = ((tempCheck || checked) && !half) || BI.has(valueMap, current); + } + return [check, halfCheck]; + } + }, + + + _buildTree: function (jo, values) { + var t = jo; + BI.each(values, function (i, v) { + if (!BI.has(t, v)) { + t[v] = {}; + } + t = t[v]; + }); + }, + + _isMatch: function (value, keyword) { + var finded = BI.Func.getSearchResult([value], keyword); + return finded.finded.length > 0 || finded.matched.length > 0; + }, + + _getNode: function (v) { + return this.tree.search(v, "value"); + }, + + _getChildren: function (parent_values) { + if (parent_values.length > 0) { + var value = BI.last(parent_values); + var parent = this.tree.search(value, "value"); + } else { + var parent = this.tree.getRoot(); + } + return parent.getChildren(); + }, + + _getChildCount: function (parent_values) { + return this._getChildren(parent_values).length; + }, + + setValue: function (v) { + this.combo.setValue(v); + }, + + getValue: function () { + return this.combo.getValue(); + }, + + populate: function () { + this.combo.populate.apply(this, arguments); + } +}); +BI.TreeValueChooserCombo.EVENT_CONFIRM = "TreeValueChooserCombo.EVENT_CONFIRM"; +$.shortcut('bi.tree_value_chooser_combo', BI.TreeValueChooserCombo); \ No newline at end of file diff --git a/src/component/combo.valuechooser.js b/src/component/combo.valuechooser.js new file mode 100644 index 000000000..30ffa1a02 --- /dev/null +++ b/src/component/combo.valuechooser.js @@ -0,0 +1,127 @@ +/** + * 简单的复选下拉框控件, 适用于数据量少的情况 + * 封装了字段处理逻辑 + * + * Created by GUY on 2015/10/29. + * @class BI.ValueChooserCombo + * @extends BI.Widget + */ +BI.ValueChooserCombo = BI.inherit(BI.Widget, { + + _const: { + perPage: 10 + }, + _defaultConfig: function () { + return BI.extend(BI.ValueChooserCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-value-chooser-combo", + width: 200, + height: 30, + items: null, + itemsCreator: BI.emptyFn, + cache: true + }); + }, + + _init: function () { + BI.ValueChooserCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + if (BI.isNotNull(o.items)) { + this.items = o.items; + } + this.combo = BI.createWidget({ + type: 'bi.multi_select_combo', + element: this.element, + itemsCreator: BI.bind(this._itemsCreator, this), + valueFormatter: function (v) { + var text = v; + if (BI.isNotNull(self.items)) { + BI.some(self.items, function (i, item) { + if (item.value === v) { + text = item.text; + return true; + } + }); + } + return text; + }, + width: o.width, + height: o.height + }); + + this.combo.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () { + self.fireEvent(BI.ValueChooserCombo.EVENT_CONFIRM); + }); + }, + + _getItemsByTimes: function (items, times) { + var res = []; + for (var i = (times - 1) * this._const.perPage; items[i] && i < times * this._const.perPage; i++) { + res.push(items[i]); + } + return res; + }, + + _hasNextByTimes: function (items, times) { + return times * this._const.perPage < items.length; + }, + + _itemsCreator: function (options, callback) { + var self = this, o = this.options; + if (!o.cache || !this.items) { + o.itemsCreator({}, function (items) { + self.items = items; + call(items); + }); + } else { + call(this.items); + } + function call(items) { + var keywords = (options.keywords || []).slice(); + if (options.keyword) { + keywords.push(options.keyword); + } + BI.each(keywords, function (i, kw) { + var search = BI.Func.getSearchResult(items, kw); + items = search.matched.concat(search.finded); + }); + if (options.selected_values) {//过滤 + var filter = BI.makeObject(options.selected_values, true); + items = BI.filter(items, function (i, ob) { + return !filter[ob.value]; + }); + } + if (options.type == BI.MultiSelectCombo.REQ_GET_ALL_DATA) { + callback({ + items: items + }); + return; + } + if (options.type == BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { + callback({count: items.length}); + return; + } + callback({ + items: self._getItemsByTimes(items, options.times), + hasNext: self._hasNextByTimes(items, options.times) + }); + } + }, + + setValue: function (v) { + this.combo.setValue(v); + }, + + getValue: function () { + var val = this.combo.getValue() || {}; + return { + type: val.type, + value: val.value + } + }, + + populate: function () { + this.combo.populate.apply(this, arguments); + } +}); +BI.ValueChooserCombo.EVENT_CONFIRM = "ValueChooserCombo.EVENT_CONFIRM"; +$.shortcut('bi.value_chooser_combo', BI.ValueChooserCombo); \ No newline at end of file diff --git a/src/core/alias.js b/src/core/alias.js new file mode 100644 index 000000000..5ec5cd1c6 --- /dev/null +++ b/src/core/alias.js @@ -0,0 +1,591 @@ +BI.cjkEncode = function (text) { + // alex:如果非字符串,返回其本身(cjkEncode(234) 返回 ""是不对的) + if (typeof text !== 'string') { + return text; + } + + var newText = ""; + for (var i = 0; i < text.length; i++) { + var code = text.charCodeAt(i); + if (code >= 128 || code === 91 || code === 93) {//91 is "[", 93 is "]". + newText += "[" + code.toString(16) + "]"; + } else { + newText += text.charAt(i); + } + } + + return newText +}; + +BI.cjkEncodeDO = function (o) { + if (BI.isPlainObject(o)) { + var result = {}; + $.each(o, function (k, v) { + if (!(typeof v == "string")) { + v = BI.jsonEncode(v); + } + //wei:bug 43338,如果key是中文,cjkencode后o的长度就加了1,ie9以下版本死循环,所以新建对象result。 + k = BI.cjkEncode(k); + result[k] = BI.cjkEncode(v); + }); + return result; + } + return o; +}; + +BI.jsonEncode = function (o) { + //james:这个Encode是抄的EXT的 + var useHasOwn = {}.hasOwnProperty ? true : false; + + // crashes Safari in some instances + //var validRE = /^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/; + + var m = { + "\b": '\\b', + "\t": '\\t', + "\n": '\\n', + "\f": '\\f', + "\r": '\\r', + '"': '\\"', + "\\": '\\\\' + }; + + var encodeString = function (s) { + if (/["\\\x00-\x1f]/.test(s)) { + return '"' + s.replace(/([\x00-\x1f\\"])/g, function (a, b) { + var c = m[b]; + if (c) { + return c; + } + c = b.charCodeAt(); + return "\\u00" + + Math.floor(c / 16).toString(16) + + (c % 16).toString(16); + }) + '"'; + } + return '"' + s + '"'; + }; + + var encodeArray = function (o) { + var a = ["["], b, i, l = o.length, v; + for (i = 0; i < l; i += 1) { + v = o[i]; + switch (typeof v) { + case "undefined": + case "function": + case "unknown": + break; + default: + if (b) { + a.push(','); + } + a.push(v === null ? "null" : BI.jsonEncode(v)); + b = true; + } + } + a.push("]"); + return a.join(""); + }; + + if (typeof o == "undefined" || o === null) { + return "null"; + } else if (BI.isArray(o)) { + return encodeArray(o); + } else if (o instanceof Date) { + /* + * alex:原来只是把年月日时分秒简单地拼成一个String,无法decode + * 现在这么处理就可以decode了,但是JS.jsonDecode和Java.JSONObject也要跟着改一下 + */ + return BI.jsonEncode({ + __time__: o.getTime() + }) + } else if (typeof o == "string") { + return encodeString(o); + } else if (typeof o == "number") { + return isFinite(o) ? String(o) : "null"; + } else if (typeof o == "boolean") { + return String(o); + } else if (BI.isFunction(o)) { + return String(o); + } else { + var a = ["{"], b, i, v; + for (i in o) { + if (!useHasOwn || o.hasOwnProperty(i)) { + v = o[i]; + switch (typeof v) { + case "undefined": + case "unknown": + break; + default: + if (b) { + a.push(','); + } + a.push(BI.jsonEncode(i), ":", + v === null ? "null" : BI.jsonEncode(v)); + b = true; + } + } + } + a.push("}"); + return a.join(""); + } +}; + +BI.contentFormat = function (cv, fmt) { + if (BI.isEmpty(cv)) { + //原值为空,返回空字符 + return ''; + } + var text = cv.toString(); + if (BI.isEmpty(fmt)) { + //格式为空,返回原字符 + return text; + } + if (fmt.match(/^T/)) { + //T - 文本格式 + return text; + } else if (fmt.match(/^D/)) { + //D - 日期(时间)格式 + if (!(cv instanceof Date)) { + if (typeof cv === 'number') { + //毫秒数类型 + cv = new Date(cv); + } else { + //字符串类型,如yyyyMMdd、MMddyyyy等这样无分隔符的结构 + cv = Date.parseDate(cv + "", Date.patterns.ISO8601Long); + } + } + if (!BI.isNull(cv)) { + var needTrim = fmt.match(/^DT/); + text = BI.date2Str(cv, fmt.substring(needTrim ? 2 : 1)); + } + } else if (fmt.match(/E/)) { + //科学计数格式 + text = BI._eFormat(text, fmt); + } else { + //数字格式 + text = BI._numberFormat(text, fmt); + } + //¤ - 货币格式 + text = text.replace(/¤/g, '¥'); + return text; +}; + +/** + * 把日期对象按照指定格式转化成字符串 + * + * @example + * var date = new Date('Thu Dec 12 2013 00:00:00 GMT+0800'); + * var result = BI.date2Str(date, 'yyyy-MM-dd');//2013-12-12 + * + * @class BI.date2Str + * @param date 日期 + * @param format 日期格式 + * @returns {String} + */ +date2Str = function (date, format) { + if (!date) { + return ''; + } + // O(len(format)) + var len = format.length, result = ''; + if (len > 0) { + var flagch = format.charAt(0), start = 0, str = flagch; + for (var i = 1; i < len; i++) { + var ch = format.charAt(i); + if (flagch !== ch) { + result += compileJFmt({ + 'char': flagch, + 'str': str, + 'len': i - start + }, date); + flagch = ch; + start = i; + str = flagch; + } else { + str += ch; + } + } + result += compileJFmt({ + 'char': flagch, + 'str': str, + 'len': len - start + }, date); + } + return result; + + function compileJFmt(jfmt, date) { + var str = jfmt.str, len = jfmt.len, ch = jfmt['char']; + switch (ch) { + case 'E': //星期 + str = Date._DN[date.getDay()]; + break; + case 'y': //年 + if (len <= 3) { + str = (date.getFullYear() + '').slice(2, 4); + } else { + str = date.getFullYear(); + } + break; + case 'M': //月 + if (len > 2) { + str = Date._MN[date.getMonth()]; + } else if (len < 2) { + str = date.getMonth() + 1; + } else { + str = String.leftPad(date.getMonth() + 1 + '', 2, '0'); + } + break; + case 'd': //日 + if (len > 1) { + str = String.leftPad(date.getDate() + '', 2, '0'); + } else { + str = date.getDate(); + } + break; + case 'h': //时(12) + var hour = date.getHours() % 12; + if (hour === 0) { + hour = 12; + } + if (len > 1) { + str = String.leftPad(hour + '', 2, '0'); + } else { + str = hour; + } + break; + case 'H': //时(24) + if (len > 1) { + str = String.leftPad(date.getHours() + '', 2, '0'); + } else { + str = date.getHours(); + } + break; + case 'm': + if (len > 1) { + str = String.leftPad(date.getMinutes() + '', 2, '0'); + } else { + str = date.getMinutes(); + } + break; + case 's': + if (len > 1) { + str = String.leftPad(date.getSeconds() + '', 2, '0'); + } else { + str = date.getSeconds(); + } + break; + case 'a': + str = date.getHours() < 12 ? 'am' : 'pm'; + break; + case 'z': + str = date.getTimezone(); + break; + default: + str = jfmt.str; + break; + } + return str; + } +}; + +/** + * 数字格式 + */ +BI._numberFormat = function (text, format) { + var text = text + ''; + //数字格式,区分正负数 + var numMod = format.indexOf(';'); + if (numMod > -1) { + if (text >= 0) { + return BI._numberFormat(text + "", format.substring(0, numMod)); + } else { + return BI._numberFormat((-text) + "", format.substr(numMod + 1)); + } + } + var tp = text.split('.'), fp = format.split('.'), + tleft = tp[0] || '', fleft = fp[0] || '', + tright = tp[1] || '', fright = fp[1] || ''; + //百分比,千分比的小数点移位处理 + if (/[%‰]$/.test(format)) { + var paddingZero = /[%]$/.test(format) ? '00' : '000'; + tright += paddingZero; + tleft += tright.substr(0, paddingZero.length); + tleft = tleft.replace(/^0+/gi, ''); + tright = tright.substr(paddingZero.length).replace(/0+$/gi, ''); + } + var right = BI._dealWithRight(tright, fright); + if (right.leftPlus) { + //小数点后有进位 + tleft = parseInt(tleft) + 1 + ''; + + tleft = isNaN(tleft) ? '1' : tleft; + } + right = right.num; + var left = BI._dealWithLeft(tleft, fleft); + if (!(/[0-9]/.test(left))) { + left = left + '0'; + } + if (!(/[0-9]/.test(right))) { + return left + right; + } else { + return left + '.' + right; + } +}; +/** + * 处理小数点右边小数部分 + * @param tright 右边内容 + * @param fright 右边格式 + * @returns {JSON} 返回处理结果和整数部分是否需要进位 + * @private + */ +BI._dealWithRight = function (tright, fright) { + var right = '', j = 0, i = 0; + for (var len = fright.length; i < len; i++) { + var ch = fright.charAt(i); + var c = tright.charAt(j); + switch (ch) { + case '0': + if (BI.isEmpty(c)) { + c = '0'; + } + right += c; + j++; + break; + case '#': + right += c; + j++; + break; + default : + right += ch; + break; + } + } + var rll = tright.substr(j); + var result = {}; + if (!BI.isEmpty(rll) && rll.charAt(0) > 4) { + //有多余字符,需要四舍五入 + result.leftPlus = true; + var numReg = right.match(/^[0-9]+/); + if (numReg) { + var num = numReg[0]; + var orilen = num.length; + var newnum = BI.parseINT(num) + 1 + ''; + //进位到整数部分 + if (newnum.length > orilen) { + newnum = newnum.substr(1); + } else { + newnum = BI.leftPad(newnum, orilen, '0'); + result.leftPlus = false; + } + right = right.replace(/^[0-9]+/, newnum); + } + } + result.num = right; + return result; +}; + +BI.parseINT = function (str) { + return parseInt(str, 10); +}; + +BI.leftPad = function (val, size, ch) { + var result = String(val); + if (!ch) { + ch = " "; + } + while (result.length < size) { + result = ch + result; + } + return result.toString(); +}; + +/** + * 处理小数点左边整数部分 + * @param tleft 左边内容 + * @param fleft 左边格式 + * @returns {string} 返回处理结果 + * @private + */ +BI._dealWithLeft = function (tleft, fleft) { + var left = ''; + var j = tleft.length - 1; + var combo = -1, last = -1; + var i = fleft.length - 1; + for (; i >= 0; i--) { + var ch = fleft.charAt(i); + var c = tleft.charAt(j); + switch (ch) { + case '0': + if (BI.isEmpty(c)) { + c = '0'; + } + last = -1; + left = c + left; + j--; + break; + case '#': + last = i; + left = c + left; + j--; + break; + case ',': + if (!BI.isEmpty(c)) { + //计算一个,分隔区间的长度 + var com = fleft.match(/,[#0]+/); + if (com) { + combo = com[0].length - 1; + } + left = ',' + left; + } + break; + default : + left = ch + left; + break; + } + } + if (last > -1) { + //处理剩余字符 + var tll = tleft.substr(0, j + 1); + left = left.substr(0, last) + tll + left.substr(last); + } + if (combo > 0) { + //处理,分隔区间 + var res = left.match(/[0-9]+,/); + if (res) { + res = res[0]; + var newstr = '', n = res.length - 1 - combo; + for (; n >= 0; n = n - combo) { + newstr = res.substr(n, combo) + ',' + newstr; + } + var lres = res.substr(0, n + combo); + if (!BI.isEmpty(lres)) { + newstr = lres + ',' + newstr; + } + } + left = left.replace(/[0-9]+,/, newstr); + } + return left; +}; + +BI.object2Number = function (value) { + if (value == null) { + return 0; + } + if (typeof value == 'number') { + return value; + } else { + var str = value + ""; + if (str.indexOf(".") === -1) { + return parseInt(str); + } else { + return parseFloat(str); + } + } +}; + +BI.object2Date = function (obj) { + if (obj == null) { + return new Date(); + } + if (obj instanceof Date) { + return obj; + } else if (typeof obj == 'number') { + return new Date(obj); + } else { + var str = obj + ""; + str = str.replace(/-/g, '/'); + var dt = new Date(str); + if (!BI.isInvalidDate(dt)) { + return dt; + } + + return new Date(); + } +}; + +BI.isArray = function (a) { + return Object.prototype.toString.call(a) == '[object Array]'; +}; + +BI.object2Time = function (obj) { + if (obj == null) { + return new Date(); + } + if (obj instanceof Date) { + return obj; + } else { + var str = obj + ""; + str = str.replace(/-/g, '/'); + var dt = new Date(str); + if (!BI.isInvalidDate(dt)) { + return dt; + } + if (str.indexOf('/') === -1 && str.indexOf(':') !== -1) { + dt = new Date("1970/01/01 " + str); + if (!BI.isInvalidDate(dt)) { + return dt; + } + } + dt = BI.str2Date(str, "HH:mm:ss"); + if (!BI.isInvalidDate(dt)) { + return dt; + } + return new Date(); + } +}; + +// 判断是否是无效的日期 +BI.isInvalidDate = function (date) { + return date == "Invalid Date" || date == "NaN"; +}; + + +/** + * 科学计数格式 + */ +BI._eFormat = function (text, fmt) { + var e = fmt.indexOf("E"); + var eleft = fmt.substr(0, e), eright = fmt.substr(e + 1); + if (/^[0\.-]+$/.test(text)) { + text = BI._numberFormat(0.0, eleft) + 'E' + BI._numberFormat(0, eright) + } else { + var isNegative = text < 0; + if (isNegative) { + text = text.substr(1); + } + var elvl = (eleft.split('.')[0] || '').length; + var point = text.indexOf("."); + if (point < 0) { + point = text.length; + } + var i = 0; //第一个不为0的数的位置 + text = text.replace('.', ''); + for (var len = text.length; i < len; i++) { + var ech = text.charAt(i); + if (ech <= '9' && ech >= '1') { + break; + } + } + var right = point - i - elvl; + var left = text.substr(i, elvl); + var dis = i + elvl - text.length; + if (dis > 0) { + //末位补全0 + for (var k = 0; k < dis; k++) { + left += '0'; + } + } else { + left += '.' + text.substr(i + elvl); + } + left = left.replace(/^[0]+/, ''); + if (right < 0 && eright.indexOf('-') < 0) { + eright += ';-' + eright; + } + text = BI._numberFormat(left, eleft) + 'E' + BI._numberFormat(right, eright); + if (isNegative) { + text = '-' + text; + } + } + return text; +}; \ No newline at end of file diff --git a/src/core/base.js b/src/core/base.js index aa33e64a3..b337e5e67 100644 --- a/src/core/base.js +++ b/src/core/base.js @@ -81,30 +81,6 @@ if (!window.BI) { return widget instanceof BI.Widget || (BI.View && widget instanceof BI.View); }, - createWidget: function (item, options) { - var el; - options || (options = {}); - if (BI.isEmpty(item) && BI.isEmpty(options)) { - return BI.Plugin.getObject("bi.layout", BI.createWidget({ - type: "bi.layout" - })); - } - if (BI.isWidget(item)) { - return item; - } - if (item && (item.type || options.type)) { - el = BI.extend({}, options, item); - return BI.Plugin.getObject(el.type, FR.createWidget(BI.Plugin.getWidget(el.type, el), true)); - } - if (item && item.el && (item.el.type || options.type)) { - el = BI.extend({}, options, item.el); - return BI.Plugin.getObject(el.type, FR.createWidget(BI.Plugin.getWidget(el.type, el), true)); - } - if (item && BI.isWidget(item.el)) { - return item.el; - } - }, - createWidgets: function (items, options) { if (!BI.isArray(items)) { throw new Error("cannot create Widgets") @@ -929,10 +905,6 @@ if (!window.BI) { return BI.isString(str) && BI.isEmpty(str); }, - contentFormat: function () { - return FR.contentFormat.apply(FR, arguments); - }, - /** * 对字符串进行加密 {@link #decrypt} * @static @@ -1126,7 +1098,12 @@ if (!window.BI) { } timeoutToast.addReq(option); - FR.ajax({ + + option.data = BI.cjkEncodeDO(option.data); + + + + $.ajax({ url: option.url, type: "POST", data: option.data, @@ -1181,10 +1158,10 @@ if (!window.BI) { loading.showError(); } else if (status === "success" && BI.isFunction(option.success)) { - option.success(FR.jsonDecode(res.responseText)); + option.success(BI.jsonDecode(res.responseText)); } if (BI.isFunction(option.complete)) { - option.complete(FR.jsonDecode(res.responseText), status); + option.complete(BI.jsonDecode(res.responseText), status); } } }); @@ -1196,7 +1173,7 @@ if (!window.BI) { function encodeBIParam(data) { for (var key in data) { if (_.isObject(data[key])) { - data[key] = window.encodeURIComponent(FR.jsonEncode(data[key])); + data[key] = window.encodeURIComponent(BI.jsonEncode(data[key])); } else { data[key] = window.encodeURIComponent(data[key]); } @@ -1207,7 +1184,7 @@ if (!window.BI) { for (var key in data) { data[key] = window.decodeURIComponent(data[key]); if (_.isObject(data[key])) { - data[key] = FR.jsonDecode(data[key]); + data[key] = BI.jsonDecode(data[key]); } } } @@ -1230,7 +1207,7 @@ if (!window.BI) { if (op === "fr_bi_dezi" || op === "fr_bi_configure") { data.sessionID = Data.SharingPool.get("sessionID"); } - var url = FR.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random(); + var url = BI.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random(); return (BI.ajax)({ url: url, type: 'POST', @@ -1266,7 +1243,7 @@ if (!window.BI) { if (op === "fr_bi_dezi") { data.sessionID = Data.SharingPool.get("sessionID"); } - var url = FR.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random(); + var url = BI.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random(); var result = {}; (BI.ajax)({ url: url, diff --git a/src/core/func/function.js b/src/core/func/function.js index 6fbcfa0e3..b7e5d248a 100644 --- a/src/core/func/function.js +++ b/src/core/func/function.js @@ -121,7 +121,7 @@ $(function () { }, getCompleteImageUrl: function (url) { - return FR.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + url; + return BI.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + url; } }); diff --git a/src/core/model.js b/src/core/model.js index 3eb719537..3c8554895 100644 --- a/src/core/model.js +++ b/src/core/model.js @@ -377,7 +377,7 @@ BI.Model = BI.inherit(BI.M, { }, urlRoot: function () { - return FR.servletURL; + return BI.servletURL; }, parse: function (data) { diff --git a/src/core/utils/load.js b/src/core/utils/load.js index 0821a48fb..a036152f7 100644 --- a/src/core/utils/load.js +++ b/src/core/utils/load.js @@ -8,7 +8,7 @@ $.extend(BI, { type: null, must: false }, options); - config.url = FR.servletURL + '?op=' + config.op + '&resource=' + config.path; + config.url = BI.servletURL + '?op=' + config.op + '&resource=' + config.path; this.$import(config.url, config.type,config.must); }, $import: function () { diff --git a/src/css/base/third/farbtastic/farbtastic.css b/src/css/base/third/farbtastic/farbtastic.css index 2c4306d8f..76e8942fa 100644 --- a/src/css/base/third/farbtastic/farbtastic.css +++ b/src/css/base/third/farbtastic/farbtastic.css @@ -36,17 +36,17 @@ height: 101px; } .farbtastic .wheel { - background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/farbtastic/wheel.png) no-repeat; + background: url(farbtastic/wheel.png) no-repeat; width: 195px; height: 195px; } .farbtastic .overlay { - background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/farbtastic/mask.png) no-repeat; + background: url(farbtastic/mask.png) no-repeat; } .farbtastic .marker { width: 17px; height: 17px; margin: -8px 0 0 -8px; overflow: hidden; - background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/farbtastic/marker.png) no-repeat; + background: url(farbtastic/marker.png) no-repeat; } diff --git a/src/css/base/third/ztree/zTreeStyle.css b/src/css/base/third/ztree/zTreeStyle.css index 1ac2cf043..ec763cae5 100644 --- a/src/css/base/third/ztree/zTreeStyle.css +++ b/src/css/base/third/ztree/zTreeStyle.css @@ -29,7 +29,7 @@ website: http://code.google.com/p/jquerytree/ padding: 0 0 0 18px; } .ztree li ul.line { - background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-1.png) 0 0 repeat-y; + background: url(icon/tree-vertical-line-1.png) 0 0 repeat-y; } .ztree li a { padding: 1px 3px 0 0; @@ -84,8 +84,8 @@ website: http://code.google.com/p/jquerytree/ background-color: transparent; background-repeat: no-repeat; background-attachment: scroll; - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.png"); - *background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.gif"); + background-image: url("ztree/img/zTreeStandard.png"); + *background-image: url("ztree/img/zTreeStandard.gif"); } .ztree li span.button.chk { width: 16px; @@ -94,31 +94,31 @@ website: http://code.google.com/p/jquerytree/ cursor: auto; } .ztree li span.button.chk.checkbox_false_full { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-normal.png"); + background-image: url("icon/check-box-normal.png"); } .ztree li span.button.chk.checkbox_false_full_focus { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-normal.png"); + background-image: url("icon/check-box-normal.png"); } .ztree li span.button.chk.checkbox_false_part { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png"); + background-image: url("icon/half_selected.png"); } .ztree li span.button.chk.checkbox_false_part_focus { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png"); + background-image: url("icon/half_selected.png"); } .ztree li span.button.chk.checkbox_false_disable { background-position: 0 -56px; } .ztree li span.button.chk.checkbox_true_full { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-active.png"); + background-image: url("icon/check-box-active.png"); } .ztree li span.button.chk.checkbox_true_full_focus { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-active.png"); + background-image: url("icon/check-box-active.png"); } .ztree li span.button.chk.checkbox_true_part { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png"); + background-image: url("icon/half_selected.png"); } .ztree li span.button.chk.checkbox_true_part_focus { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png"); + background-image: url("icon/half_selected.png"); } .ztree li span.button.chk.checkbox_true_disable { background-position: -14px -56px; @@ -158,28 +158,28 @@ website: http://code.google.com/p/jquerytree/ height: 25px; } .ztree li span.button.root_open { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-1.png"); + background-image: url("icon/tree-expand-1.png"); } .ztree li span.button.root_close { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-1.png"); + background-image: url("icon/tree-collapse-1.png"); } .ztree li span.button.roots_open { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-2.png"); + background-image: url("icon/tree-expand-2.png"); } .ztree li span.button.roots_close { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-2.png"); + background-image: url("icon/tree-collapse-2.png"); } .ztree li span.button.center_open { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-3.png"); + background-image: url("icon/tree-expand-3.png"); } .ztree li span.button.center_close { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-3.png"); + background-image: url("icon/tree-collapse-3.png"); } .ztree li span.button.bottom_open { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-4.png"); + background-image: url("icon/tree-expand-4.png"); } .ztree li span.button.bottom_close { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-4.png"); + background-image: url("icon/tree-collapse-4.png"); } .ztree li span.button.noline_open { background-position: -92px -72px; @@ -191,13 +191,13 @@ website: http://code.google.com/p/jquerytree/ background: none; } .ztree li span.button.roots_docu { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-2.png"); + background-image: url("icon/tree-vertical-line-2.png"); } .ztree li span.button.center_docu { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-3.png"); + background-image: url("icon/tree-vertical-line-3.png"); } .ztree li span.button.bottom_docu { - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-4.png"); + background-image: url("icon/tree-vertical-line-4.png"); } .ztree li span.button.noline_docu { background: none; @@ -235,7 +235,7 @@ website: http://code.google.com/p/jquerytree/ .ztree li span.button.ico_loading { width: 0px; margin-right: 2px; - background: url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/loading.gif") no-repeat scroll 0 0 transparent; + background: url("ztree/img/loading.gif") no-repeat scroll 0 0 transparent; vertical-align: top; *vertical-align: middle; } @@ -256,8 +256,8 @@ span.tmpzTreeMove_arrow { background-repeat: no-repeat; background-attachment: scroll; background-position: -110px -80px; - background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.png"); - *background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.gif"); + background-image: url("ztree/img/zTreeStandard.png"); + *background-image: url("ztree/img/zTreeStandard.gif"); } ul.ztree.zTreeDragUL { margin: 0; diff --git a/src/css/base/view/popupview.css b/src/css/base/view/popupview.css index 0294fa968..79efbe2dd 100644 --- a/src/css/base/view/popupview.css +++ b/src/css/base/view/popupview.css @@ -1,7 +1,7 @@ /****添加计算宽度的--运算符直接需要space****/ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ -/**********FR.BIListView*************/ +/**********BI.BIListView*************/ .bi-list-view { position: fixed !important; overflow-y: visible !important; diff --git a/src/less/base/third/farbtastic/farbtastic.less b/src/less/base/third/farbtastic/farbtastic.less index 739bf6f02..a41494966 100644 --- a/src/less/base/third/farbtastic/farbtastic.less +++ b/src/less/base/third/farbtastic/farbtastic.less @@ -34,18 +34,18 @@ height: 101px; } .farbtastic .wheel { - background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/farbtastic/wheel.png) no-repeat; + background: url(farbtastic/wheel.png) no-repeat; width: 195px; height: 195px; } .farbtastic .overlay { - background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/farbtastic/mask.png) no-repeat; + background: url(farbtastic/mask.png) no-repeat; } .farbtastic .marker { width: 17px; height: 17px; margin: -8px 0 0 -8px; - overflow: hidden; - background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/farbtastic/marker.png) no-repeat; + overflow: hidden; + background: url(farbtastic/marker.png) no-repeat; } diff --git a/src/less/base/third/ztree/zTreeStyle.less b/src/less/base/third/ztree/zTreeStyle.less index 5a94e0230..6e625f2ac 100644 --- a/src/less/base/third/ztree/zTreeStyle.less +++ b/src/less/base/third/ztree/zTreeStyle.less @@ -12,7 +12,7 @@ website: http://code.google.com/p/jquerytree/ .ztree {margin:0; padding:5px; } .ztree li{padding:0; margin:0; list-style:none; line-height:14px; text-align:left; white-space:nowrap; outline:0} .ztree li ul{ margin:0; padding:0 0 0 18px} -.ztree li ul.line{ background:url(${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-1.png) 0 0 repeat-y;} +.ztree li ul.line{ background:url(icon/tree-vertical-line-1.png) 0 0 repeat-y;} .ztree li a {padding:1px 3px 0 0; margin:0; cursor:pointer; height:24px; background-color: transparent; text-decoration:none; vertical-align:top; display: inline-block} @@ -28,33 +28,33 @@ website: http://code.google.com/p/jquerytree/ .ztree li span.button {line-height:0; margin:0; width:16px; height:16px; display: inline-block; vertical-align:middle; border:0 none; cursor: pointer;outline:none; background-color:transparent; background-repeat:no-repeat; background-attachment: scroll; - background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.png"); *background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.gif")} + background-image:url("ztree/img/zTreeStandard.png"); *background-image:url("ztree/img/zTreeStandard.gif")} .ztree li span.button.chk {width:16px; height:16px; margin:0 3px 0 0; cursor: auto} .ztree li span.button.chk.checkbox_false_full { - background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-normal.png"); + background-image:url("icon/check-box-normal.png"); } .ztree li span.button.chk.checkbox_false_full_focus { - background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-normal.png"); + background-image:url("icon/check-box-normal.png"); } .ztree li span.button.chk.checkbox_false_part { - background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png"); + background-image:url("icon/half_selected.png"); } .ztree li span.button.chk.checkbox_false_part_focus { - background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png"); + background-image:url("icon/half_selected.png"); } .ztree li span.button.chk.checkbox_false_disable {background-position:0 -56px} .ztree li span.button.chk.checkbox_true_full { - background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-active.png"); + background-image:url("icon/check-box-active.png"); } .ztree li span.button.chk.checkbox_true_full_focus { - background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-active.png"); + background-image:url("icon/check-box-active.png"); } .ztree li span.button.chk.checkbox_true_part { - background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png"); + background-image:url("icon/half_selected.png"); } .ztree li span.button.chk.checkbox_true_part_focus { - background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png"); + background-image:url("icon/half_selected.png"); } .ztree li span.button.chk.checkbox_true_disable {background-position:-14px -56px} .ztree li span.button.chk.radio_false_full {background-position:-28px 0} @@ -70,40 +70,40 @@ website: http://code.google.com/p/jquerytree/ .ztree li span.button.switch {width:25px; height:25px} .ztree li span.button.root_open{ - background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-1.png"); + background-image:url("icon/tree-expand-1.png"); } .ztree li span.button.root_close{ - background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-1.png"); + background-image:url("icon/tree-collapse-1.png"); } .ztree li span.button.roots_open{ - background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-2.png"); + background-image:url("icon/tree-expand-2.png"); } .ztree li span.button.roots_close{ - background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-2.png"); + background-image:url("icon/tree-collapse-2.png"); } .ztree li span.button.center_open{ - background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-3.png"); + background-image:url("icon/tree-expand-3.png"); } .ztree li span.button.center_close{ - background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-3.png"); + background-image:url("icon/tree-collapse-3.png"); } .ztree li span.button.bottom_open{ - background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-4.png"); + background-image:url("icon/tree-expand-4.png"); } .ztree li span.button.bottom_close{ - background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-4.png"); + background-image:url("icon/tree-collapse-4.png"); } .ztree li span.button.noline_open{background-position:-92px -72px} .ztree li span.button.noline_close{background-position:-74px -72px} .ztree li span.button.root_docu{ background:none;} .ztree li span.button.roots_docu{ - background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-2.png"); + background-image:url("icon/tree-vertical-line-2.png"); } .ztree li span.button.center_docu{ - background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-3.png"); + background-image:url("icon/tree-vertical-line-3.png"); } .ztree li span.button.bottom_docu{ - background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-4.png"); + background-image:url("icon/tree-vertical-line-4.png"); } .ztree li span.button.noline_docu{ background:none;} @@ -113,13 +113,13 @@ website: http://code.google.com/p/jquerytree/ .ztree li span.button.edit {margin-right:2px; background-position:-110px -48px; vertical-align:top; *vertical-align:middle} .ztree li span.button.remove {margin-right:2px; background-position:-110px -64px; vertical-align:top; *vertical-align:middle} -.ztree li span.button.ico_loading{width: 0px;margin-right:2px; background:url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/loading.gif") no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle} +.ztree li span.button.ico_loading{width: 0px;margin-right:2px; background:url("ztree/img/loading.gif") no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle} ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)} span.tmpzTreeMove_arrow {width:16px; height:16px; display: inline-block; padding:0; margin:2px 0 0 1px; border:0 none; position:absolute; background-color:transparent; background-repeat:no-repeat; background-attachment: scroll; - background-position:-110px -80px; background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.png"); *background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.gif")} + background-position:-110px -80px; background-image:url("ztree/img/zTreeStandard.png"); *background-image:url("ztree/img/zTreeStandard.gif")} ul.ztree.zTreeDragUL {margin:0; padding:0; position:absolute; width:auto; height:auto;overflow:hidden; background-color:#cfcfcf; border:1px #00B83F dotted; opacity:0.8; filter:alpha(opacity=80)} .zTreeMask {z-index:10000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute} diff --git a/src/less/base/view/popupview.less b/src/less/base/view/popupview.less index 79bc39e2e..74b58045b 100644 --- a/src/less/base/view/popupview.less +++ b/src/less/base/view/popupview.less @@ -1,7 +1,7 @@ @import "../../bibase"; -/**********FR.BIListView*************/ +/**********BI.BIListView*************/ .bi-list-view { position: fixed !important; overflow-y: visible !important; diff --git a/src/widget/image/uploadimage.js b/src/widget/image/uploadimage.js index c9ca03231..7d30adc08 100644 --- a/src/widget/image/uploadimage.js +++ b/src/widget/image/uploadimage.js @@ -268,7 +268,7 @@ BI.UploadImage = BI.inherit(BI.Widget, { BI.extend(BI.UploadImage, { getImageSrc: function (src) { - return FR.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + src; + return BI.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + src; } });