Example #1
0
 public function editAction($id, $type = '')
 {
     $config = zotop::model('zotop.config');
     $config->id = $id;
     if (form::isPostBack()) {
         $post = form::post();
         $post['settings'] = json_encode($post['settings']);
         $update = $config->update($post, $id);
         if ($update) {
             msg::success('保存成功,重新加载中,请稍后……', zotop::url('zotop/config/index', array('parentid' => $post['parentid'])));
         }
         msg::error(zotop::dump($post, true));
     }
     $field = $config->read();
     $field['settings'] = (array) json_decode($field['settings']);
     $type = empty($type) ? $field['type'] : $type;
     $field['type'] = $type;
     $page = new dialog();
     $page->set('title', '编辑');
     $page->set('body', array('style' => 'min-width:600px;'));
     $page->set('field', $field);
     $page->set('type', $type);
     $page->set('types', $config->types());
     $page->set('controls', $config->controls());
     $page->set('attrs', $config->attrs($type));
     $page->display();
 }
Example #2
0
 public function sqlAction()
 {
     if (form::isPostBack()) {
         msg::error('该功能已经被禁用,请进入设置开启');
     }
     $page = new dialog();
     $page->title = '数据库管理:' . $database['database'] . ' @ ' . $database['hostname'] . '<i>></i> 执行sql语句';
     $page->display();
 }
Example #3
0
 public function actionImageFromUrl($globalid, $field, $image)
 {
     if (form::isPostBack()) {
         msg::error('远程获取中……');
     }
     $page = new dialog();
     $page->set('title', '网络图片');
     $page->set('navbar', $this->navbar($globalid, $field, $image));
     $page->display();
 }
Example #4
0
 public function actionAbout($id)
 {
     $module = zotop::model('system.module');
     $module->id = $id;
     $data = $module->read();
     $page = new dialog();
     $page->set('title', '模块简介');
     $page->set('module', $data);
     $page->display();
 }
Example #5
0
 public function actionEdit($id)
 {
     $category = zotop::model('blog.category');
     if (form::isPostBack()) {
         $post = form::post();
         $category->update($post, $id);
         if (!$category->error()) {
             msg::success('保存成功', zotop::url('blog/category/index'));
         }
         msg::error($category->msg());
     }
     $category->id = $id;
     $data = $category->read();
     $page = new dialog();
     $page->set('title', '编辑分类');
     $page->set('data', $data);
     $page->display();
 }
Example #6
0
 public function onBing()
 {
     $header['title'] = 'Bing搜索';
     dialog::header($header);
     dialog::navbar($this->navbar(), 'bing');
     form::header(array('title' => '', 'description' => '<span class="zotop-tip">请先搜索图片,然后插入</span>'));
     dialog::add(html::iframe('images', 'about:blank', array('width' => '100%', 'style' => 'width:100%;height:200px;')));
     form::buttons(array('id' => 'UploadImages', 'type' => 'submit', 'value' => '插入图片'), array('type' => 'button', 'value' => zotop::t('取消'), 'class' => 'zotop-dialog-close'));
     form::footer();
     dialog::footer();
 }
Example #7
0
 public function onSend()
 {
     $header['title'] = '发送短消息';
     dialog::header($header);
     form::header(array('title' => '', 'description' => '请输入收信人的账户并输入短消息内容', 'class' => 'small'));
     form::field(array('type' => 'text', 'label' => zotop::t('收信人'), 'name' => 'sendto', 'value' => '', 'description' => '请输入收信人的账户名称,多个账户之间请用’逗号‘隔开'));
     form::field(array('type' => 'textarea', 'label' => zotop::t('内 容'), 'name' => 'content', 'value' => ''));
     form::buttons(array('type' => 'submit', 'value' => '发 送'), array('type' => 'button', 'name' => 'close', 'value' => '取消', 'class' => 'zotop-dialog-close'));
     form::footer();
     dialog::footer();
 }
Example #8
0
 public function go()
 {
     $options = array();
     foreach (data::$elements as $element) {
         $options[] = array("short" => $element[0], "long" => $element[1]);
     }
     $result = dialog::display("What's your problem?", "Please help and refine the problem by selecting a category.", "menu", $options);
     if ($result === false) {
         exit;
     }
     var_dump($result);
 }
Example #9
0
 public function onImage()
 {
     $header['title'] = '上传图片';
     $header['js'][] = url::module() . '/admin/js/upload.js';
     dialog::header($header);
     form::header(array('title' => '', 'description' => '', 'class' => 'ajax'));
     form::add(array('type' => 'text', 'label' => t('图片地址'), 'name' => 'image', 'value' => 'http://www.baidu.com/logo.gif', 'description' => '请输入图片地址测试赋值'));
     form::add(array('type' => 'textarea', 'label' => t('图片说明'), 'name' => 'content', 'value' => ''));
     form::buttons(array('id' => 'UploadImage', 'type' => 'button', 'value' => '上传图片'), array('type' => 'button', 'value' => '取消', 'class' => 'zotop-dialog-close'));
     form::footer();
     dialog::footer();
 }
Example #10
0
 public function actionEdit($file = '')
 {
     $file = empty($file) ? zotop::get('file') : $file;
     $file = trim(url::decode($file), '/');
     $filepath = ZOTOP_PATH_ROOT . DS . str_replace('/', DS, $file);
     if (form::isPostBack()) {
         $content = request::post('source');
         $content = trim($content);
         if (empty($content)) {
             msg::error('内容为空,无法保存!');
         }
         file::write($filepath, trim($content));
         msg::success('内容保存成功!');
     }
     $filecontent = file::read($filepath);
     $page = new dialog();
     $page->title = '文件编辑器';
     $page->set('file', $file);
     $page->set('filepath', $filepath);
     $page->set('filecontent', $filecontent);
     $page->display();
 }
Example #11
0
 public function actionEdit($file)
 {
     $filepath = realpath(ZOTOP_PATH_ROOT . DS . trim($file, '/'));
     if (empty($file)) {
         return false;
     }
     if (form::isPostBack()) {
         $content = request::post('source');
         $content = trim($content);
         if (empty($content)) {
             msg::error('内容为空,无法保存!');
         }
         file::write($filepath, trim($content));
         msg::success('内容保存成功!');
     }
     $content = file::read($filepath);
     $page = new dialog();
     $page->title = '文件编辑器';
     $page->set('file', $file);
     $page->set('filepath', $filepath);
     $page->set('content', $content);
     $page->display();
 }
Example #12
0
 public function selectAction($type = 'text')
 {
     $types = array('text' => '单行文本输入框', 'textarea' => '多行文本输入框', 'select' => '单选下拉选择框', 'radio' => '单项选择框', 'checkbox' => '多项选择框', 'editor' => '富文本编辑器', 'image' => '图片上传控件', 'date' => '日期选择控件');
     $attrs = array('text' => 'width,style,class', 'textarea' => 'width,height,style,class', 'select' => 'options,style,width', 'editor' => 'width,height');
     $controls = array('width' => array('type' => 'text', 'name' => 'width', 'label' => '控件宽度', 'value' => '', 'valid' => '', 'description' => '控件的宽度,单位为<b>px</b>'), 'height' => array('type' => 'text', 'name' => 'height', 'label' => '控件高度', 'value' => '', 'valid' => '', 'description' => '控件的高度,单位为<b>px</b>'), 'style' => array('type' => 'text', 'name' => 'style', 'label' => '控件样式', 'value' => '', 'valid' => '', 'description' => '控件的style属性'), 'class' => array('type' => 'text', 'name' => 'class', 'label' => '控件风格', 'value' => '', 'valid' => '', 'description' => '控件的class属性'), 'options' => array('type' => 'textarea', 'name' => 'options', 'label' => '控件选项', 'value' => '', 'valid' => '', 'description' => '每行一个,值和数据使用<b>::</b>隔开'));
     $page = new dialog();
     $page->set('title', '选择控件');
     $page->set('type', $type);
     $page->set('types', $types);
     $page->set('controls', $controls);
     $page->set('attrs', $attrs[$type]);
     $page->display();
 }
Example #13
0
 public function actionEdit($id)
 {
     $folder = zotop::model('system.folder');
     if (form::isPostBack()) {
         $post = form::post();
         if ($post['id'] == $post['parentid']) {
             msg::error('上级分类不能和当前分类相同');
         }
         $folder->update($post, $id);
         if (!$folder->error()) {
             msg::success('保存成功', zotop::url('system/folder/index/' . $post['parentid']));
         }
         msg::error($folder->msg());
     }
     $folder->id = $id;
     $data = $folder->read();
     $folders = $folder->getAll();
     $tree = new tree($folders, 0);
     $data['parentid_options'] = $tree->getOptionsArray();
     $page = new dialog();
     $page->set('title', '编辑分类');
     $page->set('data', $data);
     $page->display();
 }
Example #14
0
 public function onDefault()
 {
     $header['title'] = '关于我们';
     dialog::header($header);
     dialog::top();
     echo '<div style="padding:4px 15px;">';
     echo '<table class="list">';
     echo '<tr><td class="list-side">程序版本:</td><td>' . zotop::config('zotop.version') . '</td></tr>';
     echo '<tr><td class="list-side">程序设计:</td><td>' . zotop::config('zotop.author') . '</td></tr>';
     echo '<tr><td class="list-side">程序开发:</td><td>' . zotop::config('zotop.authors') . '</td></tr>';
     echo '<tr><td class="list-side">官方网站:</td><td><a href="' . zotop::config('zotop.homepage') . '" target="_blank">' . zotop::config('zotop.homepage') . '</a></td></tr>';
     echo '<tr><td class="list-side">安装时间:</td><td>' . zotop::config('zotop.install') . '</td></tr>';
     echo '</table>';
     echo '</div>';
     dialog::bottom();
     dialog::footer();
 }
Example #15
0
 public function actionSelect($id = 0)
 {
     $category = zotop::model('content.category');
     $tree = $category->getTree(0, '<input type="radio" name="id" id="id_$id" value="$id" $checked/> <label for="id_$id"><span class="zotop-icon zotop-icon-$icon"></span><span class="title">$title</span></label>', $id);
     $page = new dialog();
     $page->set('title', zotop::t('选择栏目'));
     $page->set('id', $id);
     $page->set('tree', $tree);
     $page->display();
 }
Example #16
0
 public function actionEdit($id, $type = '')
 {
     $config = zotop::model('system.config');
     $config->id = $id;
     if (form::isPostBack()) {
         $post = form::post();
         $post['settings'] = json_encode($post['settings']);
         $update = $config->update($post, $id);
         if ($update) {
             $config->cache(true);
             msg::success('保存成功,重新加载中,请稍后……', zotop::url('system/config/index/' . $post['parentid']));
         }
         msg::error($update);
     }
     $field = $config->read();
     $field['settings'] = (array) json_decode($field['settings']);
     //重新选择
     if (!empty($type)) {
         $field['type'] = $type;
     } else {
         $type = $field['type'];
     }
     $page = new dialog();
     $page->set('title', '编辑');
     $page->set('body', array('style' => 'min-width:600px;'));
     $page->set('field', $field);
     $page->set('type', $type);
     $page->set('types', $config->getControlTypes());
     $page->set('attrs', $config->getControlAttrs($type, $field));
     $page->display();
 }
Example #17
0
 public function actionEdit($id)
 {
     $file = zotop::model('system.file');
     if (form::isPostBack()) {
         $post = form::post();
         $file->update($post, $id);
         if (!$file->error()) {
             msg::success('编辑成功');
         }
         msg::error($file->msg());
     }
     $folder = zotop::model('system.folder');
     $image = $file->read(array('id', '=', $id));
     $folders = $folder->getAll();
     $tree = new tree($folders, 0);
     $categorys = $tree->getOptionsArray();
     $page = new dialog();
     $page->set('title', '图片编辑');
     $page->set('image', $image);
     $page->set('categorys', $categorys);
     $page->display();
 }
Example #18
0
 public function actionEdit($tablename, $fieldname)
 {
     if (form::isPostBack()) {
         $field = array();
         $field['name'] = request::post('name');
         $field['length'] = request::post('len');
         $field['type'] = request::post('type');
         $field['collation'] = request::post('collation');
         $field['null'] = request::post('null');
         $field['default'] = request::post('default');
         $field['attribute'] = request::post('attribute');
         $field['extra'] = request::post('extra');
         $field['comment'] = request::post('comment');
         $field['position'] = request::post('position');
         $fieldname = request::post('fieldname');
         if ($fieldname != $field['name']) {
             $result = zotop::db()->table($tablename)->field($fieldname)->rename($field['name']);
         }
         $result = zotop::db()->table($tablename)->modify($field);
         if ($result) {
             msg::success('字段修改成功', zotop::url('database/field/index', array('tablename' => $tablename)));
         }
     }
     $tables = zotop::db()->tables(true);
     $table = $tables[$tablename];
     $fields = array();
     if (isset($table)) {
         $fields = zotop::db()->table($tablename)->fields(true);
     }
     $field = $fields[$fieldname];
     if (!isset($field)) {
         msg::error('字段不存在,请勿修改浏览器参数');
     }
     $positions = array();
     $positions[-1] = '位于表头';
     if ($fields) {
         foreach ($fields as $key => $val) {
             $positions[$key] = '位于 ' . $key . ' 之后';
         }
     }
     $positions[0] = ' ';
     $page = new dialog();
     $page->title = '编辑字段';
     $page->set('database', $database);
     $page->set('tables', $tables);
     $page->set('field', $field);
     $page->set('positions', $positions);
     $page->display();
 }
Example #19
0
 public function aboutAction()
 {
     $page = new dialog();
     $page->title = 'About';
     $page->display();
 }
Example #20
0
 public function actionNewfile($dir = '')
 {
     $dir = empty($dir) ? zotop::get('dir') : $dir;
     $dir = trim(url::decode($dir), '/');
     $file = 'newfile.php';
     if (form::isPostBack()) {
         $file = zotop::post('name');
         $title = zotop::post('title');
         $description = zotop::post('description');
         $filepath = site::template($dir . DS . $file);
         $filecontent = "<?php\r\n/**\r\n * title:{$title}\r\n * description:{$description}\r\n*/\r\n?>";
         if (file::exists($filepath)) {
             msg::error(zotop::t('新建失败,当前目录已经存在文件:{$file}', array('file' => $file)));
         }
         if (file::write($filepath, $filecontent)) {
             msg::success('新建文件成功');
         }
         msg::error('新建文件失败');
     }
     $page = new dialog();
     $page->title = zotop::t('模板编辑器');
     $page->set('dir', $dir);
     $page->set('file', $file);
     $page->display();
 }