File size: 5,542 Bytes
07c3cdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm type="xmlmenu">
  <MNU_ADD type="link" value="" link="#" onclick="window.location = 'users_New';return false;" colAlign="left" colWidth="35">
    <en><![CDATA[New]]></en>
  </MNU_ADD>
  <PAGED_TABLE_ID type="private"/>
  <PAGED_TABLE_FAST_SEARCH type="FastSearch" label="@G::LoadTranslation(ID_SEARCH)"/>
  <SEARCH_FILTER_FORM type="private"/>
  <CONFIRM type="private"/>
  <JS type="javascript"><![CDATA[ 
var simpleUserDelete = function(sUser) {
  new leimnud.module.app.confirm().make({
  	label:'@#CONFIRM',
  	action:function() {
  		window.location = 'users_Delete?USR_UID=' + sUser;
  	}.extend(this)
  });
};


var panel;
var gUSER_UID;
var deleteUser=function(sUser){  
  if (sUser == '00000000000000000000000000000001')
  {
    new leimnud.module.app.alert().make({
	    label: "@G::LoadTranslation(ID_CANNOT_DELETE_ADMIN_USER)"
  	});
  }
  else
  {
  gUSER_UID = sUser;
  panel =new leimnud.module.panel();
  panel.options={
  	size	:{w:450,h:250},
  	position:{x:50,y:50,center:true},
  	statusBarButtons:[
  	 {value:'@G::LoadTranslation(ID_DELETE)'},
  	 {value: G_STRINGS.CANCEL}
  	 ],
  	title	:G_STRINGS.ID_PROSESSESCASE,
  	control	:{close:true,resize:false},fx:{modal:true},
  	statusBar:false,
  	fx	:{shadow:true,modal:true}
  };
  panel.make();
  panel.elements.statusBarButtons[0].onmouseup=function(){
  	var todoCount = parseInt(getField('TO_DO').value);
  	var draftCount = parseInt(getField('DRAFT').value);
  	var cancelledCount = parseInt(getField('CANCELLED').value);
  	var completedCount = parseInt(getField('COMPLETED').value);

  	if(todoCount== 0 && draftCount==0){
  		if(cancelledCount== 0 && completedCount==0){
  			location.href = "users_Delete?USR_UID="+gUSER_UID;
  		} else {
  			new leimnud.module.app.confirm().make({
		  		label:G_STRINGS.USERS_DELETE_WITH_HISTORY,
		  		width:350,
		  		height:130,
		    	action:function(){
					location.href = "users_Delete?USR_UID="+gUSER_UID;
				}.extend(this)
		  	});
  		}
  	} else {
  		new leimnud.module.app.confirm().make({
	  		label:G_STRINGS.USERS_REASSIGN,
	  		width:350,
	  		height:135,
	    	action:function(){
				   /*location.href = "../cases/cases_ReassignByUser";*/
				   userReassing(gUSER_UID);
			  }.extend(this)
	  	});
  	}
  };
  panel.elements.statusBarButtons[1].onmouseup=panel.remove;
  panel.loader.show();

  var r = new leimnud.module.rpc.xmlhttp({
  	url:"users_DeleteAssign.php",
  	method:"GET",
  	args:"USR_UID=" + sUser
  });
  r.callback=function(rpc)
  {
  	panel.loader.hide();
  	panel.addContent(rpc.xmlhttp.responseText);
  };
  r.make();
 }
}



function viewUserGroups(sUserUID){
	popupWindow('' , 'users_Groups?sUserUID='+sUserUID , 400 , 330 );
    /*refreshTree();*/
};

function showUserGroups(sUserUID){
	var oRPC = new leimnud.module.rpc.xmlhttp({
		url   : '../users/users_Ajax',
		async : false,
		method: 'POST',
		args  : 'function=showUserGroups'+ '&sUserUID=' + sUserUID
    });
    oRPC.make();
    currentPopupWindow.clearContent();
	currentPopupWindow.addContent(oRPC.xmlhttp.responseText);
};

function deleteGroup(sGroup, sUser){

	new leimnud.module.app.confirm().make({
    	label:G_STRINGS.ID_MSG_CONFIRM_REMOVE_USERGROUP,
    	action:function(){
	        var oRPC = new leimnud.module.rpc.xmlhttp({
				url   : '../users/users_Ajax',
				async : false,
				method: 'POST',
				args  : 'function=deleteGroup&GRP_UID=' + sGroup + '&USR_UID=' + sUser
	        });
	        oRPC.make();
	        currentPopupWindow.clearContent();
			currentPopupWindow.addContent(oRPC.xmlhttp.responseText);
		}.extend(this)
    });
};

function showUserGroupInterface(sUserUID){

	var oRPC = new leimnud.module.rpc.xmlhttp({
		url   : '../users/users_Ajax',
		async : false,
		method: 'POST',
		args  : 'function=showUserGroupInterface'+ '&sUserUID=' + sUserUID
    });
    oRPC.make();
    currentPopupWindow.clearContent();
	currentPopupWindow.addContent(oRPC.xmlhttp.responseText);
    //currentPopupWindow.remove();
};

function saveUserGroup(sGroup, sUser){

    var oRPC = new leimnud.module.rpc.xmlhttp({
      url   : '../users/users_Ajax',
      async : false,
      method: 'POST',
      args  : 'function=assignUserToGroup&GRP_UID=' + sGroup + '&USR_UID=' + sUser
    });
    oRPC.make();
    currentPopupWindow.clearContent();
    currentPopupWindow.addContent(oRPC.xmlhttp.responseText);
    setTimeout('showUserGroups(\''+sUser+'\')',1500);
  }

var reassignCases = function(sUser) {
  window.location = 'users_ReassignCases?sUser=' + sUser;
};

var reassignCases2 = function(USR_UID) {
	popupWindow('' , 'users_ReassignCases?USR_UID=' + USR_UID + '&iStep=1' , 500, 350);
};

function userReassing(USR_UID){
  var panel =new leimnud.module.panel();
  var width = 1000;
  var height= 700;
  
  panel.options={
    size  :{w:width, h:height},
    position:{x:50,y:50,center:true},
    statusBarButtons:[{value: G_STRINGS.CANCEL}],
    title :G_STRINGS.ID_REASSIGNMENT,
    control :{close:true,resize:false},fx:{modal:true},
    statusBar:false,
    fx  :{shadow:true,modal:true}
  };
  panel.make();
  
  ifrm = document.createElement("iframe");
	ifrm.setAttribute("name", "userReassing");
	ifrm.setAttribute("id","userReassing");
	ifrm.setAttribute("src", "../cases/cases_ReassignByUser?REASSIGN_USER="+USR_UID);
	
  ifrm.style.width = "100%";
  ifrm.style.height = "99%";
  ifrm.style.border = "0";
  panel.addContent(ifrm);
  
  panel.elements.statusBarButtons[0].onmouseup=function(){
    panel.remove();
  };
}

]]></JS>
</dynaForm>