NavPanel_wev8.js
22.3 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
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
if(typeof(MEC_NS) == 'undefined'){
MEC_NS = {};
}
MEC_NS.NavPanel = function(typeTmp, idTmp, mecJsonTmp){
this.type = typeTmp;
if(!idTmp){
idTmp = new UUID().toString();
}
this.id = idTmp;
if(!mecJsonTmp){
mecJsonTmp = this.getDefaultMecJson();
}
this.mecJson = mecJsonTmp;
}
/*获取id。 必需的方法*/
MEC_NS.NavPanel.prototype.getID = function(){
return this.id;
};
/*加载数据*/
MEC_NS.NavPanel.loadData = function(callback) {
UrlSelectUtil.nav.loadNavItems(callback);
}
/*获取设计的html, 页面上怎么显示控件完全依赖于此方法。 必需的方法*/
MEC_NS.NavPanel.prototype.getDesignHtml = function(){
this.mecJson.nav_all = this.getNavItems();
return getDesignHtml(this);
};
/*页面上显示控件完成后调用此方法,主要用于一些必须要使用js对页面进行后置操作时,无需要此方法可至空。 不必需的方法,有此方法系统自动调用*/
MEC_NS.NavPanel.prototype.afterDesignHtmlBuild = function(){
var theId = this.id;
var $container = $("#NMEC_"+theId);
$container.css("visibility", "visible");
var sildeCount = $container.find(".NavPanel-point b").length;
if(sildeCount <= 1){
$(".NavPanel-point", $container).hide();
}
};
/*获取构建属性编辑窗体的html,添加和单击控件后会调用此方法,由此方法去构建属性编辑窗体。 必需的方法*/
MEC_NS.NavPanel.prototype.getAttrDlgHtml = function(){
var theId = this.id;
var nav_all = this.getNavItems();
var htm = "<div id=\"MADNavPanel_"+theId+"\">";
htm += "<div class=\"title\">" + SystemEnv.getHtmlNoteName(4650) + "</div>";
htm += "<div class=\"form-group\">";
htm += "<div class=\"row\">"
+ "<div class=\"col-2 span-control\">" + SystemEnv.getHtmlNoteName(5467) + "</div>" //精简模式:
+ "<div class=\"col-m-8\">"
+ "<span class=\"cbboxEntry\">"
+ "<input type=\"checkbox\" id=\"lite_"+theId+"\" value=\"1\" onclick=\"MADNP_SwitchShowMode(this, '"+theId+"');\"/>"
+ "<span class=\"cbboxLabel\">" + SystemEnv.getHtmlNoteName(5468) + "</span>" //精简模式只展示勾选显示内容,其余以更多显示
+ "</span>"
+ "</div>"
+ "</div>";
htm += "<div class=\"row MADNavPanel_liteMode\">"
+ "<div class=\"col-2 span-control\">" + SystemEnv.getHtmlNoteName(5469) + "</div>" //每页行数:
+ "<div class=\"col-m-8\" style=\"position: relative;\">" +
"<div style=\"position: absolute;top: 8px;left: 6px;\">" + SystemEnv.getHtmlNoteName(5470) + "</div>" + //最多
"<input type=\"text\" data-autobind='row' class=\"form-control\" style=\"text-align: center;\" id=\"row_"+theId+"\"/>" +
"<div style=\"position: absolute;top: 8px;right: 6px;\">" + SystemEnv.getHtmlNoteName(3886) + "</div>" //行
+ "</div>"
+ "</div>";
htm += "<div class=\"row\">"
+ "<div class=\"col-2 span-control\">" + SystemEnv.getHtmlNoteName(5471) + "</div>" //每行列数::
+ "<div class=\"col-m-8\" style=\"position: relative;\">" +
"<div style=\"position: absolute;top: 8px;left: 6px;\">" + SystemEnv.getHtmlNoteName(5470) + "</div>" + //最多
"<input type=\"text\" data-autobind='col' class=\"form-control\" style=\"text-align: center;\" id=\"col_"+theId+"\"/>" +
"<div style=\"position: absolute;top: 8px;right: 6px;\">" + SystemEnv.getHtmlNoteName(3887) + "</div>" //列
+ "</div>"
+ "</div>";
htm += "<div class=\"row\">"
+ "<div class=\"col-2 span-control\">" + SystemEnv.getHtmlNoteName(4938) + "</div>" //图标圆角:
+ "<div class=\"col-m-8\">"
+ "<span class=\"cbboxEntry\">"
+ "<input type=\"checkbox\" id=\"radius_"+theId+"\" value=\"1\"/>"
+ "<span class=\"cbboxLabel\">" + SystemEnv.getHtmlNoteName(4939) + "</span>" //显示图标时使用圆角化处理
+ "</span>"
+ "</div>"
+ "</div>";
htm += "</div>";
htm += "<div class=\"form-group\" style=\"padding-top: 0px;\">";
htm += "<table id=\"MADNP_Table_"+theId+"\" class=\"table MADNP_Table\">"
+ "<thead>"
+ "<tr>"
+ "<td></td>"
+ "<td></td>"
+ "<td>"+SystemEnv.getHtmlNoteName(4111)+"</td>" //图标
+ "<td>"+SystemEnv.getHtmlNoteName(3539)+"</td>" //显示名称
+ "<td>"+SystemEnv.getHtmlNoteName(4112)+"</td>" //来源
+ "<td>"+SystemEnv.getHtmlNoteName(3550)+"</td>" //显示
+ "<td>"+SystemEnv.getHtmlNoteName(3621)+"</td>" //提示
+ "</tr>"
+ "</thead>";
htm += "<tbody>";
var rowSet = 0;
for(var i = 0; i < nav_all.length; i++){
var nav_category = nav_all[i];
htm += MADNP_CreatCategory(rowSet, theId);
rowSet++;
for(var j=0;j<nav_category["nav_items"].length;j++){
htm += MADNP_CreateRow(rowSet, theId);
rowSet++;
}
}
htm += "</tbody></table>";
htm += "</div>";
htm += "<div class=\"row bottom MADNP_Bottom\">"
+ "<div class=\"col-2 save-btn MADNP_SaveBtn\" onclick=\"refreshMecDesign('"+theId+"');\">"+SystemEnv.getHtmlNoteName(4114)+"</div>" //确 定
+ "<div class=\"col-12 tr\"><span class=\"add-before add-item\" data-scroll=\"bottom\" onclick=\"MADNP_AddCategory('"+theId+"');\">"+SystemEnv.getHtmlNoteName(3518)+"</span>" //添加
+ "</div>";
htm += "</div>";
htm += "<div class=\"MAD_Alert\">"+SystemEnv.getHtmlNoteName(4115)+"</div>"; //已生成到布局
return htm;
};
MEC_NS.NavPanel.prototype.buildPermDlg = function(){
var theId = this.id;
require(['mec'], function(mec){
mec.buildPermDlg(theId);
});
}
/*构建属性编辑窗体完成后调用此方法,主要用于一些必须要使用js对页面进行后置操作时,无需要此方法可至空。 不必需的方法,有此方法系统自动调用*/
MEC_NS.NavPanel.prototype.afterAttrDlgBuild = function(){
var theId = this.id;
var mecHandler = MECHandlerPool.getHandler(theId);
var row = Mec_FiexdUndefinedVal(this.mecJson["row"], "2");
$("#row_"+theId).val(row);
var col = Mec_FiexdUndefinedVal(this.mecJson["col"], "4");
$("#col_"+theId).val(col);
var radius = Mec_FiexdUndefinedVal(this.mecJson["radius"]);
if(radius == "1"){
$("#radius_"+theId).attr("checked","checked");
}
var lite = Mec_FiexdUndefinedVal(this.mecJson["lite"], "1");
if(lite == "1"){
$("#lite_"+theId).attr("checked","checked");
$(".MADNavPanel_liteMode", $("#MADNavPanel_"+theId)).show();
}else{
$("#MADNP_Table_"+theId).addClass("portal");
$(".MADNavPanel_liteMode", $("#MADNavPanel_"+theId)).hide();
}
var nav_all = this.getNavItems();
var rowSet = 0;
for(var m=0;m<nav_all.length;m++){
var nav_category = nav_all[m];
MLanguage.setValue($("#category_"+rowSet+"_"+theId), nav_category["category"]);
rowSet++;
var nav_items = nav_category["nav_items"];
for(var i = 0; i < nav_items.length; i++,rowSet++){
var id = nav_items[i]["id"] || new UUID().toString();
var iconpath = nav_items[i]["iconpath"];
var icontype = nav_items[i]["icontype"];
var uiid = nav_items[i]["uiid"];
var uiname = nav_items[i]["uiname"];
var source = nav_items[i]["source"];
var custom = nav_items[i]["custom"];
var jscode = nav_items[i]["jscode"];
var isremind = nav_items[i]["isremind"];
var isshow = nav_items[i]["isshow"] || "1";
var remindtype = nav_items[i]["remindtype"];
var remindsql = nav_items[i]["remindsql"];
var reminddatasource = nav_items[i]["reminddatasource"];
var remindjavafilename = nav_items[i]["remindjavafilename"];
var remindapiconfig = Mec_FiexdUndefinedVal(nav_items[i]["remindapiconfig"]);
var permission = nav_items[i]["permission"] || "";
var navContainer = $('#source_' +rowSet+ '_' +theId).parent();
$("#pic_path_"+rowSet+"_"+theId).val(iconpath);
$("#pic_type_"+rowSet+"_"+theId).val(icontype);
MADNP_SetPicPath(rowSet, theId, iconpath);
UrlSelectUtil.nav.setNavLinkName(navContainer, {uiid: uiid, uiname: uiname, custom: custom, jscode: jscode, sourcetype: source});
$("#source_"+rowSet+"_"+theId).val(source);
$("#ui_"+rowSet+"_"+theId).val(uiid);
if(source==1){
//获取dataurl
var dataurl = UrlSelectUtil.MOBILE_PAGE_PREFIX + String(uiid).replace('homepage_',"");
//调用生成
UrlSelectUtil.link.setUrlLink($("#uiview_"+ rowSet +"_"+theId).parent(),dataurl);
}else if(source==2){
UrlSelectUtil.nav.setCustomerPage($("#uiview_"+rowSet+"_"+theId).parent(),custom);
}else if(source==3){
$("#uiview_"+rowSet+"_"+theId).val("脚本");
}
$("#custom_"+rowSet+"_"+theId).val(custom);
$("#jscode_"+rowSet+"_"+theId).val(jscode);
$("#source_"+rowSet+"_"+theId).val(source);
$("#ui_"+rowSet+"_"+theId).val(uiid);
MLanguage.setValue($("#uiname_"+rowSet+"_"+theId), uiname);
if(isremind == "1"){
$("#isremind_"+rowSet+"_"+theId).attr("checked","checked");
}
$("#id_"+rowSet+"_"+theId).val(id);
if(isshow == "1"){
$("#isshow_"+rowSet+"_"+theId).attr("checked","checked");
}
$("#remindtype_"+rowSet+"_"+theId).val(remindtype);
$("#remindsql_"+rowSet+"_"+theId).val(remindsql);
$("#reminddatasource_"+rowSet+"_"+theId).val(reminddatasource);
$("#remindjavafilename_"+rowSet+"_"+theId).val(remindjavafilename);
$("#remindapiconfig_"+rowSet+"_"+theId).val(remindapiconfig);
$("#permission_"+rowSet+"_"+theId).val(permission);
}
}
MADNP_TriggerTable(theId);
$("#MADNavPanel_"+theId).checkbox({
onClick: function () {
mecHandler.autobind.update();
}
});
$("#MADNP_Table_"+theId + " > tbody").sortable({
revert: false,
axis: "y",
items: "tr:not(.categoryRow_0)",
handle: ".bemove",
update: function(){
mecHandler.autobind.update();
}
});
};
/*获取JSON*/
MEC_NS.NavPanel.prototype.getMecJson = function(){
var theId = this.id;
this.mecJson["id"] = theId;
this.mecJson["mectype"] = this.type;
var $attrTable = $("#MADNP_Table_"+theId);
if($attrTable.length > 0){
this.mecJson["row"] = $("#row_"+theId).val();
this.mecJson["col"] = $("#col_"+theId).val();
this.mecJson["radius"] = $("#radius_"+theId).is(':checked') ? "1" : "0";
this.mecJson["lite"] = $("#lite_"+theId).is(':checked') ? "1" : "0";
var nav_all = [];
var nav_items = [];
var nav_category;
$("#MADNP_Table_"+theId + " > tbody > tr").each(function(i){
var $that = $(this);
var rowIndex = $that.attr("rowIndex");
if($that.hasClass("categoryRow")){
if(rowIndex == 0) {
nav_category = {};
}else{
nav_category["nav_items"] = nav_items;
nav_all.push(nav_category);
nav_category = {};
nav_items = [];
}
nav_category["category"] = MLanguage.getValue($("#category_"+rowIndex+"_"+theId));
}else{
var n_item = {};
n_item["iconpath"] = $("#pic_path_"+rowIndex+"_"+theId).val();
n_item["icontype"] = $("#pic_type_"+rowIndex+"_"+theId).val();
n_item["source"] = $("#source_"+rowIndex+"_"+theId).val();
n_item["uiid"] = $("#ui_"+rowIndex+"_"+theId).val();
n_item["custom"] = $("#custom_"+rowIndex+"_"+theId).val();
n_item["jscode"] = $("#jscode_"+rowIndex+"_"+theId).val();
n_item["uiname"] = MLanguage.getValue($("#uiname_"+rowIndex+"_"+theId));
n_item["isremind"] = $("#isremind_"+rowIndex+"_"+theId).is(':checked') ? "1" : "0";
n_item["isshow"] = $("#isshow_"+rowIndex+"_"+theId).is(':checked') ? "1" : "0";
n_item["id"] = $("#id_"+rowIndex+"_"+theId).val();
n_item["remindtype"] = $("#remindtype_"+rowIndex+"_"+theId).val();
n_item["remindsql"] = $("#remindsql_"+rowIndex+"_"+theId).val();
n_item["reminddatasource"] = $("#reminddatasource_"+rowIndex+"_"+theId).val();
n_item["remindjavafilename"] = $("#remindjavafilename_"+rowIndex+"_"+theId).val();
n_item["remindapiconfig"] = $("#remindapiconfig_"+rowIndex+"_"+theId).val();
n_item["permission"] = $("#permission_"+rowIndex+"_"+theId).val();
nav_items.push(n_item);
}
});
nav_category["nav_items"] = nav_items;
nav_all.push(nav_category);
this.mecJson["nav_all"] = nav_all;
}
return this.mecJson;
};
MEC_NS.NavPanel.prototype.getDefaultMecJson = function(){
var theId = this.id;
var defMecJson = {};
defMecJson["id"] = theId;
defMecJson["mectype"] = this.type;
defMecJson["row"] = "2";
defMecJson["col"] = "4";
defMecJson["lite"] = "1";
return defMecJson;
};
MEC_NS.NavPanel.prototype.getNavItems = function(){
var nav_all = this.mecJson["nav_all"] || this.mecJson["nav_items"];//兼容老数据
if(!nav_all){
//通过转换生成新的数组对象,避免直接操作公共array的元素属性而影响其他插件的引用。
var nav_all = UrlSelectUtil.nav.getNavItems();
nav_all = nav_all.slice(0, 8);
}
if(!nav_all[0]["category"]){
var nav_new = [];
var nav_category = {};
nav_category["nav_items"] = nav_all;
nav_category["category"] = SystemEnv.getHtmlNoteName(5474); //默认分类
nav_new.push(nav_category);
return nav_new;
}
return nav_all;
};
function MADNP_TriggerTable(mec_id){
$("#MADNP_Table_"+mec_id + " > tbody > tr").not(".categoryRow").each(function(i){
var rowIndex = $(this).attr("rowIndex");
MADNP_TriggerTableRow(rowIndex, mec_id);
});
}
function MADNP_TriggerTableRow(rowIndex, mec_id){
MADNP_SourceChange(rowIndex, mec_id);
MADNP_IsremindChange(rowIndex, mec_id);
}
function MADNP_SourceChange(rowIndex, mec_id){
var sourceV = $("#source_"+rowIndex+"_"+mec_id).val();
var $ui = $("#ui_"+rowIndex+"_"+mec_id);
var $custom = $("#custom_"+rowIndex+"_"+mec_id);
var $jscode = $("#jscode_"+rowIndex+"_"+mec_id);
if(sourceV == "1"){
$custom.hide();
$jscode.hide();
$ui.show();
}else if(sourceV == "2"){
$ui.hide();
$jscode.hide();
$custom.show();
}else if(sourceV == "3"){
$custom.hide();
$ui.hide();
$jscode.show();
}
}
function MADNP_IsremindChange(rowIndex, mec_id){
var $numremindEditFlag = $("#numremindEditFlag_"+rowIndex+"_"+mec_id);
$("#isremind_"+rowIndex+"_"+mec_id).is(':checked') ? $numremindEditFlag.show() : $numremindEditFlag.hide();
}
function MADNP_NumremindEdit(rowIndex, mec_id){
var remindtypeV = $("#remindtype_"+rowIndex+"_"+mec_id).val();
var remindsqlV = $("#remindsql_"+rowIndex+"_"+mec_id).val();
remindsqlV = $m_encrypt(remindsqlV);
var reminddatasourceV = $("#reminddatasource_"+rowIndex+"_"+mec_id).val();
var remindjavafilenameV = $("#remindjavafilename_"+rowIndex+"_"+mec_id).val();
var remindapiconfigV = compressByLZ($("#remindapiconfig_"+rowIndex+"_"+mec_id).val());
var url = "/mobilemode/admin/dialog/numremind.jsp?remindtype="+remindtypeV+"&reminddatasource="+reminddatasourceV+"&remindsql="+remindsqlV+"&remindjavafilename="+remindjavafilenameV+"&remindapiconfig="+remindapiconfigV;
var dlg = top.createTopDialog();//获取Dialog对象
dlg.Model = true;
dlg.normalDialog = false;
dlg.Width = 500;//定义长度
dlg.Height = 255;
dlg.URL = url;
dlg.Title = SystemEnv.getHtmlNoteName(4116); //数字提醒
dlg.show();
dlg.hookFn = function(result){
$("#remindtype_"+rowIndex+"_"+mec_id).val(result["remindtype"]);
$("#remindsql_"+rowIndex+"_"+mec_id).val(result["remindsql"]);
$("#reminddatasource_"+rowIndex+"_"+mec_id).val(result["reminddatasource"]);
$("#remindjavafilename_"+rowIndex+"_"+mec_id).val(result["remindjavafilename"]);
$("#remindapiconfig_"+rowIndex+"_"+mec_id).val(result["remindapiconfig"]);
};
};
function MADNP_DelRow(rowIndex, mec_id){
var mecHandler = MECHandlerPool.getHandler(mec_id);
$("#MADNP_Table_"+mec_id + " > tbody > tr[rowIndex='"+rowIndex+"']").remove();
mecHandler.autobind.update();
}
function MADNP_AddCategory(mec_id){
var currRowIndex = MADNP_GetMaxRowIndex(mec_id);
var htm = MADNP_CreatCategory(currRowIndex, mec_id);
var $newRow = $(htm);
var mecHandler = MECHandlerPool.getHandler(mec_id);
$("#MADNP_Table_"+mec_id + " > tbody").append($newRow);
$newRow.checkbox().MLanguage();
mecHandler.autobind.update();
}
function MADNP_CreatCategory(currRowIndex, mec_id){
var htm = "";
if(currRowIndex>0){
htm += "<tr class=\"categoryRow\" rowIndex=\""+currRowIndex+"\">";
htm += "<td class=\"bemove\"></td>";
}else{
htm += "<tr class=\"categoryRow categoryRow_0\" rowIndex=\""+currRowIndex+"\">";
htm += "<td class=\"besort\"></td>";
}
htm += "<th style=\"padding-top: 5px;padding-bottom: 1px;\" colspan=\"3\">"
+ "<input id=\"category_"+currRowIndex+"_"+mec_id+"\" data-autobind type=\"text\" class=\"form-control\" placeholder=\""+SystemEnv.getHtmlNoteName(5472)+"\" "+MLanguage.ATTR+"/>"//分类名称
+ "</th>"
+ "<td style=\"position: relative;padding-left: 10px;\">"
+ "<div class=\"col-12 tr\"><span class=\"add-before\" data-scroll=\"bottom\" onclick=\"MADNP_AddRow(this,'"+mec_id+"');\">"+SystemEnv.getHtmlNoteName(5473)+"</span></div>" //添加子项
;
if(currRowIndex>0){
htm += "<div style=\"top: 15px;right: 8px;\"class=\"del-before delFlag\" onclick=\"MADNP_DelRow("+currRowIndex+",'"+mec_id+"');\"></div>";
}
htm += "</td>";
htm += "</tr>";
return htm;
}
function MADNP_GetCategoryLastNode(that){
var $now = $(that).parent().parent().parent();
var nextArr = $now.nextAll();
if(nextArr.length >0){
for(var i=0;i<nextArr.length;i++){
if($(nextArr[i]).hasClass("categoryRow")){
return i==0 ? $now : $(nextArr[i-1]);
}
}
return $(nextArr[nextArr.length - 1]);
}else{
return $now;
}
}
function MADNP_GetMaxRowIndex(mec_id){
var maxRowIndex = 0;
$("#MADNP_Table_"+mec_id + " > tbody > tr").each(function(i){
var rowIndex = parseInt($(this).attr("rowIndex"));
if(rowIndex > maxRowIndex){
maxRowIndex = rowIndex;
}
});
return maxRowIndex + 1;
}
function MADNP_AddRow(that, mec_id){
var currRowIndex = MADNP_GetMaxRowIndex(mec_id);
var mecHandler = MECHandlerPool.getHandler(mec_id);
var $newRow = $(MADNP_CreateRow(currRowIndex, mec_id));
if ($(that).parents(".categoryRow").hasClass("categoryRow_0")) {
$newRow.find("#isshow_"+currRowIndex+"_"+mec_id).attr("checked","true")
}
var $lastNode = MADNP_GetCategoryLastNode(that);
$lastNode.after($newRow);
$newRow.checkbox({
onClick: function () {
mecHandler.autobind.update();
}
}).MLanguage();
MADNP_TriggerTableRow(currRowIndex, mec_id);
MADNP_SetPicPath(currRowIndex, mec_id, "");
$("#id_"+currRowIndex+"_"+mec_id).val(new UUID().toString());
mecHandler.autobind.update();
}
function MADNP_CreateRow(currRowIndex, mec_id){
var htm =
"<tr rowIndex=\""+currRowIndex+"\">"
+ "<td></td>"
+ "<td class=\"bemove leftborder\" width=\"20px\"></td>"
+ "<td width=\"20px\" style=\"position: relative;\">"
+ "<div class=\"item-img MADNP_Toolbar_Item_Img\" onclick=\"MADNP_PicSet("+currRowIndex+",'"+mec_id+"');\">"
+ "<img id=\"pic_img_"+currRowIndex+"_"+mec_id+"\"/>"
+ "<input type=\"hidden\" id=\"pic_type_"+currRowIndex+"_"+mec_id+"\"/>"
+ "<input type=\"hidden\" id=\"pic_path_"+currRowIndex+"_"+mec_id+"\"/>"
+ "<input id=\"id_"+currRowIndex+"_"+mec_id+"\" type=\"hidden\"/>"
+ "</div> "
+ "<div class=\"del-after delFlag\" id=\"iconDelFlag_"+currRowIndex+"_"+mec_id+"\" onclick=\"MADNP_DelPicPath("+currRowIndex+",'"+mec_id+"');\"></div>"
+ "</td>"
+ "<td width=\"*\"><input data-autobind id=\"uiname_"+currRowIndex+"_"+mec_id+"\" type=\"text\" class=\"form-control\" "+MLanguage.ATTR+"/></td>"
+ "<td width=\"135px\">"
+ "<div class=\"sbHolder\" style=\"min-width: 130px;\"><a href=\"javascript:void(0);\" onclick=\"javascript:showNavPanel('#uiview_"+currRowIndex+"_"+mec_id+"');\" class=\"sbToggle sbToggle-btc\"></a>"
+ "<input class=\"panel-input\" id=\"uiview_" + currRowIndex + "_" + mec_id +"\" readonly='readonly' unselectable='on' autocomplete=\"off\" onclick=\"javascript:showNavPanel(this);\">"
+ "<input id=\"ui_"+currRowIndex+"_"+mec_id+"\" type=\"hidden\" />"
+ "<input id=\"source_"+currRowIndex+"_"+mec_id+"\" type=\"hidden\" />"
+ "<input id=\"custom_"+currRowIndex+"_"+mec_id+"\" type=\"hidden\"/>"
+ "<input id=\"jscode_"+currRowIndex+"_"+mec_id+"\" type=\"hidden\"/>"
+ "</div>"
+ "</td>"
+ "<td width=\"37px\" style=\"position: relative;padding-left: 10px;\"><input type=\"checkbox\" id=\"isshow_"+currRowIndex+"_"+mec_id+"\" value=\"1\"/>"
+ "</td>"
+ "<td width=\"37px\" style=\"position: relative;padding-left: 5px;\"><input type=\"checkbox\" id=\"isremind_"+currRowIndex+"_"+mec_id+"\" value=\"1\" onclick=\"MADNP_IsremindChange("+currRowIndex+",'"+mec_id+"');\"/>"
+ "<input type=\"hidden\" id=\"remindtype_"+currRowIndex+"_"+mec_id+"\"/>"
+ "<input type=\"hidden\" id=\"remindsql_"+currRowIndex+"_"+mec_id+"\"/>"
+ "<input type=\"hidden\" id=\"reminddatasource_"+currRowIndex+"_"+mec_id+"\"/>"
+ "<input type=\"hidden\" id=\"remindjavafilename_"+currRowIndex+"_"+mec_id+"\"/>"
+ "<input type=\"hidden\" id=\"remindapiconfig_"+currRowIndex+"_"+mec_id+"\"/>"
+ "<div id=\"numremindEditFlag_"+currRowIndex+"_"+mec_id+"\" class=\"numremindEditFlag\" onclick=\"MADNP_NumremindEdit("+currRowIndex+",'"+mec_id+"');\"></div>"
+ "<div class=\"del-before delFlag\" onclick=\"MADNP_DelRow("+currRowIndex+",'"+mec_id+"');\"></div>"
+ "</td>"
+ "</tr>";
return htm;
}
function MADNP_getUISelectOptionHtml(){
var htm = "";
for(var i = 0; i < common_mec_nav_items.length; i++){
var uiid = common_mec_nav_items[i]["uiid"];
var uiname = common_mec_nav_items[i]["uiname"];
htm += "<option value=\""+uiid+"\">"+uiname+"</option>";
}
return htm;
}
function MADNP_PicSet(rowIndex, mec_id){
var pic_typeV = MADNP_IsNvl($("#pic_type_"+rowIndex+"_"+mec_id).val(),"0");
var pic_pathV = $("#pic_path_"+rowIndex+"_"+mec_id).val();
var params = "pic_type=" + pic_typeV + "&pic_path=" + encodeURIComponent(pic_pathV);
showPicsetModal(params, function(result){
var picPath = result["pic_path"];
$("#pic_type_"+rowIndex+"_"+mec_id).val(result["pic_type"]);
$("#pic_path_"+rowIndex+"_"+mec_id).val(picPath);
MADNP_SetPicPath(rowIndex, mec_id, picPath);
});
};
function MADNP_SetPicPath(rowIndex, mec_id, picPath){
var mecHandler = MECHandlerPool.getHandler(mec_id);
var $picImg = $("#pic_img_" + rowIndex + "_" + mec_id);
$picImg[0].src = picPath || "/mobilemode/images/mec/add-img-btn_wev8.png";
$("#iconDelFlag_" + rowIndex + "_" + mec_id).toggleClass("hide-important", !picPath);
mecHandler.autobind && mecHandler.autobind.update();
}
function MADNP_DelPicPath(rowIndex, mec_id){
$("#pic_type_"+rowIndex+"_"+mec_id).val("");
$("#pic_path_"+rowIndex+"_"+mec_id).val("");
MADNP_SetPicPath(rowIndex, mec_id, "");
}
function MADNP_SwitchShowMode(cbObj, mec_id){
var $attrContainer = $("#MADNavPanel_"+mec_id);
var cbChecked = cbObj.checked;
$("#MADNP_Table_"+mec_id).toggleClass("portal", !cbChecked);
if(cbChecked){
$(".MADNavPanel_liteMode", $attrContainer).show();
}else{
$(".MADNavPanel_liteMode", $attrContainer).hide();
}
}
function MADNP_IsNvl(str, dev){
if (str == "") return dev;
else return str;
}