DocRelationable_wev8.js
4.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
//Ext.namespace('weaver.doc');
//weaver.doc.DocRelationable = function(docid) {
DocRelationable = function(docid) {
Ext.override(Ext.grid.CheckboxSelectionModel, {
renderer : function(v, p, record){
var chk="";
if(record.get("chk")!=null){
chk=record.get("chk").replace(/(^\s*)|(\s*$)/g, "");
}
if(chk=="disabled"){
return '<div></div>';
} else {
return '<div class="x-grid3-row-checker"> </div>';
}
},
selectAll: function() {
if(this.locked) return;
this.selections.clear();
var record = this.grid.store.getRange();
for(var i = 0, len = this.grid.store.getCount(); i < len; i++){
var chk="";
if(record[i].get("chk")!=null){
chk=record[i].get("chk").replace(/(^\s*)|(\s*$)/g, "");
}
if(chk!='disabled'){
this.selectRow(i, true);
}
}
}
});
var storeDocShare1 = new Ext.data.Store({
baseParams: {
docid: docid,
olddocid: olddocid,
requestid: requestid,
isrequest: isrequest,
doccreaterid: doccreaterid,
docCreaterType: docCreaterType,
ownerid: ownerid,
ownerType: ownerType
},
proxy: new Ext.data.HttpProxy({
method: 'POST',
url: '/docs/docs/DocRelationGet.jsp'
}),
reader: new Ext.data.JsonReader({
fields: [{name: 'shareId'}, { name: 'chk'}, {name: 'shareName'},{ name: 'shareRealName'}]
})
});
var smDocShare1 = new Ext.grid.CheckboxSelectionModel({
handleMouseDown: Ext.emptyFn
});
var arrayDocImgs_temp = [
{header: wmsg.share.docdyname,width: 250,dataIndex: 'shareName'},
{header: wmsg.share.docownname,width: 150, dataIndex: 'shareRealName' }
];
if (true) {
arrayDocImgs=[new Ext.grid.RowNumberer(), smDocShare1].concat(arrayDocImgs_temp)
}
else {
arrayDocImgs=[new Ext.grid.RowNumberer(),smDocShare1].concat(arrayDocImgs_temp)
}
var columnsDocShare=new Ext.grid.ColumnModel(arrayDocImgs);
var DocSharePanelBar1 = [{
text: wmsg.share.docdybut,
iconCls: 'btn_add',
tooltip: wmsg.share.docdybut,//
disabled:false,
handler: function(){
//TODO
var arrRecord = smDocShare1.getSelections();
var delShareIds = "";
for (var i = 0; i < arrRecord.length; i++) {
var record = arrRecord[i];
var shareId = record.get("shareId");
var chk=record.get("chk").replace(/(^\s*)|(\s*$)/g, "");
if(chk!="disabled"){
delShareIds += shareId + ",";
}
}
var win = new Ext.Window({
layout: 'fit',
width: 700,
height: 500,
closeAction: 'hide',
plain: true,
modal: true,
title: wmsg.share.docdybut,// '添加订阅',
items: new Ext.TabPanel({
activeTab: 0,
items: [{
title: wmsg.base.content,// '内容',
html: "<IFRAME NAME='ifrmShareAdd' id='ifrmShareAdd' SRC='/docs/docsubscribe/DocSubscribeAdd.jsp?subscribeDocId=" +
delShareIds + "'"+
"style='width:100%;height:100%' BORDER=0 FRAMEBORDER=no NORESIZE=NORESIZE scrolling='auto'></IFRAME>"
}]
}),
buttons: [{
text: wmsg.base.cancel,// '取消',
handler: function(){
win.hide();
}
}]
});
win.show(null);
}
}];
storeDocShare1.load();
var DocSharePanel2 = {
xtype:'grid',
id: 'DocRelation',
width: 1200,
height: 200,
loadMask: true,
//title: wmsg.base.relationResource,// '文档共享',
viewConfig: {
forceFit: true
},
store: storeDocShare1,
cm: columnsDocShare,
trackMouseOver: true,
autoSizeColumns: true,
sm: smDocShare1,
tbar: DocSharePanelBar1
};
return {
getGrid:function(){
return DocSharePanel2;
},
init : function() {
}
}
}