예제 #1
0
파일: admin.php 프로젝트: dalinhuang/zotop
 function codemirror($attrs)
 {
     $url = zotop::module('codemirror', 'url');
     $options = new stdClass();
     $options->path = $url . '/codemirror/js/';
     $options->parserfile = array('parsexml.js');
     $options->stylesheet = array($url . '/codemirror/css/xmlcolors.css');
     $options->height = is_numeric($attrs['height']) ? $attrs['height'] . 'px' : $attrs['height'];
     $options->width = is_numeric($attrs['width']) ? $width . 'px' : $attrs['width'];
     $options->continuousScanning = 500;
     $options->autoMatchParens = true;
     if ($attrs['linenumbers'] !== false) {
         $options->lineNumbers = true;
         $options->textWrapping = false;
     }
     if ($attrs['tabmode'] == '') {
         $options->tabMode = 'shift';
     }
     $html = array();
     $html[] = html::script($url . '/codemirror/js/codemirror.js');
     $html[] = html::stylesheet($url . '/codemirror/css/codemirror.css');
     $html[] = '	' . field::textarea($attrs);
     $html[] = '<script type="text/javascript">';
     $html[] = '	var editor = CodeMirror.fromTextArea("' . $attrs['name'] . '", ' . json_encode($options) . ');';
     $html[] = '$(function(){';
     $html[] = '	$("form").submit(function(){';
     $html[] = '		$("textarea[name=+' . $attrs['name'] . '+]").val(editor.getCode());';
     $html[] = '	});';
     $html[] = '})';
     $html[] = '</script>';
     return implode("\n", $html);
 }
예제 #2
0
파일: file.php 프로젝트: dalinhuang/zotop
 public static function source($attrs)
 {
     $html = array();
     $html[] = '';
     $html[] = '<div style="height:460px;overflow:hidden;">';
     $html[] = '<div id="SourceEditorPannel">正在加载编辑器,请稍后……</div>';
     $html[] = html::script(url::common() . '/js/swfobject.js');
     $html[] = html::script(url::module() . '/admin/js/file.js');
     $html[] = field::textarea($attrs);
     $html[] = '</div>';
     return implode("\n", $html);
 }
예제 #3
0
파일: admin.php 프로젝트: dalinhuang/zotop
 function xheditor_rc1($attrs)
 {
     $attrs['class'] = isset($attrs['class']) ? 'editor ' . $attrs['class'] : 'editor';
     $tools = array('image' => '<a href="' . zotop::url('system/image/upload') . '" class="button editor-insert" name="' . $attrs['name'] . '"><span class="zotop-icon zotop-icon-imageuploader button-icon"></span><span class="button-text">插入图片</span></a>', 'file' => '<a href="' . zotop::url('system/file/upload') . '" class="button editor-insert" name="' . $attrs['name'] . '"><span class="zotop-icon zotop-icon-fileuploader button-icon"></span><span class="button-text">插入文件</span></a>', 'template' => '<a href="' . zotop::url('system/file/upload') . '" class="button editor-insert" name="' . $attrs['name'] . '"><span class="zotop-icon zotop-icon-template button-icon"></span><span class="button-text">插入模板</span></a>');
     $tools = zotop::filter('editor.tools', $tools);
     $tools = arr::take('tools', $attrs) === false ? array() : $tools;
     $url = zotop::module('xheditor', 'url');
     $html[] = html::script($url . '/editor/xheditor-zh-cn.min.js');
     $html[] = html::script($url . '/common/global.js');
     if (is_array($tools) && !empty($tools)) {
         $html[] = '<div class="field-toolbar">';
         foreach ($tools as $tool) {
             $html[] = ' ' . $tool;
         }
         $html[] = '</div>';
     }
     $html[] = '	' . field::textarea($attrs);
     return implode("\n", $html);
 }
예제 #4
0
파일: field.php 프로젝트: dalinhuang/zotop
 public static function source($attrs)
 {
     $attrs['style'] = 'width:600px;height:460px;';
     return field::textarea($attrs);
 }
예제 #5
0
파일: field.php 프로젝트: dalinhuang/zotop
 /**
  * 富文本编辑器
  * 
  * @param $attrs array 控件参数
  * @return string 控件代码
  */
 public static function editor($attrs)
 {
     return field::textarea($attrs);
 }