-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathido.php
253 lines (221 loc) · 10 KB
/
ido.php
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
<?php
require("./comm/header.inc.php");
$out = str_replace('TITLE', $data['lang']['agentname'], $out);
$isgo = true;
if($tbl == ''){
if(true){
$tbl = $_CONFIG['welcometbl'];
$_REQUEST['tbl'] = $tbl;
debug(__FILE__.": empty tbl detection. 1703082103.");
redirect($url, $time=3000, $msg='');
}
$isgo = false;
}
else{
$out .= "<script type=\"text/javascript\">currenttbl='".$tbl."';\ncurrentdb='"
.$db."';\n currentlistid= {};\n currentpath='".$rtvdir."';\n userinfo={"
."'id':'".$userid
."','email':'".$user->getEmail()
."','group':'".$user->getGroup()
."','branch':'".$user->get('branchoffice')
."','sid':'".$sid
."'};\n";
$out .= "userinfo.\$lang = {"
."\"func_cancel\":\"".$lang->get("func_cancel")."\","
."\"notice_success\":\"".$lang->get("notice_success")."\","
."\"notice_failure\":\"".$lang->get("notice_failure")."\","
."\"notice_delete_soon\":\"".$lang->get("notice_delete_soon")."\","
."\"notice_datap_invalid\":\"".$lang->get("notice_datap_invalid")."\","
."\"more\":\"".$lang->get("more")."\","
."\"func_view\":\"".$lang->get("func_view")."\","
."\"func_edit\":\"".$lang->get("func_edit")."\","
."\"func_print\":\"".$lang->get("func_print")."\","
."\"func_delete\":\"".$lang->get("func_delete")."\","
."\"func_copy\":\"".$lang->get("func_copy")."\","
."\"func_orderby\":\"".$lang->get("func_orderby")."\","
."\"func_pivot_group_col\":\"".$lang->get("func_pivot_group_col")."\","
."\"func_pivot_value_col\":\"".$lang->get("func_pivot_value_col")."\","
."\"func_pivot_order_col\":\"".$lang->get("func_pivot_order_col")."\","
."\"func_pivot_seg_range\":\"".$lang->get("func_pivot_seg_range")."\","
."\"input\":\"".$lang->get("input")."\","
."\"\":\"\""
."};\n";
$out .= "</script>\n";
}
$out_header = $out;
$out = ""; # re-init it
if($isgo){
$hmconf = GTbl::xml2hash($xmlpathpre, $elementsep, $mydb, $tbl);
$hmconf[0]['mydb'] = $mydb; # Thu, 1 Dec 2016 19:43:30 +0800
$gtbl = new GTbl($tbl, $hmconf[0], $elementsep);
if(Wht::get($_REQUEST, 'tit') == ''){
$tit = $gtbl->getTblCHN();
}
# get detail path
$module_path = ''; $levelcode = ''; $codelist = '';
include_once($appdir."/comm/modulepath.inc.php");
$jdo = mkUrl($jdo, $_REQUEST, $gtbl); # ".($isheader?"</h3>":"")."
$accMode = $gtbl->getMode();
$out .= "<table align=\"center\" width=\"98%\" style=\"background:transparent\">";
$out .= "<tr><td width=\"40%\" ".($isheader?"class=\"f17px\"":"")."> <!-- <b> Π <a href=\"".$url."\">".$lang->get('navi_homepage')."</a> "
."<span class=\"f17px\">→</span> --> ".$module_path." </b> </td>";
$out .= "<td style=\"text-align:left\" colspan=\"18\">";
if($accMode!='' && ($accMode == 'r' || !inString('w', $accMode))){
# readonly
}
else{
$out .= " <button onclick=\"javascript:doActionEx('".$jdo."&act=add','contentarea');\">".$lang->get("func_create")."</button>";
}
$refArr = $gtbl->getRelatedRef($jdo."&act=list"); # related ref, added on Thu Apr 12 18:54:43 CST 2012
#print_r($refArr);
$maxRelatedCount = 6;
if(count($refArr) > 0){
# specified related modules
$maxRelatedCount = 3;
}
if(true){ # auto
$hm = $gtbl->execBy($sql="select linkname, modulename, levelcode, thedb, dynamicpara from ".$_CONFIG['tblpre']."info_menulist "
."where levelcode like '".substr($levelcode, 0, strlen($levelcode)-2)."__' "
."and levelcode<>'$levelcode' order by levelcode limit ".$maxRelatedCount, null,
$withCache=array('key'=>'info_menulist-select-level-'.$levelcode));
#debug($sql);
if($hm[0]){
$hm = $hm[1]; $tmphref = '';
foreach($hm as $k=>$v){
if($v['modulename'] != ''){
$tmphref = $ido."&tbl=".$v['modulename']."&db=".$v['thedb'];
}
else{
$tmphref = $url;
}
if($v['levelcode'] != ''){ $tmphref .= "&navidir=".$v['levelcode']; }
if($v['dynamicpara'] != ''){ $tmphref .= "&".$v['dynamicpara']; }
$refArr[] = array('target'=>"window.location.href='".$tmphref."';",
'name'=>$v['linkname'], 'href'=>'JS');
}
}
}
if(count($refArr) > 0){
foreach($refArr as $k=>$v){
$tmphref = $v['href'];
$isjs = 0;
if($tmphref == 'JS'){
$tmphref = $v['target'];
$isjs = 1;
}
if($isjs==0 && strpos($tmphref,"sid=") === false){
if(strpos($tmphref,"?") === false){
$tmphref .= "?";
}
else{
$tmphref .= "&";
}
$tmphref .= SID."=".$sid;
}
if($isjs == 0){
$out .= " <button onclick=\"javascript:doActionEx('".$tmphref."','".($v['target']==''?'contentarea':$v['target'])
."');\">".$v['name']."</button>";
}else{
$out .= " <button onclick=\"javascript:".$tmphref."\">".$v['name']."</button>";
}
}
}
$out .= " <button id=\"refreshbtn\" name=\"refreshbtn\" onclick=\"javascript:window.location.reload();\" "
."title=\"".$lang->get('func_refresh')."\">".$lang->get("func_refresh")."</button> </td></tr>";
$out .= "</table>";
$out .= "<div id=\"contentarea_outer\" style=\"display:none;border:0px dotted green; width:98%; margin-left:auto; margin-right:auto;\">";
$out .= "<div id=\"close_span\" style=\"text-align:right;height:10px;clear:both;\">"
."<button id=\"btn_close\" onclick=\"javascript:switchArea('contentarea_outer','off');\">X Close</button>"
." </div>";
$out .= "<div id=\"contentarea\" style=\"postion:absolute;\" align=\"center\"></div></div>\n";
$out .= "<span id=\"addarea\"></span> <span id=\"loadarea\"></span>\n";
$out .= "<div id=\"actarea\" align=\"center\"><br/><br/><span style=\"margin-left:38px;\"> Loading...... "
."<a href=\"javascript:doAction('".$jdo."&act=list');\"> ".$lang->get("func_reload")." </a> </span><br/><br/> </div>\n";
$out .= "<div id=\"tagmenu\" style=\"position:absolute;left:-50px;\"></div>";
$out .= "<div id=\"addareaextradiv\" onmousedown=\"javascript:fDragging(this, event, true);\" class=\"div\" "
."style=\"position:absolute;width: 350px;left:250px; top:250px;z-index:11; display:none\">"
."<span id=\"addareaextratitle\" style=\"background:#5f8ac5;width:100%;height:20;\">\n";
$out .= "<table style=\"color:white;font-weight:bold;\" id=\"addareaextratab\"><tr><td width=\"99%\">addarea </td>"
."<td align=\"right\"> <button name=\"cancelbtn\" id=\"cancelbtn\" "
."onclick=\"javascript:var a1706=document.getElementById('addareaextradiv'); if(a1706 != null){ "
."a1706.style.display='none';}\"> X </button> </td></tr></table></span>"
."<span id=\"addareaextra\"></span> </div>\n";
if($act == ''){
$out .= "<script async type=\"text/javascript\">if(typeof doAction == 'undefined' || typeof GTAjax == 'undefined'){ var doActionTimer=window.setTimeout(function(){ doAction('".$jdo."&act=list'); }, 2*1000); }else{ doAction('".$jdo."&act=list');}</script>\n";
}
else{
$out .= "<script async type=\"text/javascript\">if(typeof doAction == 'undefined' || typeof GTAjax == 'undefined'){ var doActionTimer=window.setTimeout(function(){ doActionEx('".$jdo."&act=".$act."','contentarea'); }, 2*1000); }else{ doActionEx('".$jdo."&act=".$act."','contentarea');}</script>\n";
}
$out .= "<!--bottom line-->";
$out .= "<table align=\"center\" width=\"98%\" style=\"background:transparent\"> <tr><td width=\"25%\" colspan=\"4\"> <b>"
." ".$module_path." </b> </td>";
$out .= "<td style=\"text-align:left;margin-right:58px\" colspan=\"15\"> ";
if($accMode!='' && ($accMode == 'r' || !inString('w', $accMode))){
# readonly
}
else{
$out .= " <button onclick=\"javascript:doActionEx('"
.$jdo."&act=add','contentarea');\">".$lang->get("func_create")."</button> ";
}
# repeat related menu, Wed, 12 Apr 2017 21:34:24 +0800
if(count($refArr) > 0){
foreach($refArr as $k=>$v){
$tmphref = $v['href'];
$isjs = 0;
if($tmphref == 'JS'){
$tmphref = $v['target'];
$isjs = 1;
}
if($isjs==0 && strpos($tmphref,"sid=") === false){
if(strpos($tmphref,"?") === false){
$tmphref .= "?";
}
else{
$tmphref .= "&";
}
$tmphref .= SID."=".$sid;
}
if($isjs == 0){
$out .= " <button onclick=\"javascript:doActionEx('".$tmphref."','".($v['target']==''?'contentarea':$v['target'])
."');\">".$v['name']."</button>";
}else{
$out .= " <button onclick=\"javascript:".$tmphref."\">".$v['name']."</button>";
}
}
}
$out .= " <button id=\"refrehbtn2\" name=\"refreshbtn2\" "
."onclick=\"javascript:window.location.reload();\" title=\"".$lang->get("func_refresh")."\">".$lang->get("func_refresh")."</button> ";
$out .= "</td> </tr></table>\n";
$out_footer = "<hr width=\"1\"/> <span id=\"noticediv\" style=\"color:green;\"> </span>";
if(true){
//- output more act options
$actArr = $gtbl->getActOption();
$out .= "\n<script type=\"text/javascript\">userinfo.actListOption=[";
$tmpstr = '';
if(count($actArr) > 0){
foreach($actArr as $actk=>$actv){
$tmpstr .= "{\"actName\":\"".$actv[1]."\", \"actUrl\":\"".$actv[0]."\""."},";
}
}
if(endsWith($tmpstr, ',')){ $tmpstr = substr($tmpstr, 0, strlen($tmpstr)-1); }
$out .= $tmpstr;
$out .= "]; userinfo.dataList=[];</script>";
}
$data['title'] = $gtbl->getTblCHN();
$gtbl = null;
$hmconf = null;
}
$smttpl = getSmtTpl(__FILE__, $act='');
$smt->assign('welcomemsg',$welcomemsg);
$smt->assign('isheader', $isheader);
$smt->assign('out_header', $out_header);
$smt->assign('out_footer', $out_footer);
$smt->assign('content',$out);
$smt->assign('rtvdir', $rtvdir);
$smt->assign('ido', $ido);
$smt->assign('jdo', $jdo);
$smt->assign('url', $url);
$smt->assign('sid', $sid);
require("./comm/footer.inc.php");
#print $out;
?>