function editor($field, $value, $fieldinfo) { //是否允许用户上传附件 ,后台管理员开启此功能 extract($fieldinfo); extract(string2array($setting)); $allowupload = defined('IN_ADMIN') ? 1 : 0; if(!$value) $value = $defaultvalue; if($minlength || $pattern) $allow_empty = ''; if($errortips) $this->formValidator .= '$("#'.$field.'").formValidator({'.$allow_empty.'onshow:"",onfocus:"'.$errortips.'"}).inputValidator({min:1,onerror:"'.$errortips.'"});'; return "<div id='{$field}_tip'></div>".'<textarea name="info['.$field.']" id="'.$field.'" boxid="'.$field.'">'.$value.'</textarea>'.form::editor($field,$toolbar,'member','','',$allowupload,1,'',300); }
function meta_custom() { $form = new form('details', null); $form->text('name', array('label' => 'Text Field')); $form->image('image', array('label' => 'Image Field', 'button' => 'Add Your Image')); $form->file('file', array('label' => 'File Field', 'button' => 'Select a File')); $form->textarea('address', array('label' => 'Textarea', 'validate' => 'html')); $form->select('rooms', array('one', 'two', 'three'), array('label' => 'Select List')); $form->radio('baths', array('blue', 'green', 'red'), array('label' => 'Radio Buttons')); $form->editor('baths', 'WYSIWYG Editor'); }
?> </textarea> 还可输入<B><span id="description_len"><?php echo 255 - strlen($info['description']); ?> </span></B> 个字符 </td> </tr> <tr> <th width="60"> <font color="red">*</font> <?php echo L('content'); ?> </th> <td><div id='content_tip'></div><textarea name="data[content]" id="content" boxid="content"><?php echo $data['content']; ?> </textarea><?php echo form::editor('content', 'full', 'content', '', '', 1); ?> <div class="content_attr"><label><input name="add_introduce" type="checkbox" value="1" checked><?php echo L('iscutcontent'); ?> </label><input type="text" name="introcude_length" value="200" size="3"><?php echo L('characters_to_contents'); ?> <label><input type='checkbox' name='auto_thumb' value="1" checked><?php echo L('iscutcotent_pic'); ?> </label><input type="text" name="auto_thumb_no" value="1" size="2" class=""><?php echo L('picture2thumb'); ?> </div></td> <tr>
function editor($field, $value, $fieldinfo) { $grouplist = getcache('grouplist', 'member'); $_groupid = param::get_cookie('_groupid'); $grouplist = $grouplist[$_groupid]; extract($fieldinfo); extract(string2array($setting)); $disabled_page = isset($disabled_page) ? $disabled_page : 0; if (!$height) { $height = 300; } $allowupload = defined('IN_ADMIN') ? 1 : $grouplist['allowattachment'] ? 1 : 0; if (!$value) { $value = $defaultvalue; } if ($minlength || $pattern) { $allow_empty = ''; } if ($minlength) { $this->formValidator .= '$("#' . $field . '").formValidator({' . $allow_empty . 'onshow:"",onfocus:"' . $errortips . '"}).functionValidator({ fun:function(val,elem){ var oEditor = CKEDITOR.instances.' . $field . '; var data = oEditor.getData(); if($(\'#islink\').attr(\'checked\')){ return true; } else if(($(\'#islink\').attr(\'checked\')==false) && (data==\'\')){ return "' . $errortips . '"; } else if (data==\'\' || $.trim(data)==\'\') { return "' . $errortips . '"; } return true; } });'; } return "<div id='{$field}_tip'></div>" . '<textarea name="info[' . $field . ']" id="' . $field . '" boxid="' . $field . '">' . $value . '</textarea>' . form::editor($field, $toolbar, 'content', $this->catid, '', $allowupload, 1, '', $height, $disabled_page); }
<select name="config_value[]" value="0"> <?php foreach ($name['range'] as $key => $v) {?> <option value="<?php echo $key?>" <?php if($key == $name['value']){ ?> selected="" <?php } ?> ><?php echo $v?></option> <?php }?> </select> <?php }?> <input type="hidden" value="<?php echo $conf?>" name="config_name[]"/> </td> </tr> <?php }?> <tr> <td><?php echo L('payment_mode').L('desc')?></td> <td> <textarea name="description" rows="2" cols="10" id="description" class="inputtext" style="height:100px;width:300px;"><?php echo $pay_desc?></textarea> <?php echo form::editor('description', 'desc');?> </td> </tr> <tr> <td width="120"><?php echo L('listorder')?></td> <td><input type="text" name="pay_order" value="<?php echo $pay_order?>" class="input-text" id="pay_order" size="3"></input></td> </tr> <tr> <td width="120"><?php echo L('online')?>?</td> <td><?php echo $is_online ? L('yes'):L('no')?></td> </tr> <tr> <td width="120"><?php echo L('pay_factorage')?>:</td> <td id="paymethod"><input name="pay_method" value="0" type="radio" <?php echo ($pay_method == 1) ? '': 'checked'?>> <?php echo L('pay_method_rate')?> <input name="pay_method" value="1" type="radio" <?php echo ($pay_method == 0) ? '': 'checked'?>> <?php echo L('pay_method_fix')?> </td> </tr> <tr><td></td>
<th width="80"><?php echo L('announce_title')?></th> <td><input name="announce[title]" id="title" value="<?php echo new_html_special_chars($an_info['title'])?>" class="input-text" type="text" size="50" ></td> </tr> <tr> <th><?php echo L('startdate')?>:</th> <td><?php echo form::date('announce[starttime]', $an_info['starttime'], 1)?></td> </tr> <tr> <th><?php echo L('enddate')?>:</th> <td><?php $an_info['endtime'] = $an_info['endtime']=='0000-00-00' ? '' : $an_info['endtime']; echo form::date('announce[endtime]', $an_info['endtime'], 1);?></td> </tr> <tr> <th><?php echo L('announce_content')?></th> <td > <textarea name="announce[content]" id="content"><?php echo $an_info['content']?></textarea> <?php echo form::editor('content','basic');?> </td> </tr> <tr> <th><strong><?php echo L('available_style')?>:</strong></th> <td><?php echo form::select($template_list, $an_info['style'], 'name="announce[style]" id="style" onchange="load_file_list(this.value)"', L('please_select'))?></td> </tr> <tr> <th><?php echo L('template_select')?>:</th> <td id="show_template"><?php if ($an_info['style']) echo '<script type="text/javascript">$.getJSON(\'?m=zl_admin&c=category&a=public_tpl_file_list&style='.$an_info['style'].'&id='.$an_info['show_template'].'&module=announce&templates=show&name=announce&pc_hash=\'+pc_hash, function(data){$(\'#show_template\').html(data.show_template);});</script>'?></td> </tr> <tr> <th><?php echo L('announce_status')?></th> <td><input name="announce[passed]" type="radio" value="1" <?php if($an_info['passed']==1) {?>checked<?php }?>></input> <?php echo L('pass')?> <input name="announce[passed]" type="radio" value="0" <?php if($an_info['passed']==0) {?>checked<?php }?>> <?php echo L('unpass')?></td> </tr> </tbody>
<td><input type="text" style="width:400px;" name="info[title]" id="title" value="<?php echo $title?>" style="color:<?php echo $style;?>" class="measure-input " onBlur="$.post('api.php?op=get_keywords&number=3&sid='+Math.random()*5, {data:$('#title').val()}, function(data){if(data && $('#keywords').val()=='') $('#keywords').val(data); })"/> <input type="hidden" name="style_color" id="style_color" value="<?php echo $style_color;?>"> <input type="hidden" name="style_font_weight" id="style_font_weight" value="<?php echo $style_font_weight;?>"> <img src="statics/images/icon/colour.png" width="15" height="16" onclick="colorpicker('title_colorpanel','set_title_color');" style="cursor:hand"/> <img src="statics/images/icon/bold.png" width="10" height="10" onclick="input_font_bold()" style="cursor:hand"/> <span id="title_colorpanel" style="position:absolute; z-index:200" class="colorpanel"></span> </td> </tr> <tr> <th width="80"> <?php echo L('keywords');?> </th> <td><input type="text" name="info[keywords]" id="keywords" value="<?php echo $keywords?>" size="50"> <?php echo L('explode_keywords');?></td> </tr> <tr> <th width="80"> <?php echo L('content');?> </th> <td> <textarea name="info[content]" id="content"><?php echo $content?></textarea> <?php echo form::editor('content','full','','','',1,1)?> </td></tr> </table> </div> <div class="bk10"></div> <div class="btn"> <input type="hidden" name="info[catid]" value="<?php echo $catid;?>" /> <input type="hidden" name="edit" value="<?php echo $title ? 1 : 0;?>" /> <input type="submit" class="button" name="dosubmit" value="<?php echo L('submit');?>" /> </div> </div> </form> </div> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>content_addtop.js"></script> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>colorpicker.js"></script>
<input type="hidden" name="style_color" id="style_color" value=""> <input type="hidden" name="style_font_weight" id="style_font_weight" value=""> <input type="button" class="button" id="check_title_alt" value="<?php echo L('check_exist')?>" onclick="$.get('?m=special&c=content&a=public_check_title&sid='+Math.random()*5, {data:$('#title').val()}, function(data){if(data=='1') {$('#check_title_alt').val('<?php echo L('title_exist')?>');$('#check_title_alt').css('background-color','#FFCC66');} else if(data=='0') {$('#check_title_alt').val('<?php echo L('title_no_exist')?>');$('#check_title_alt').css('background-color','#F8FFE1')}})"/> <img src="statics/images/icon/colour.png" width="15" height="16" onclick="colorpicker('title_colorpanel','set_title_color');" style="cursor:hand"/> <img src="statics/images/icon/bold.png" width="10" height="10" onclick="input_font_bold()" style="cursor:hand"/> <span id="title_colorpanel" style="position:absolute; z-index:200" class="colorpanel"></span> </td> </tr> <tr> <th width="80"> <?php echo L('keywords')?> </th> <td><input type='text' name='info[keywords]' id='keywords' value='<?php echo $info['keywords']?>' style='50' > <?php echo L('more_keywords_with_blanks')?></td> </tr> <tr> <th width="60"> <?php echo L('description')?> </th> <td><textarea name="info[description]" id="description" style='width:98%;height:46px;' onkeyup="strlen_verify(this, 'description_len', 255)"><?php echo $info['description']?></textarea> 还可输入<B><span id="description_len"><?php echo 255-strlen($info['description'])?></span></B> 个字符 </td> </tr> <tr> <th width="60"> <font color="red">*</font> <?php echo L('content')?> </th> <td><div id='content_tip'></div><textarea name="data[content]" id="content" boxid="content"><?php echo $data['content']?></textarea><?php echo form::editor('content', 'full', 'content', '', '', 1)?><div class="content_attr"><label><input name="add_introduce" type="checkbox" value="1" checked><?php echo L('iscutcontent')?></label><input type="text" name="introcude_length" value="200" size="3"><?php echo L('characters_to_contents')?> <label><input type='checkbox' name='auto_thumb' value="1" checked><?php echo L('iscutcotent_pic')?></label><input type="text" name="auto_thumb_no" value="1" size="2" class=""><?php echo L('picture2thumb')?></div></td> <tr> <th width="60"> <?php echo L('paginationtype')?> </th> <td><select name="data[paginationtype]" id="paginationtype" onchange="if(this.value==1)$('#paginationtype1').css('display','');else $('#paginationtype1').css('display','none');"> <option value="0"<?php if($data['paginationtype']==0) {?> selected<?php }?>><?php echo L('no_page')?></option> <option value="1"<?php if($data['paginationtype']==1) {?> selected<?php }?>><?php echo L('collate_copies')?></option> <option value="2"<?php if($data['paginationtype']==2) {?> selected<?php }?>><?php echo L('manual_page')?></option> </select> <span id="paginationtype1" style="display:<?php if($data['paginationtype']==1) {?>block<?php } else {?>none<?php }?>"><input name="data[maxcharperpage]" type="text" id="maxcharperpage" value="<?php echo $data['maxcharperpage']?>" size="8" maxlength="8"><?php echo L('number_of_characters')?></span> </td> </tr> </tbody></table> </div> </div> </div>
<fieldset> <legend><?php echo L('block_data'); ?> </legend> <table width="100%" class="table_form" id="table_form"> <?php if ($data['type'] == 1) { ?> <tr> <td class="y-bg"><textarea cols="80" id="data" name="data" rows="10"><?php echo htmlspecialchars($data['data']); ?> </textarea> <?php echo form::editor('data', 'full', '', '', '', 1); ?> </td> </tr> <?php } else { if (is_array($data['data'])) { foreach ($data['data'] as $key => $val) { ?> <tr> <td> <div class="contents" id="content_<?php echo $key; ?> "><a href="<?php echo $val['url'];
<th><strong><?php echo L('enddate'); ?> :</strong></th> <td><?php echo form::date('announce[endtime]', $an_info['endtime'], 1); ?> </td> </tr> <tr> <th><strong><?php echo L('announce_content'); ?> </strong></th> <td><textarea name="announce[content]" id="content"></textarea><?php echo form::editor('content'); ?> </td> </tr> <tr> <th><strong><?php echo L('available_style'); ?> :</strong></th> <td> <?php echo form::select($template_list, $info['default_style'], 'name="announce[style]" id="style" onchange="load_file_list(this.value)"', L('please_select')); ?> </td> </tr>
<fieldset> <legend><?php echo L('block_data'); ?> </legend> <table width="100%" class="table_form" id="table_form"> <?php if ($data['type'] == 1) { ?> <tr> <td class="y-bg"><textarea cols="80" id="data" name="data" rows="10"><?php echo htmlspecialchars($data['data']); ?> </textarea> <?php echo form::editor('data', 'full', '#E0EAFC', '', '', 1); ?> </td> </tr> <?php } else { if (is_array($data['data'])) { foreach ($data['data'] as $key => $val) { ?> <tr> <td> <div class="contents" id="content_<?php echo $key; ?> "><a href="<?php echo $val['url'];
function fckedit_action() { $id = front::post('id'); $tpl = str_replace('#','',$id); $tpid = $tpl; $tpl = str_replace('_d_','/',$tpl); $tpl = str_replace('_html','.html',$tpl); $res = array(); $res['content'] = file_get_contents(TEMPLATE .'/'.config::get('template_dir') .'/'.$tpl); $res['content'] = "<span id='{$tpid}_fck'></span>".form::editor($tpid .'_content',$res['content']); session::set('fcid',$tpid .'_content'); session::set('fcid_life',time() +10); echo json::encode($res); exit; }
<tbody> <tr> <th width="80"><strong><?php echo L('announce_title')?></strong></th> <td><input name="announce[title]" id="title" class="input-text" type="text" size="50" ></td> </tr> <tr> <th><strong><?php echo L('startdate')?>:</strong></th> <td><?php echo form::date('announce[starttime]', date('Y-m-d H:i:s'), 1)?></td> </tr> <tr> <th><strong><?php echo L('enddate')?>:</strong></th> <td><?php echo form::date('announce[endtime]', $an_info['endtime'], 1);?></td> </tr> <tr> <th><strong><?php echo L('announce_content')?></strong></th> <td><textarea name="announce[content]" id="content"></textarea><?php echo form::editor('content');?></td> </tr> <tr> <th><strong><?php echo L('available_style')?>:</strong></th> <td> <?php echo form::select($template_list, $info['default_style'], 'name="announce[style]" id="style" onchange="load_file_list(this.value)"', L('please_select'))?> </td> </tr> <tr> <th><strong><?php echo L('template_select')?>:</strong></th> <td id="show_template"><script type="text/javascript">$.getJSON('?m=zl_admin&c=category&a=public_tpl_file_list&style=<?php echo $info['default_style']?>&module=announce&templates=show&name=announce&pc_hash='+pc_hash, function(data){$('#show_template').html(data.show_template);});</script></td> </tr> <tr> <th><strong><?php echo L('announce_status')?></strong></th> <td><input name="announce[passed]" type="radio" value="1" checked> <?php echo L('pass')?> <input name="announce[passed]" type="radio" value="0"> <?php echo L('unpass')?></td> </tr>
function getform($name,$form,$field,$data) { if (get('table') &&isset(setting::$var[get('table')][$name])) $form[$name]=setting::$var[get('table')][$name]; if (get('form') &&isset(setting::$var[get('form')][$name])) $form[$name]=setting::$var[get('form')][$name]; if (isset($form[$name]['default'])) $form[$name]['default']=preg_replace('/\{\?([^}]+)\}/e',"eval('return $1;')",$form[$name]['default']); if (!isset($data[$name]) &&isset($form[$name]['default'])) $data[$name]=@$form[$name]['default']; if (preg_match('/templat/',$name) &&empty($data[$name])) $data[$name]=@$form[$name]['default']; if (@$form[$name]['filetype'] == 'image') { $return=form::upload_image($name,front::post($name) ?front::post($name) : @$data[$name]); } elseif (@$form[$name]['filetype'] == 'file') { $return=form::upload_file($name,front::post($name) ?front::post($name) : @$data[$name]); } elseif (@$form[$name]['filetype'] == 'image1') { $return=form::upload_image1($name,front::post($name) ?front::post($name) : @$data[$name]); } elseif (@$form[$name]['filetype'] == 'image2') { $return=form::upload_image2($name,front::post($name) ?front::post($name) : @$data[$name]); } elseif (@$form[$name]['filetype'] == 'image_mui') { $return=form::upload_imagemui($name,front::post($name) ?front::post($name) : @$data[$name]); } elseif (@$form[$name]['filetype'] == 'thumb') { $return=form::upload_thumb($name,front::post($name) ?front::post($name) : @$data[$name]); } elseif (@$form[$name]['selecttype'] == 'select') { preg_match_all('%\((.*?)\)(\S+)%s',$form[$name]['select'],$result,PREG_SET_ORDER); $sdata=array(); foreach ($result as $res) $sdata[$res[1]]=$res[2]; $return=form::select($name,front::post($name) ?front::post($name) : @$data[$name],$sdata,' class="select"'); } elseif (@$form[$name]['selecttype'] == 'radio') { preg_match_all('/\(([\d\w]+)\)(\S+)/m',$form[$name]['select'],$result,PREG_SET_ORDER); $_res=''; foreach ($result as $res) $_res .= $res[2].form::radio($name,$res[1],$res[1] == (front::post($name) ?front::post($name) : @$data[$name]))." "; $return=$_res; } elseif (@$form[$name]['selecttype'] == 'checkbox') { preg_match_all('/\(([\d\w]+)\)(\S+)/is',$form[$name]['select'],$result,PREG_SET_ORDER); $_res=''; $values=front::post($name) ?front::$post[$name] : @$data[$name]; if (is_string($values)) $values=explode(',',$values); if (!$values) $values=array(); foreach ($result as $res) $_res .=$res[2].form::checkbox($name.'[]',$res[1],in_array($res[1],$values))." "; return $_res; } elseif (@$field[$name]['type'] == 'text') { $return=form::textarea($name,front::post($name) ?front::post($name) : @$data[$name],''); } elseif (@$field[$name]['type'] == 'mediumtext') { $return=form::editor($name,front::post($name) ?front::post($name) : @$data[$name]); } elseif (@$field[$name]['type'] == 'datetime' or @$field[$name]['type'] == 'date') { $return=form::date($name,front::post($name) ?front::post($name) : @$data[$name]); } else $return=form::input($name,front::post($name) ?front::post($name) : @$data[$name],''); if ($field[$name]['notnull']) $return.=" "; if (@$form[$name]['tips']) { $tips=preg_replace('/\{\?([^}]+)\}/e',"eval('return $1;')",@$form[$name]['tips']); $return.=" ".$tips; } return $return; }
.thumb{float: left;width: 100px; height: 90px} a.close{background: url(<?php echo IMG_PATH?>cross.png) no-repeat left -46px; display:block; width:16px;height:16px;display:inline-block;display:-moz-inline-stack;zoom:1;*display:inline;} .forms{display:none;} </style> <script type="text/javascript" src="<?php echo JS_PATH?>swfupload/swf2ckeditor.js"></script> <?php endif;?> <div class="pad-10"> <form action="?m=block&c=block_admin&a=block_update&id=<?php echo $id?>" method="post" id="myform"> <fieldset> <legend><?php echo L('block_data')?></legend> <table width="100%" class="table_form" id="table_form"> <?php if ($data['type'] == 1) :?> <tr> <td class="y-bg"><textarea cols="80" id="data" name="data" rows="10"><?php echo new_html_special_chars($data['data'])?></textarea> <?php echo form::editor('data','full','','','',1)?></td> </tr> <?php else:?> <?php if(is_array($data['data'])) foreach($data['data'] as $key=>$val):?> <tr> <td> <div class="contents" id="content_<?php echo $key?>"><a href="<?php echo $val['url']?>" target="blank"><b><?php echo $val['title']?></b></a><br /><div style="color:#ccc;"><?php if($val['thumb']):?><img src="<?php echo $val['thumb']?>" class="thumb" /><?php endif;?><?php echo $val['desc']?></div></div> <div class="forms" id="form_<?php echo $key?>"> <?php echo L('title')?>:<input type="text" id="title_<?php echo $key?>" name="title[]" class="input-text" value="<?php echo $val['title']?>" > <?php echo L('link')?>:<input type="text" id="url_<?php echo $key?>" name="url[]" class="input-text" value="<?php echo $val['url']?>" > <?php echo L('thumb')?>:<input type="hidden" name="thumb[]" id="thumb_<?php echo $key?>" value="<?php echo $val['thumb']?>" > <a href="javascript:void(0)" onclick="flashupload('thumb_images', '<?php echo L('attachment_upload')?>','thumb_<?php echo $key?>',submit_images,'1,jpg|jpeg|gif|bmp|png,1','block', '', '<?php echo upload_key('1,jpg|jpeg|gif|bmp|png,1')?>')"><?php echo L('pic_upload')?></a> <a href="javascript:void(0)" onclick="$('#thumb_<?php echo $key?>').val('')"><?php echo L('delete_image')?></a><br /><?php echo L('desc')?>:<textarea id="desc_<?php echo $key?>" name="desc[]" rows="10" cols="80"><?php echo str_replace(array(chr(13), chr(43)), array('<br />', ' '), $val['desc'])?></textarea><br /> <input type="button" value="<?php echo L('submit')?>" class="button" onclick="form_submit(<?php echo $key?>)" /> </div> </td> <td width="80"><a href="javascript:void(0);" class="arrowhead" onclick="moveUp(this);" title="<?php echo L('up')?>"></a><a href="javascript:void(0);" onclick="moveDown(this);" class="arrowhead-b" title="<?php echo L('down')?>"></a><a href="javascript:void(0)" onclick="edit_form(<?php echo $key?>)"><img src="<?php echo IMG_PATH?>icon/m_2.png" alt="<?php echo L('edit')?>" /></a><a href="javascript:void(0)" onclick="$(this).parent().parent().remove();" class="close" title="<?php echo L('delete')?>"></a></td> </tr> <?php endforeach;endif;?> </table> <div class="bk15"></div>