/source/gl/zdgx/show.php

http://prosporous.googlecode.com/ · PHP · 507 lines · 483 code · 13 blank · 11 comment · 32 complexity · 4ac53cabd3afbfb8bc34e4a30fc27a55 MD5 · raw file

  1. <?php
  2. /**??????UTF-8???.
  3. * Created on 2010-9-12
  4. *
  5. * @author EXT <isrn@qq.com>
  6. *
  7. */
  8. include ('../../includes/global.php');
  9. include ('../global.php');
  10. include ("../power.php");
  11. function grv($type,$blm,$dvalue=false){
  12. //print_r($type);
  13. if($dvalue){
  14. return $dvalue;
  15. }else{
  16. switch($type){
  17. case 'function':{
  18. $a=explode('#',$blm);
  19. return $a[0]($a[1]);
  20. break;
  21. }
  22. case '$_GET':{
  23. return $_GET[$blm];
  24. break;
  25. }
  26. case '$_SESSION':{
  27. return $_SESSION[$blm];
  28. break;
  29. }
  30. case '$_POST':{
  31. return $_POST[$blm];
  32. break;
  33. }
  34. case '$_COOKIE':{
  35. return $_COOKIE[$blm];
  36. break;
  37. }
  38. case '$_SERVER':{
  39. return $_SERVER[$blm];
  40. break;
  41. }
  42. case '$_ENV':{
  43. return $_ENV[$blm];
  44. break;
  45. }
  46. case '$_FILES':{
  47. return $_FILES[$blm];
  48. break;
  49. }
  50. case '0':{
  51. return $blm;
  52. break;
  53. }
  54. case '1':{
  55. break;
  56. }
  57. default:{
  58. return $blm;
  59. break;
  60. }
  61. }
  62. }
  63. }
  64. $dbcfg=Sys::Gp(array('dbcfg','sevenel'));
  65. $tree_id = $_GET['tid'];
  66. Tr($_GET['tid'],'tid');
  67. Tr($_GET['bdtid'],'bdtid');
  68. Tr($_GET['bdid'],'bdid');
  69. $field=Dgd(array(
  70. 'db'=>'d_sevenel',
  71. 'cd'=>"tid = $tree_id and fname like '".$_GET['fname']."' ",
  72. 'tn'=>"fld",
  73. 'limit'=>1
  74. ));
  75. $tree=Dgd(array(
  76. 'db'=>'d_sevenel',
  77. 'cd'=>"id = $tree_id",
  78. 'tn'=>"tree",
  79. 'limit'=>1
  80. ));
  81. $tname=gettabname($tree['table'],$dbcfg['prefix'],true);
  82. Tr($tname,'tname');
  83. if($_GET['id']){
  84. Tr($_GET['id'],'id');
  85. $fdada=Dgd(array(
  86. 'db'=>'d_sevenel',
  87. 'cd'=>" id = '".$_GET['id']."' and del != '1' ",
  88. 'tn'=>"$tname",
  89. 'limit'=>1
  90. ));
  91. Tr($fdada['gid'],'gid');
  92. Tr(preg_replace("/[\s]{2,}/","",$fdada['lg']),'lg');
  93. }
  94. switch($_REQUEST['op']){
  95. /* case 'load':{
  96. ext_request('ok');
  97. break;}
  98. */
  99. case 'show':{
  100. $value=$field;
  101. if($value['cfg']!=''){
  102. $config =json_decode($value['cfg'],true);
  103. }else{$config =''; }
  104. $config['STR']=str_replace("\r","",$config['STR']);
  105. $config['STR']=str_replace("\n","",$config['STR']);
  106. $config['STR']=str_replace("\t","",$config['STR']);
  107. switch($value['type']){
  108. case 'hidden':{
  109. $js[$value['fname']] ="{
  110. xtype: 'hidden',
  111. value:\"".(grv($value['qzfs'],$value['blm'],adxx($fdada[$value['fname']])))."\",
  112. ".(($config['STR'])?("".$config['STR'].""):(""))."
  113. name: '".$value['fname']."'
  114. }";
  115. break;}
  116. case 'textfield':{
  117. $js[$value['fname']] ="{
  118. xtype: 'textfield',
  119. value:\"".(grv($value['qzfs'],$value['blm'],adxx($fdada[$value['fname']])))."\",
  120. fieldLabel:'".$value['name']."',
  121. ".(($value['id'])?("id:'".$value['id']."',"):(""))."
  122. ".(($value['width'])?("width:'".$value['width']."px',"):("grow:true,growMin:68,growMax:300,"))."
  123. ".((!$value['yxwk'])?("allowBlank:false,blankText:'".adxx($value['ts'])."',"):(""))."
  124. ".(($config['readonly'])?("readOnly:'true',"):(""))."
  125. ".(($config['STR'])?("".$config['STR'].""):(""))."
  126. ".$back."
  127. name: '".$value['fname']."'
  128. }";
  129. break;}
  130. case 'password':{
  131. $js[$value['fname']] ="{
  132. xtype: 'textfield',
  133. value:\"".(grv($value['qzfs'],$value['blm'],adxx($fdada[$value['fname']])))."\",
  134. fieldLabel:'".$value['name']."',
  135. inputType: 'password',allowBlank:false,blankText:'??????',
  136. id: '".$value['fname']."',
  137. ".(($value['width'])?("width:'".$value['width']."px',"):("width:'100px',"))."
  138. ".(($config['STR'])?("".$config['STR'].""):(""))."
  139. ".$back."name: '".$value['fname']."'
  140. },{
  141. xtype: 'textfield',
  142. value:\"".(grv($value['qzfs'],$value['blm'],adxx($fdada[$value['fname']])))."\",
  143. fieldLabel:'??".$value['name']."',
  144. inputType: 'password',allowBlank:false,blankText:'??????',
  145. vtype: 'password',
  146. ".(($value['width'])?("width:'".$value['width']."px',"):("width:'100px',"))."
  147. ".(($config['STR'])?("".$config['STR'].""):(""))."
  148. initialPassField: '".$value['fname']."',
  149. ".$back."name: '".$value['fname']."-cfrm'
  150. }";
  151. $plugurl[] = '/Plug-in/ext/adv-vtypes.js';
  152. break;}
  153. case 'fileup':{
  154. if($fdada[$value['fname']]==''){
  155. $fdada[$value['fname']]='zwtp.jpg';
  156. }
  157. $dvalue=array( 0=>array('rar','zip','tar','.tz'),
  158. 1=>array('jpg','gif','png','bmp'),
  159. 2=>array('mp3','mp4','avi','wmv','mid','.rm','mvb','mov','wma','wav'),
  160. 3=>array('doc','xls','txt','ocx','lsx','ppt','pdf','chm'),
  161. 4=>array('doc','xls','txt','ocx','lsx','ppt','pdf','chm','mp3','mp4','avi','wmv','mid','.rm','mvb','mov','wma','wav','jpg','gif','png','bmp','rar','zip','tar','.tz')
  162. );
  163. $otype=substr(strtolower($fdada[$value['fname']]),-3);
  164. if(in_array($otype,$dvalue[0])){
  165. $zs="<a href=\"/uplods/pic/".$fdada[$value['fname']]."\" target=\'_blank\'><img src=\"../img/archive.png\">??[Download]</a>";
  166. }
  167. if(in_array($otype,$dvalue[1])){
  168. if($config['sypic']==1||$config['sytxt']==1){
  169. $zs="<img src=\"/uplods/sytp/".$fdada[$value['fname']]."\" >";
  170. }else{
  171. $zs="<img src=\"/uplods/pic/".$fdada[$value['fname']]."\" >";
  172. }
  173. }
  174. if(in_array($otype,$dvalue[2])){
  175. $zs="<a href=\"/uplods/pic/".$fdada[$value['fname']]."\" target=\'_blank\'><img src=\"../img/film_link.png\">??[Download]</a>";
  176. }
  177. if(in_array($otype,$dvalue[3])){
  178. $zs="<a href=\"/uplods/pic/".$fdada[$value['fname']]."\" target=\'_blank\'><img src=\"../img/report_word.png\">??[Download]</a>";
  179. }
  180. $qk=" <a href=\"#\" onclick=qkzd(\"".$fdada['id']."\",\"".$value['fname']."\") ><img src=\"../img/001_02.gif\">?????</a>";
  181. $js[$value['fname']] ="{
  182. xtype: 'textfield',
  183. fieldLabel:'".$value['name']."',
  184. inputType: 'file',
  185. ".(($value['id'])?("id:'".$value['id']."',"):(""))."
  186. width:'150',
  187. ".(($config['STR'])?("".$config['STR'].""):(""))."
  188. ".$back."name: '".$value['fname']."'
  189. },{".$back."html:'<div style=\"float:left;width:300px;\" align=center>".$zs."".$qk."</div>'}";
  190. break;}
  191. case 'textarea':{
  192. $js[$value['fname']] =preg_replace("/[\s]{2,}/","","{
  193. xtype: 'textarea',
  194. value:\"".(grv($value['qzfs'],$value['blm'],adxx($fdada[$value['fname']])))."\",
  195. fieldLabel:'".$value['name']."',
  196. grow:true,
  197. ".(($value['id'])?("id:'".$value['id']."',"):(""))."
  198. ".(($value['width'])?("width:'".$value['width']."px',"):("width:'400px',"))."
  199. ".((!$value['yxwk'])?("allowBlank:false,blankText:'".adxx($value['ts'])."',"):(""))."
  200. ".(($config['readonly'])?("readOnly:'true',"):(""))."
  201. ".(($config['STR'])?("".$config['STR'].""):(""))."
  202. ".$back."
  203. name: '".$value['fname']."'
  204. }");
  205. break;}
  206. case 'htmleditor':{
  207. $js[$value['fname']] =preg_replace("/[\s]{2,}/","","{
  208. xtype: 'htmleditor',
  209. value:\"".(grv($value['qzfs'],$value['blm'],adxx($fdada[$value['fname']])))."\",
  210. fieldLabel:'".$value['name']."',
  211. ".(($value['id'])?("id:'".$value['id']."',"):(""))."
  212. ".(($value['width'])?("width:".$value['width'].","):("anchor:'98%',"))."
  213. ".(($config['height'])?("height:".$config['height'].","):(""))."
  214. ".(($config['STR'])?("".$config['STR'].""):(""))."
  215. ".$back."
  216. name: '".$value['fname']."'
  217. }");
  218. break;}
  219. case 'fckeditor':{
  220. $js[$value['fname']] =preg_replace("/[\s]{2,}/","","{
  221. xtype:\"textarea\",
  222. ".(($value['id'])?("id:'".$value['id']."',"):(""))."
  223. value:\"".(grv($value['qzfs'],$value['blm'],adxx($fdada[$value['fname']])))."\",
  224. ".(($value['width'])?("width:".$value['width'].","):("anchor:'98%',"))."
  225. ".(($config['height'])?("height:".$config['height'].","):("height:300,"))."
  226. fieldLabel:'".$value['name']."',
  227. ".$back."
  228. listeners:{
  229. focus:function(f){
  230. var myMask = new Ext.LoadMask(Ext.getBody(), {msg:'???'});
  231. myMask.show();
  232. var w=f.getSize();
  233. fckEditor = new FCKeditor('".$value['fname']."') ;
  234. fckEditor.Height=".(($config['height'])?($config['height']):(300)).";
  235. fckEditor.Width=".(($value['width'])?($value['width']):(800)).";
  236. fckEditor.SkinPath = '/Plug-in/fck/editor/skins/silver/' ;
  237. fckEditor.BasePath = '/Plug-in/fck/' ;
  238. fckEditor.Config['ToolbarStartExpanded'] = ".(($config['zhed'])?("false"):('true')).";
  239. ".(($config['STR'])?($config['STR']):(""))."
  240. fckEditor.ReplaceTextarea() ;
  241. myMask.hide();
  242. }
  243. },
  244. name: '".$value['fname']."'
  245. }");
  246. $fckplugin.="try{var fckobj_temp = FCKeditorAPI.GetInstance('".$value['fname']."');
  247. fckobj_temp.UpdateLinkedField();}catch(err){
  248. };";
  249. $plugurl[] = '/Plug-in/fck/fckeditor.js'; // fckEditor.ReplaceTextarea() ;
  250. break;}
  251. case 'kindeditor':{
  252. $yuan = array("</script>", "vegetables", "fiber");
  253. $tyuan = array("<\/script>", "beer", "ice cream");
  254. $js[$value['fname']] =preg_replace("/[\s]{2,}/","","{
  255. xtype:\"textarea\",
  256. id:'".$value['fname']."',
  257. ".$back."
  258. value:\"".(grv($value['qzfs'],$value['blm'],str_replace($yuan, $tyuan,adxx(preg_replace("'([\r\n])[\s]+'", "", $fdada[$value['fname']])))))."\",
  259. ".(($value['width'])?("width:".$value['width'].","):("anchor:'98%',"))."
  260. ".(($config['height'])?("height:".$config['height'].","):("height:300,"))."
  261. fieldLabel:'".$value['name']."',
  262. listeners:{
  263. render:function(f){
  264. try{KE.show({id : '".$value['fname']."',
  265. width :".(($value['width'])?("'".$value['width']."px'"):('70%')).",
  266. height : ".(($config['height'])?("'".$config['height']."px'"):('300px')).",
  267. ".(($config['STR'])?($config['STR']):(""))."
  268. ".(($config['jd'])?("resizeMode : 1,
  269. allowPreviewEmoticons : false,
  270. allowUpload : false,
  271. items : [
  272. 'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold', 'italic', 'underline',
  273. 'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
  274. 'insertunorderedlist', '|', 'emoticons', 'image', 'link'],"):(""))."
  275. filterMode : false});}catch(err){
  276. };
  277. }
  278. },
  279. name: '".$value['fname']."'
  280. }");
  281. $fckplugin.="KE.util.setData('".$value['fname']."');";
  282. $plugurl[] = '/Plug-in/kind/kindeditor.js'; // fckEditor.ReplaceTextarea() ;
  283. break;}
  284. case 'datefield':{
  285. if(is_numeric($fdada[$value['fname']])){
  286. $fdada[$value['fname']]=date($config['zqgs'],$fdada[$value['fname']]);
  287. }
  288. $js[$value['fname']] ="{
  289. xtype: 'datefield',
  290. ".$back."
  291. value:\"".(grv($value['qzfs'],$value['blm'],adxx($fdada[$value['fname']])))."\",
  292. fieldLabel:'".$value['name']."',
  293. ".(($value['id'])?("id:'".$value['id']."',"):(""))."
  294. ".(($value['width'])?("width:".$value['width'].","):(""))."
  295. disabledDays :[".@implode(',',$config['pbxq'])."],
  296. ".((!$value['yxwk'])?("allowBlank:false,blankText:'".adxx($value['ts'])."',"):(""))."
  297. ".(($config['zwxs'])?("readOnly:'true',"):(""))."
  298. ".(($config['STR'])?("".$config['STR'].""):(""))."
  299. ".(($config['zqgs'])?("format:'".$config['zqgs']."',"):(""))."
  300. name: '".$value['fname']."'
  301. }";
  302. if($config['zwxs']==1){$plugjs[] ='Date.dayNames = ["?", "?", "?", "?", "?", "?", "?"];
  303. if (Ext.DatePicker) {
  304. Ext.apply(Ext.DatePicker.prototype, {
  305. todayText: "??",
  306. minText: "?????????",
  307. maxText: "?????????",
  308. disabledDaysText: "",
  309. disabledDatesText: "",
  310. monthNames: Date.monthNames,
  311. dayNames: Date.dayNames,
  312. nextText: "?? (Control+Right)",
  313. prevText: "?? (Control+Left)",
  314. monthYearText: "????? (Control+Up/Down ????)",
  315. todayTip: "{0} (Spacebar)",
  316. okText: "??",
  317. cancelText: "??",
  318. format: "y?m?d?"
  319. });
  320. }';}
  321. break;}
  322. case 'swfupload':{
  323. $js[$value['fname']] ="{
  324. xtype: '{$value['type']}',
  325. ".$back."
  326. name: '{$value['fname']}',
  327. id: '{$value['fname']}',
  328. fieldLabel: '{$value['name']}',
  329. anchor:'99%',
  330. height: {$config['height']}
  331. }";
  332. break;}
  333. case 'combo':{
  334. $tempxx = json_decode($value['zyz'],true);
  335. $config_num = count($tempxx);
  336. $items='';
  337. if($config_num != 0){
  338. foreach($tempxx as $key => $data){
  339. if($data['ck']=='1'){
  340. $fdada[$value['fname']]?$fdada[$value['fname']]:$fdada[$value['fname']]=$data['xv'];}
  341. $items.= "['".$data['xv']."','".$data['yv']."']";
  342. if($key < $config_num-1){
  343. $items.= ",";
  344. }
  345. }
  346. }
  347. $js[$value['fname']] ="{
  348. ".$back."
  349. value:\"".(grv($value['qzfs'],$value['blm'],adxx($fdada[$value['fname']])))."\",
  350. fieldLabel:'".$value['name']."',
  351. ".(($value['id'])?("id:'".$value['id']."',"):(""))."
  352. ".(($value['width'])?("width:".$value['width'].","):(""))."
  353. ".((!$value['yxwk'])?("allowBlank:false,blankText:'".adxx($value['ts'])."',"):(""))."
  354. ".(($config['readonly'])?("readOnly:'true',"):(""))."
  355. typeAhead: true,
  356. name: '".$value['fname']."_',
  357. hiddenName : '".$value['fname']."',
  358. editable: false,xtype: 'combo',
  359. store:new Ext.data.SimpleStore({
  360. fields:['name','value'],
  361. data:[".$items."]}),
  362. mode:'local',
  363. displayField:'name',
  364. selectOnFocus:true,
  365. valueField :'value',
  366. ".(($config['STR'])?("".$config['STR'].""):(""))."
  367. triggerAction:'all'
  368. }";
  369. break;}
  370. case 'radiogroup':{
  371. $tempxx = json_decode($value['zyz'],true);
  372. $config_num = count($tempxx);
  373. if($config_num != 0){
  374. $items='';
  375. if($_GET['id']!=''){
  376. foreach($tempxx as $key => $data){
  377. if($data['yv']==$fdada[$value['fname']]){
  378. $items.= "{boxLabel:'".$data['xv']."',name:'".$value['fname']."',inputValue:'".$data['yv']."',checked: true}";}else{
  379. $items.= "{boxLabel:'".$data['xv']."',name:'".$value['fname']."',inputValue:'".$data['yv']."'}";}
  380. if($key < $config_num-1){
  381. $items.= ",";
  382. }
  383. }
  384. }else{
  385. foreach($tempxx as $key => $data){
  386. if($data['ck']=='1'){
  387. $items.= "{boxLabel:'".$data['xv']."',name:'".$value['fname']."',inputValue:'".$data['yv']."',checked: true}";}else{
  388. $items.= "{boxLabel:'".$data['xv']."',name:'".$value['fname']."',inputValue:'".$data['yv']."'}";}
  389. if($key < $config_num-1){
  390. $items.= ",";
  391. }
  392. }
  393. }
  394. }
  395. $js[$value['fname']] ="{
  396. xtype: 'radiogroup',
  397. ".$back."
  398. ".(($value['width']&&$value['width']<=$config_num)?("columns:".$value['width'].","):(""))."
  399. ".(($config['vertical'])?("vertical: true,"):(""))."
  400. ".((!$value['yxwk'])?("allowBlank:false,blankText:'".adxx($value['ts'])."',"):(""))."
  401. anchor: '95%',
  402. items: [".$items."],
  403. ".(($config['STR'])?("".$config['STR'].""):(""))."
  404. fieldLabel:'".$value['name']."'
  405. }";
  406. break;}
  407. case 'recommend':{
  408. $items='';
  409. if(1==$fdada[$value['fname']]){
  410. $items.= "{boxLabel:'???',name:'".$value['fname']."',inputValue:'1',checked: true},";
  411. $items.= "{boxLabel:'???',name:'".$value['fname']."',inputValue:'0'}";
  412. }else{
  413. $items.= "{boxLabel:'???',name:'".$value['fname']."',inputValue:'1'},";
  414. $items.= "{boxLabel:'???',name:'".$value['fname']."',inputValue:'0',checked: true}";
  415. }
  416. $js[$value['fname']] ="{
  417. xtype: 'radiogroup',
  418. ".$back."
  419. ".((!$value['yxwk'])?("allowBlank:false,blankText:'".adxx($value['ts'])."',"):(""))."
  420. anchor: '95%',
  421. items: [".$items."],
  422. ".(($config['STR'])?("".$config['STR'].""):(""))."
  423. fieldLabel:'".$value['name']."'
  424. }";
  425. break;}
  426. case 'checkboxgroup':{
  427. $tempxx = json_decode($value['zyz'],true);
  428. $config_num = count($tempxx);
  429. if($config_num != 0){
  430. $items='';
  431. if($_GET['id']!=''){
  432. $xsarray=explode("#_#",$fdada[$value['fname']]);
  433. foreach($tempxx as $key => $data){
  434. if(in_array($data['yv'],$xsarray)){
  435. $items.= "{boxLabel:'".$data['xv']."',name:'".$value['fname']."[".$key."]',inputValue:'".$data['yv']."',checked: true}";}else{
  436. $items.= "{boxLabel:'".$data['xv']."',name:'".$value['fname']."[".$key."]',inputValue:'".$data['yv']."'}";}
  437. if($key < $config_num-1){
  438. $items.= ",";
  439. }
  440. }
  441. }else{
  442. foreach($tempxx as $key => $data){
  443. if($data['ck']=='1'){
  444. $items.= "{boxLabel:'".$data['xv']."',name:'".$value['fname']."[".$key."]',inputValue:'".$data['yv']."',checked: true}";}else{
  445. $items.= "{boxLabel:'".$data['xv']."',name:'".$value['fname']."[".$key."]',inputValue:'".$data['yv']."'}";}
  446. if($key < $config_num-1){
  447. $items.= ",";
  448. }
  449. }
  450. }
  451. }
  452. $js[$value['fname']] ="{
  453. xtype:'checkboxgroup',
  454. ".$back."
  455. ".(($value['width']&&$value['width']<=$config_num)?("columns:".$value['width'].","):(""))."
  456. ".(($config['vertical'])?("vertical: true,"):(""))."
  457. ".((!$value['yxwk'])?("allowBlank:false,blankText:'".adxx($value['ts'])."',"):(""))."
  458. anchor: '95%',
  459. items: [".$items."],
  460. ".(($config['STR'])?("".$config['STR'].""):(""))."
  461. fieldLabel:'".$value['name']."'
  462. }";
  463. break;}
  464. default:{
  465. $js[$value['fname']] ="{
  466. xtype: 'textfield',
  467. fieldLabel: '{$value['name']}',
  468. name: '{$value['fname']}',
  469. ".$back."
  470. anchor:'60%'
  471. }";
  472. break;
  473. }
  474. }
  475. Tr($plugurl,'plugurl');
  476. Tr($plugjs,'plugjs');
  477. Tr($fckplugin,'fckplugin');
  478. if($_GET['id']==0){
  479. Tr('??','action');
  480. }else{
  481. Tr('??','action');
  482. }
  483. Tr($js[$value['fname']],'fcf');
  484. Ts('zdgx/add.html');
  485. break;}
  486. case 'insert':{
  487. Ts('user/list.html');
  488. break;}
  489. default:{
  490. Ts('zdgx/password.html');
  491. break;
  492. }
  493. }
  494. ?>