Example #1
0
/**
 * 编辑器字段 表单组合处理
 * @param type $field 字段名
 * @param type $value 字段内容
 * @param type $fieldinfo 字段配置
 * @return type
 */
function editor($field, $value, $fieldinfo)
{
    $setting = unserialize($fieldinfo['setting']);
    //是否禁用分页和子标题 基本没用。。。
    $disabled_page = isset($disabled_page) ? $disabled_page : 0;
    //编辑器高度
    $height = $setting['height'];
    if (empty($setting['height'])) {
        $height = 300;
    }
    if (defined('IN_ADMIN') && IN_ADMIN) {
        //是否允许上传
        $allowupload = 1;
        //编辑器类型,简洁型还是标准型
        $toolbar = $setting['toolbar'];
    } else {
        //获取当前登陆会员组id
        $groupid = cookie('groupid');
        if (isModuleInstall('Member')) {
            $Member_group = cache("Member_group");
            //是否允许上传
            $allowupload = $Member_group[$groupid]['allowattachment'] ? 1 : 0;
        } else {
            $allowupload = 0;
        }
        //编辑器类型,简洁型还是标准型
        $toolbar = $setting['mbtoolbar'] ? $setting['mbtoolbar'] : "basic";
    }
    //内容
    if (empty($value)) {
        $value = $setting['defaultvalue'] ? $setting['defaultvalue'] : '<p></p>';
    }
    if ($setting['minlength'] || $fieldinfo['pattern']) {
        $allow_empty = '';
    }
    //模块
    $module = MODULE_NAME;
    $form = \Form::editor($field, $toolbar, $module, $this->catid, $allowupload, $allowupload, '', 10, $height, $disabled_page);
    //javascript
    $this->formJavascript .= "\n            //增加编辑器验证规则\n            jQuery.validator.addMethod('editor{$field}',function(){\n                return " . ($fieldinfo['minlength'] ? "editor{$field}.getContent();" : "true") . "\n            });\n    ";
    //错误提示
    $errortips = $this->fields[$field]['errortips'];
    //20130428 由于没有设置必须输入时,ajax提交会造成获取不到编辑器的值。所以这里强制进行验证,使其触发编辑器的sync()方法
    // if ($minlength){
    //验证规则
    $this->formValidateRules['info[' . $field . ']'] = array("editor{$field}" => "true");
    //验证不通过提示
    $this->formValidateMessages['info[' . $field . ']'] = array("editor{$field}" => $errortips ? $errortips : $fieldinfo['name'] . "不能为空!");
    // }
    return "<div id='{$field}_tip'></div>" . '<script type="text/plain" id="' . $field . '" name="info[' . $field . ']">' . $value . '</script>' . $form;
}
Example #2
0
function editor($field, $value, $fieldinfo)
{
    $setting = unserialize($fieldinfo['setting']);
    extract($setting);
    extract($fieldinfo);
    $disabled_page = isset($disabled_page) ? $disabled_page : 0;
    //编辑器高度
    if (!$height) {
        $height = 300;
    }
    //是否允许上传
    if (defined('IN_ADMIN') && IN_ADMIN) {
        $allowupload = 1;
    } else {
        $Member_group = F("Member_group");
        $groupid = SiteCookie('groupid');
        $allowupload = $Member_group[$groupid]['allowattachment'] ? 1 : 0;
        $toolbar = $mbtoolbar ? $mbtoolbar : "basic";
    }
    //内容
    if (!$value) {
        $value = $defaultvalue;
    }
    if ($minlength || $pattern) {
        $allow_empty = '';
    }
    $form = Form::editor($field, $toolbar, 'Contents', $this->catid, $allowupload, 1, '', 10, $height, $disabled_page);
    //javascript
    $this->formJavascript .= "\r\n            //编辑器\r\n            editor{$field} = new baidu.editor.ui.Editor(editor_config_{$field});\r\n            editor{$field}.render( '{$field}' );\r\n            try{editor{$field}.sync();}catch(err){};\r\n            //增加编辑器验证规则\r\n            jQuery.validator.addMethod('editor{$field}',function(){\r\n                try{editor{$field}.sync();}catch(err){};\r\n                return editor{$field}.hasContents();\r\n            });\r\n    ";
    //错误提示
    $errortips = $this->fields[$field]['errortips'];
    if ($minlength) {
        //验证规则
        $this->formValidateRules['info[' . $field . ']'] = array("editor{$field}" => "true");
        //验证不通过提示
        $this->formValidateMessages['info[' . $field . ']'] = array("editor{$field}" => $errortips ? $errortips : $name . "不能为空!");
    }
    return "<div id='{$field}_tip'></div>" . '<textarea id="' . $field . '" name="info[' . $field . ']">' . $value . '</textarea>' . $form;
}
Example #3
0
								class="input-text" id="name"></input>
						</td>
					</tr>
					<tr>
						<td><?php 
echo L('payment_mode') . L('desc');
?>
</td>
						<td>
							<textarea name="description" rows="2" cols="10" id="description"
								class="inputtext"><?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>
Example #4
0
                 </case>
                 <case value="checkbox">
                 <volist name="vo['setting']['option']" id="rs">
                 <label><input name="extend[{$vo.fieldname}][]" value="{$rs.value}" type="checkbox"  <if condition=" in_array($rs['value'],$extend[$vo['fieldname']]) ">checked</if>> {$rs.title}</label>
                 </volist>
                 </case>
              </switch>
              </td>
            </tr>
            </volist>
            <tr>
              <th width="80">
                内容正文 
               </th>
              <td><span class="must_red">*</span><div id='content_tip'></div><script type="text/plain" id="content" name="info[content]">{$info.content}</script><?php 
echo Form::editor('content', 'full', 'contents', $catid, 1);
?>
</td>
            </tr>
        </tbody>
      </table>
    </div>
</div>
  <div class="btn_wrap" style="z-index:999;text-align: center;">
    <div class="btn_wrap_pd">
      <input type="hidden" name="ajax" value="1" />
      <input type="hidden" name="info[catid]" value="{$catid}" />
      <button class="btn btn_submit J_ajax_submit_btn"type="submit">提交</button>
    </div>
  </div>
  <input type="hidden" name="catid" value="{$catid}"/>
Example #5
0
 public 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);
 }
Example #6
0
?>
</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="btn btn-primary btn-sm"name="dosubmit" value="<?php 
Example #7
0
    public function editor($field, $value, $fieldinfo)
    {
        $grouplist = S('member/grouplist');
        $_groupid = 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){
	if($(\'#islink\').attr(\'checked\')){
	return true;
} else if(($(\'#islink\').attr(\'checked\')==false) && (!UE.getEditor(\'' . $field . '\').hasContents())){
return "' . $errortips . '";
} else if(!UE.getEditor(\'' . $field . '\').hasContents()){
return "' . $errortips . '";
}
return true;
}});';
        }
        return "<div id='{$field}_tip'></div>" . '<textarea name="info[' . $field . ']" id="' . $field . '" boxid="' . $field . '">' . $value . '</textarea><BR>' . Form::editor($field, $toolbar, 'content', $this->catid, '', $allowupload, 1, '', $height, $disabled_page);
    }
Example #8
0
$an_info['endtime'] = $an_info['endtime'] == '0000-00-00' ? '' : $an_info['endtime'];
echo Form::date('announce[endtime]', $an_info['endtime']);
?>
</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 
Example #9
0
          <th>邮箱</th>
          <td><input type="text" name="author_email" value="{$author_email}" class="input" id="author_email" size="30"></td>
        </tr>
        <tr>
          <th>昵称</th>
          <td><input type="text" name="author" value="{$author}" class="input" id="author" size="30"></td>
        </tr>
        <volist name="field" id="vo">
        <tr>
          <th>{$vo.fname}</th>
          <td><input type="text" name="{$vo.f}" value="" class="input" id="{$vo.f}" size="30"></td>
        </tr>
        </volist>
        <tr>
          <th>评论正文</th>
          <td><textarea name="content" id="content" class="inputtext"><font color="#FF0000">@{$data.author}</font>&nbsp;</textarea><?php 
echo Form::editor("content");
?>
</td>
        </tr>
      </tbody></table>
    </div>
     <div class="">
      <div class="btn_wrap_pd">             
        <button class="btn btn_submit mr10 J_ajax_submit_btn" type="submit">回复</button>
      </div>
    </div>
  </form>
</div>
</body>
</html>
Example #10
0
					<th><strong><?php 
echo L('enddate');
?>
:</strong></th>
					<td><?php 
echo Form::date('announce[endtime]', '');
?>
</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, C('template', 'name'), 'name="announce[style]" id="style" onchange="load_file_list(this.value)"', L('please_select'));
?>
		</td>
				</tr>
				<tr>