Example #1
0
 public function onDefault()
 {
     if (form::isPostBack()) {
         msg::error('开发中', '数据保存开发中,请稍后……');
     }
     $header['title'] = '系统设置';
     page::header($header);
     page::top();
     page::navbar($this->navbar(), 'main');
     form::header();
     block::header('网站基本信息');
     form::field(array('type' => 'text', 'label' => zotop::t('网站名称'), 'name' => 'zotop.site.title', 'value' => zotop::config('zotop.site.title'), 'description' => zotop::t('网站名称,将显示在标题和导航中')));
     form::field(array('type' => 'text', 'label' => zotop::t('网站域名'), 'name' => 'zotop.site.domain', 'value' => zotop::config('zotop.site.domain'), 'description' => zotop::t('网站域名地址,不包含http://,如:www.zotop.com')));
     form::field(array('type' => 'text', 'label' => zotop::t('备案信息'), 'name' => 'zotop.site.icp', 'value' => zotop::config('zotop.site.icp'), 'description' => zotop::t('页面底部可以显示 ICP 备案信息,如果网站已备案,在此输入您的授权码,它将显示在页面底部,如果没有请留空')));
     form::field(array('type' => 'select', 'options' => array('0' => '不显示', '1' => '显示'), 'label' => zotop::t('授权信息'), 'name' => 'zotop.site.license', 'value' => zotop::config('zotop.site.license'), 'description' => zotop::t('页脚部位显示程序官方网站链接')));
     form::field(array('type' => 'textarea', 'label' => zotop::t('网站简介'), 'name' => 'zotop.site.about', 'value' => zotop::config('zotop.site.about')));
     block::footer();
     block::header('联系信息设置');
     form::field(array('type' => 'text', 'label' => zotop::t('公司名称'), 'name' => 'zotop.site.title', 'value' => '', 'description' => zotop::t('网站隶属的公司或者组织名称')));
     form::field(array('type' => 'textarea', 'label' => zotop::t('网站简介'), 'name' => 'zotop.site.about', 'value' => ''));
     block::footer();
     form::buttons(array('type' => 'submit'), array('type' => 'back'));
     form::footer();
     page::bottom();
     page::footer();
 }
Example #2
0
 public function actionEdit($id)
 {
     $blog = zotop::model('blog.blog');
     $status = $blog->status();
     $category = zotop::model('blog.category');
     $categorys = $category->getAll();
     if (form::isPostBack()) {
         $post = form::post();
         $blog->edit($post, $id);
         if (!$blog->error()) {
             msg::success('保存成功', form::referer());
         }
         msg::error($blog->msg());
     }
     //读取数据
     $data = $blog->read($id);
     $categoryid = $data['categoryid'];
     //渲染页面
     $page = new page();
     $page->set('title', '编辑日志');
     $page->set('navbar', $this->navbar($categoryid));
     $page->set('globalid', $blog->globalid());
     $page->set('data', $data);
     $page->set('status', $status);
     $page->set('categoryid', $categoryid);
     $page->set('categorys', $categorys);
     $page->display();
 }
Example #3
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 #4
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();
 }
Example #5
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 #6
0
 public function onDefault()
 {
     if (form::isPostBack()) {
         $post = array();
         $post['username'] = request::post('username');
         $post['password'] = request::post('password');
         $post['logintime'] = time();
         $user = zotop::model('zotop.user');
         $data = $user->read($post['username'], 'username');
         //zotop::dump($data);
         if ($data == false) {
             msg::error('登陆失败', zotop::t('账户名称`{$username}`不存在,请检查!', array('username' => $post['username'])));
         }
         zotop::user($data);
         msg::success('登陆成功', '登陆成功,系统正在加载中', 'reload', 2);
     }
     if (zotop::user() != null) {
         zotop::redirect('zotop/index');
     }
     $header['title'] = '用户登录';
     $header['js'] = url::module() . '/admin/js/login.js';
     $header['body']['class'] = "login";
     page::header($header);
     block::header(array('id' => 'LoginWindow', 'title' => '用户登录'));
     form::header(array('title' => '', 'description' => '请输入用户名和密码', 'class' => 'small'));
     form::field(array('type' => 'text', 'label' => zotop::t('帐 户(U)'), 'name' => 'username', 'value' => zotop::user('username'), 'valid' => 'required:true'));
     form::field(array('type' => 'password', 'label' => zotop::t('密 码(P)'), 'name' => 'password', 'value' => ''));
     form::buttons(array('type' => 'submit', 'value' => '登 陆'), array('type' => 'button', 'name' => 'options', 'value' => '选 项'));
     form::footer();
     block::footer();
     page::footer();
 }
Example #7
0
 public function sqlAction()
 {
     if (form::isPostBack()) {
         msg::error('该功能已经被禁用,请进入设置开启');
     }
     $page = new dialog();
     $page->title = '数据库管理:' . $database['database'] . ' @ ' . $database['hostname'] . '<i>></i> 执行sql语句';
     $page->display();
 }
Example #8
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 #9
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 #10
0
 public function actionBakup()
 {
     $db = zotop::model('database.database');
     if (form::isPostBack()) {
         msg::error('功能开发中……');
     }
     $database = $db->db()->config();
     $tables = $db->tables();
     $page = new page();
     $page->title = '数据库备份';
     $page->set('position', $database['database'] . ' @ ' . $database['hostname']);
     $page->set('navbar', $this->navbar());
     $page->set('database', $database);
     $page->set('tables', $tables);
     $page->display();
 }
Example #11
0
 public function indexAction()
 {
     $user = zotop::model('zotop.user');
     if (form::isPostBack()) {
         $post = array();
         $post['username'] = request::post('username');
         $post['password'] = request::post('password');
         $post['logintime'] = time();
         zotop::cookie('admin.username', $post['username'], 3600);
         if (empty($post['username'])) {
             msg::error(zotop::t('登陆失败,请输入登陆账户名称'));
         }
         if (empty($post['password'])) {
             msg::error(zotop::t('登陆失败,请输入登陆账户密码'));
         }
         if (!$user->isValidUserName($post['username'])) {
             msg::error(zotop::t('登陆失败,请输入有效的账户名称'));
         }
         if (!$user->isValidPassword($post['password'])) {
             msg::error(zotop::t('登陆失败,请输入有效的账户密码'));
         }
         //读取用户
         $data = $user->read(array('username', '=', $post['username']));
         //验证
         if ($data == false) {
             msg::error(zotop::t('账户名称`{$username}`不存在,请检查是否输入有误!', array('username' => $post['username'])));
         }
         if ($user->password($post['password']) != $data['password']) {
             msg::error(zotop::t('账户密码`{$password}`错误,请检查是否输入有误!', array('password' => $post['password'])));
         }
         //用户登入
         $user->login();
         //跳转
         msg::success('登陆成功,系统正在加载中', url::current(), 2);
     }
     if (!empty($this->user)) {
         $this->redirect('zotop/index');
     }
     $data = $user->read(array('username', '=', 'admin'));
     $page = new page();
     $page->title = '系统登陆';
     $page->body = array('class' => 'login');
     $page->addScript('$this/js/login.js');
     $page->display();
 }
Example #12
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 #13
0
 public function actionTheme()
 {
     $config = zotop::model('system.config');
     if (form::isPostBack()) {
         $post = form::post();
         $config->save($post);
         if ($config->error()) {
             msg::error($config->msg());
         }
         msg::success('保存成功');
     }
     $theme = $config->fields('system.theme');
     $page = new page();
     $page->set('title', zotop::t('系统设置'));
     $page->set('navbar', $this->navbar());
     $page->set('theme', $theme);
     $page->display();
 }
Example #14
0
 public function actionUpload()
 {
     $config = zotop::model('zotop.config');
     if (form::isPostBack()) {
         $post = form::post();
         $save = $config->save($post);
         if ($save) {
             msg::success('保存成功,重新加载中,请稍后……');
         }
         msg::error($save);
     }
     $fields = $config->fields('upload');
     $page = new page();
     $page->set('title', '上传设置');
     $page->set('navbar', $this->navbar());
     $page->set('fields', $fields);
     $page->display();
 }
Example #15
0
 public function addAction()
 {
     $user = zotop::model('zotop.user');
     $usergroup = zotop::model('zotop.usergroup');
     if (form::isPostBack()) {
         $post = form::post();
         if (empty($post['id'])) {
             $post['id'] = $user->max('id') + 1;
         }
         if (empty($post['username'])) {
             msg::error('帐户名称不能为空');
         }
         if (empty($post['password'])) {
             msg::error('帐户密码不能为空');
         }
         if ($post['password'] != $_POST['_password']) {
             msg::error('两次输入的密码不一致');
         }
         if ($user->isExist('username', $post['username'])) {
             msg::error('帐户名称<b>' . $post['username'] . '</b>已经存在');
         }
         if ($user->isExist('email', $post['email'])) {
             msg::error('电子邮件<b>' . $post['email'] . '</b>已经存在');
         }
         $post['password'] = $user->password($post['password']);
         $post['loginnum'] = $post['loginnum'] || 0;
         $post['createtime'] = $post['createtime'] || TIME;
         $post['modelid'] = 'system';
         $insert = $user->insert($post);
         if ($insert) {
             msg::success('保存成功,正在返回列表页面,请稍后……', zotop::url('zotop/user'));
         }
     }
     //获取用户组
     $usergroups = $usergroup->getIndex('system');
     $page = new page();
     $page->set('title', '添加新用户');
     $page->set('position', $position);
     $page->set('navbar', $this->navbar());
     $page->set('data', $data);
     $page->set('usergroups', $usergroups);
     $page->display();
 }
Example #16
0
 public function changeInfoAction()
 {
     $user = zotop::model('zotop.user');
     $user->id = (int) zotop::user('id');
     if (form::isPostBack()) {
         $post = form::post();
         $update = $user->update($post, $user->id);
         if ($update) {
             msg::success('资料设置成功,正在刷新页面,请稍后……', url::current());
         }
         msg::error();
     }
     $data = $user->read();
     $page = new page();
     $page->title = '修改我的基本信息';
     $page->set('navbar', $this->navbar());
     $page->set('data', $data);
     $page->display();
 }
Example #17
0
 public function installAction($id)
 {
     $module = zotop::model('zotop.module');
     $modules = $module->getUnInstalled();
     if (empty($id) || !isset($modules[$id])) {
         msg::error(zotop::t('模块<b>{$id}</b>不存在或者已经安装', array('id' => $id)));
     }
     if (form::isPostBack()) {
         $install = $module->install($modules[$id]);
         if ($install) {
             $module->cache();
             msg::success(zotop::t('模块 <b>{$name}</b> 安装成功', $modules[$id]), zotop::url('zotop/module'));
         }
     }
     $page = new dialog();
     $page->set('title', '安装模块');
     $page->set('module', $modules[$id]);
     $page->display();
 }
Example #18
0
 public function onEdit($file)
 {
     if (form::isPostBack()) {
         $content = request::post('source');
         msg::success('保存测试', '测试,继续编辑或者返回' . zotop::dump($content, true), 'reload');
     }
     $source = file::read(ROOT . $file);
     $page['title'] = '文件编辑器';
     page::header($page);
     page::top();
     page::navbar($this->navbar());
     form::header(array('class' => 'sourceEditor'));
     form::field(array('type' => 'label', 'label' => zotop::t('文件名称'), 'name' => 'filename', 'value' => $file, 'valid' => '', 'description' => zotop::t('')));
     form::field(array('type' => 'source', 'label' => zotop::t('文件内容'), 'name' => 'source', 'value' => $source, 'valid' => 'required:true', 'description' => zotop::t('')));
     form::buttons(array('type' => 'submit', 'value' => '保存文件'), array('type' => 'back'));
     form::footer();
     page::bottom();
     page::footer();
 }
Example #19
0
 public function actionEdit($id)
 {
     $model = zotop::model('content.model');
     if (form::isPostBack()) {
         $post = form::post();
         $model->edit($post, $id);
         if (!$model->error()) {
             msg::success('保存成功', zotop::url('content/model/index/'));
         }
         msg::error($model->msg());
     }
     $data = $model->read($id);
     $data['settings'] = $model->settings();
     $page = new page();
     $page->set('title', zotop::t('模型管理'));
     $page->set('position', array(zotop::url('content') => zotop::t('内容管理'), zotop::url('content/model') => zotop::t('模型管理'), zotop::t('编辑模型')));
     $page->set('navbar', $this->navbar());
     $page->set('data', $data);
     $page->display();
 }
Example #20
0
 public function actionInfo()
 {
     $user = zotop::model('system.user');
     $user->id = (int) zotop::user('id');
     if (form::isPostBack()) {
         $post = form::post();
         $update = $user->update($post, $user->id);
         if ($update) {
             msg::success('资料设置成功,正在刷新页面,请稍后……', url::location());
         }
         msg::error();
     }
     $data = $user->read();
     $page = new page();
     $page->title = zotop::t('个人中心');
     $page->set('navbar', $this->navbar());
     $page->set('globalid', $user->globalid());
     $page->set('data', $data);
     $page->display();
 }
Example #21
0
 public function actionIndex()
 {
     $user = zotop::model('system.user');
     if (form::isPostBack()) {
         $post = form::post();
         $user->login($post);
         if (!$user->error()) {
             msg::success(zotop::t('登陆成功,系统正在加载中'), zotop::url(), 2);
         }
         msg::error($user->msg());
     }
     if (!empty($this->user)) {
         header("Location: " . zotop::url());
         exit;
     }
     $page = new page();
     $page->set('title', zotop::t('系统管理登陆'));
     $page->set('body', array('class' => 'login'));
     $page->display();
 }
Example #22
0
 public function actionInstall($path)
 {
     $module = zotop::model('zotop.module');
     if (form::isPostBack()) {
         $install = $module->install($path);
         if ($install) {
             $module->cache(true);
             msg::success(zotop::t('模块安装成功'), zotop::url('zotop/module'));
         }
     }
     $moduleFile = $path . DS . 'module.php';
     if (!file::exists($moduleFile)) {
         msg::error(array('content' => zotop::t('未找到模块标记文件<b>module.php</b>,请检查?')));
     }
     $m = @(include path::decode($moduleFile));
     $id = $m['id'];
     $modules = $module->getUnInstalled();
     $page = new dialog();
     $page->set('title', '安装模块');
     $page->set('module', $modules[$id]);
     $page->display();
 }
Example #23
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 #24
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 #25
0
 public function actionInstall($id = '')
 {
     $id = empty($id) ? zotop::post('id') : $id;
     $module = zotop::model('system.module');
     $modules = $module->getUnInstalled();
     if (!isset($modules[$id])) {
         msg::error(array('title' => zotop::t('安装失败'), 'content' => zotop::t('未找到模块<b>{$id}</b>,请检查', array('id' => $id))));
     }
     if (form::isPostBack()) {
         $install = $module->install($modules[$id]['path']);
         if ($install) {
             $module->cache(true);
             msg::success(zotop::t('模块安装成功'), zotop::url('system/module'));
         }
     }
     $moduleFile = $modules[$id]['path'] . DS . 'module.php';
     if (!file::exists($moduleFile)) {
         msg::error(array('title' => zotop::t('安装失败'), 'content' => zotop::t('未找到模块标记文件<b>module.php</b>,请检查')));
     }
     $page = new dialog();
     $page->set('title', '安装模块');
     $page->set('module', $modules[$id]);
     $page->display();
 }
Example #26
0
 public function editAction($id)
 {
     $usergroup = zotop::model('zotop.usergroup');
     if (form::isPostBack()) {
         $post = form::post();
         if (empty($post['title'])) {
             msg::error('用户组名称不能为空');
         }
         $post['type'] = empty($post['type']) ? 'system' : $post['type'];
         $post['order'] = $post['order'] || 0;
         $update = $usergroup->update($post, $id);
         if ($update) {
             $usergroup->cache();
             msg::success('保存成功,正在返回列表页面,请稍后……', zotop::url('zotop/usergroup'));
         }
     }
     $data = $usergroup->read($id);
     $page = new page();
     $page->set('title', '添加新用户');
     $page->set('position', $position);
     $page->set('navbar', $this->navbar());
     $page->set('data', $data);
     $page->display();
 }
Example #27
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 #28
0
 public function actionMove($id)
 {
     $category = zotop::model('content.category');
     $categories = $category->cache();
     if (form::isPostBack()) {
         $post = form::post();
         $category->move($id, $post['id']);
         if (!$category->error()) {
             msg::success('移动成功', zotop::url('content/category/index/' . $categories[$id]['parentid']));
         }
         msg::error($category->msg());
     }
     $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>', $categories[$id]['parentid']);
     $page = new dialog();
     $page->set('title', zotop::t('移动栏目'));
     $page->set('id', $id);
     $page->set('parentid', $categories[$id]['parentid']);
     $page->set('categories', $categories);
     $page->set('tree', $tree);
     $page->display();
 }
Example #29
0
 public function onAdd()
 {
     if (form::isPostBack()) {
         $module = zotop::model('zotop.module');
         $post = form::post();
         $result = $module->insert($post);
         if ($result) {
             msg::success('保存成功', '添加成功,正在刷新页面,请稍后……', zotop::url('zotop/module'));
         }
     }
     $page['title'] = '新建模块';
     page::header($page);
     page::top();
     page::navbar($this->navbar());
     form::header();
     block::header('基本信息');
     form::field(array('type' => 'text', 'label' => '模块ID', 'name' => 'id', 'value' => $data['id'], 'valid' => 'required:true,minlength:3,maxlength:32,remote:"' . zotop::url('zotop/module/checkid') . '"', 'description' => '允许使用数字、英文字符(不区分大小写)或者下划线,不允许使用其它特殊字符,3~32位'));
     form::field(array('type' => 'text', 'label' => '模块名称', 'name' => 'name', 'value' => $data['name'], 'valid' => 'required:true', 'description' => ''));
     form::field(array('type' => 'radio', 'options' => array('system' => '核心模块', 'plugin' => '插件模块'), 'label' => '模块类型', 'name' => 'type', 'value' => $data['type'], 'valid' => 'required:true', 'description' => ''));
     form::field(array('type' => 'text', 'label' => '访问地址', 'name' => 'url', 'value' => $data['url'], 'valid' => 'url:true', 'description' => '可以为模块绑定访问域名,如:http://bbs.***.com/ 如果不绑定域名,请留空'));
     form::field(array('type' => 'textarea', 'label' => '模块说明', 'name' => 'description', 'value' => $data['description'], 'valid' => '', 'description' => ''));
     block::footer();
     block::header('开发者信息');
     form::field(array('type' => 'text', 'label' => '开发者', 'name' => 'author', 'value' => $data['author'], 'valid' => 'required:true', 'description' => ''));
     form::field(array('type' => 'text', 'label' => '电子邮件', 'name' => 'email', 'value' => $data['email'], 'valid' => 'required:true,email:true', 'description' => ''));
     form::field(array('type' => 'text', 'label' => '官方网站', 'name' => 'site', 'value' => $data['site'], 'valid' => 'required:true', 'description' => ''));
     block::footer();
     form::buttons(array('type' => 'submit'), array('type' => 'back'));
     form::footer();
     page::bottom();
     page::footer();
 }
Example #30
0
 public function onEdit($tablename)
 {
     if (form::isPostBack()) {
         $tablename = request::post('tablename');
         $name = request::post('name');
         $comment = request::post('comment');
         $primary = request::post('primary');
         if (strtolower($tablename) !== strtolower($name)) {
             $rename = zotop::db()->table($tablename)->rename($name);
         }
         if ($comment !== NULL) {
             $comment = zotop::db()->table($name)->comment($comment);
         }
         if ($primary) {
             $primary = zotop::db()->table($name)->primary($primary);
         }
         msg::success('操作成功', '<h2>数据表设置成功</h2>正在刷新页面,请稍后……', form::referer());
     }
     $tables = zotop::db()->tables(true);
     $table = $tables[$tablename];
     if (!isset($table)) {
         msg::error('参数错误', zotop::t('数据表{$tablename}不存在', array('tablename' => $tablename)));
     }
     $header['title'] = '数据库管理 <i>></i> 数据表设置:' . $tablename . ' ';
     page::header($header);
     page::top();
     page::navbar($this->navbar(), 'edit');
     form::header();
     form::field(array('type' => 'hidden', 'name' => 'tablename', 'label' => '数据表名称', 'value' => $table['name'], 'valid' => '{required:true}'));
     form::field(array('type' => 'text', 'name' => 'name', 'label' => '数据表名称', 'value' => $table['name'], 'valid' => '{required:true}'));
     form::field(array('type' => 'text', 'name' => 'comment', 'label' => '数据表注释', 'value' => $table['comment'], 'valid' => ''));
     form::buttons(array('type' => 'submit'), array('type' => 'button', 'value' => '返回前页', 'class' => 'back', 'onclick' => 'history.go(-1);'));
     form::footer();
     page::bottom();
     page::footer();
 }