PageRenderTime 61ms CodeModel.GetById 8ms app.highlight 47ms RepoModel.GetById 1ms app.codeStats 1ms

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