diff --git a/module/block/config.php b/module/block/config.php index 126e1dcf01..efc0372658 100644 --- a/module/block/config.php +++ b/module/block/config.php @@ -10,7 +10,8 @@ * @link http://www.ranzhico.com */ $config->block = new stdclass(); -$config->block->editor = new stdclass(); +$config->block->version = 2; +$config->block->editor = new stdclass(); $config->block->editor->set = array('id' => 'html', 'tools' => 'simple'); $config->block->longBlock = array(); diff --git a/module/block/control.php b/module/block/control.php index feeb859c1e..9671aba027 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -1314,4 +1314,43 @@ class block extends control $this->loadModel('setting')->setItem('system.block.closed', $closedBlock . ",{$block->source}|{$block->block}"); die(js::reload('parent')); } + + /** + * Ajax reset. + * + * @param string $module + * @param string $confirm + * @access public + * @return void + */ + public function ajaxReset($module, $confirm = 'no') + { + if($confirm != 'yes') die(js::confirm($this->lang->block->confirmReset, inlink('ajaxReset', "module=$module&confirm=yes"))); + + $this->dao->delete()->from(TABLE_BLOCK)->where('module')->eq($module)->andWhere('account')->eq($this->app->user->account)->exec(); + $this->dao->delete()->from(TABLE_CONFIG)->where('module')->eq($module)->andWhere('owner')->eq($this->app->user->account)->andWhere('`key`')->eq('blockInited')->exec(); + die(js::reload('parent')); + } + + /** + * Ajax for use new block. + * + * @param string $module + * @param string $confirm + * @access public + * @return void + */ + public function ajaxUseNew($module, $confirm = 'no') + { + if($confirm == 'yes') + { + $this->dao->delete()->from(TABLE_BLOCK)->where('module')->eq($module)->andWhere('account')->eq($this->app->user->account)->exec(); + $this->dao->delete()->from(TABLE_CONFIG)->where('module')->eq($module)->andWhere('owner')->eq($this->app->user->account)->andWhere('`key`')->eq('blockInited')->exec(); + die(js::reload('parent')); + } + elseif($confirm == 'no') + { + $this->loadModel('setting')->setItem("{$this->app->user->account}.$module.block.initVersion", $this->config->block->version); + } + } } diff --git a/module/block/lang/en.php b/module/block/lang/en.php index 3762257c0e..8d4c5d627e 100644 --- a/module/block/lang/en.php +++ b/module/block/lang/en.php @@ -15,6 +15,7 @@ $lang->block->name = 'Name'; $lang->block->style = 'Style'; $lang->block->grid = 'Grid'; $lang->block->color = 'Color'; +$lang->block->reset = 'Restore the default'; $lang->block->account = 'Account'; $lang->block->module = 'Module'; @@ -52,6 +53,8 @@ $lang->block->createBlock = 'Add Block'; $lang->block->editBlock = 'Edit'; $lang->block->ordersSaved = 'Order is saved.'; $lang->block->confirmRemoveBlock = 'Do you want to remove Block?'; +$lang->block->noticeNewBlock = 'ZenTao 10.+ has a new layout for each view. Do you want to start the new view?'; +$lang->block->confirmReset = 'Whether to restore the default'; $lang->block->closeForever = 'Permanent Close'; $lang->block->confirmClose = 'Do you want to permanently close this block? Once done, it is not available to anyone. It can be activiated at Admin->Custom.'; $lang->block->remove = 'Remove'; diff --git a/module/block/lang/zh-cn.php b/module/block/lang/zh-cn.php index da14df07cb..f4b6a6bf48 100644 --- a/module/block/lang/zh-cn.php +++ b/module/block/lang/zh-cn.php @@ -15,6 +15,7 @@ $lang->block->name = '区块名称'; $lang->block->style = '外观'; $lang->block->grid = '位置'; $lang->block->color = '颜色'; +$lang->block->reset = '恢复默认'; $lang->block->account = '所属用户'; $lang->block->module = '所属模块'; @@ -52,6 +53,8 @@ $lang->block->createBlock = '添加区块'; $lang->block->editBlock = '编辑区块'; $lang->block->ordersSaved = '排序已保存'; $lang->block->confirmRemoveBlock = '确定移除区块吗?'; +$lang->block->noticeNewBlock = '10.0版本以后各个视图主页提供了全新的视图,您要启用新的视图布局吗?'; +$lang->block->confirmReset = '是否恢复默认布局'; $lang->block->closeForever = '永久关闭'; $lang->block->confirmClose = '确定永久关闭该区块吗?关闭后所有人都将无法使用该区块,可以在后台自定义中打开。'; $lang->block->remove = '移除'; diff --git a/module/block/model.php b/module/block/model.php index 023e79a908..82f3f233eb 100644 --- a/module/block/model.php +++ b/module/block/model.php @@ -203,6 +203,7 @@ class blockModel extends model /* Mark this app has init. */ $this->loadModel('setting')->setItem("$account.$module.common.blockInited", true); + $this->loadModel('setting')->setItem("$account.$module.block.initVersion", $this->config->block->version); foreach($blocks as $index => $block) { $block['order'] = $index; diff --git a/module/block/view/dashboard.html.php b/module/block/view/dashboard.html.php index aeaef75b0b..7ee2c87a90 100644 --- a/module/block/view/dashboard.html.php +++ b/module/block/view/dashboard.html.php @@ -99,7 +99,28 @@ config.confirmRemoveBlock = 'block->confirmRemoveBlock; ?>'; var module = ''; var useGuest = ; -$('#subHeader #pageActions .btn-toolbar:last').append(createLink("block", "admin", "id=0&module=$module"), " {$lang->block->createBlock}", '', "class='btn' data-toggle='modal' data-type='ajax' data-width='700' data-title='{$lang->block->createBlock}'"))?>); +"; +$dropmenu .= html::a($this->createLink("block", "admin", "id=0&module=$module"), " {$lang->block->createBlock}", '', "class='btn' data-toggle='modal' data-type='ajax' data-width='700' data-title='{$lang->block->createBlock}'"); +$dropmenu .= ""; +$dropmenu .= "
'; +?> +$('#subHeader #pageActions .btn-toolbar:last').append(); +$module->block->initVersion) or $config->$module->block->initVersion < '2'):?> +$(function() +{ + if(confirm('block->noticeNewBlock;?>')) + { + $('#hiddenwin').attr('src', 'createLink('block', 'ajaxUseNew', "module=$module&confirm=yes");?>'); + } + else + { + $('#hiddenwin').attr('src', 'createLink('block', 'ajaxUseNew', "module=$module&confirm=no");?>'); + } +}) + getExtViewFile(__FILE__)){include $extView; return helper::cd();}?> diff --git a/module/build/control.php b/module/build/control.php index 46a3ea95eb..0f8b3730ff 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -25,6 +25,7 @@ class build extends control $buildID = $this->build->create($projectID); if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); $this->loadModel('action')->create('build', $buildID, 'opened'); + if(isonlybody()) die(js::closeModal('parent.parent', '', "function(){parent.parent.loadProjectBuilds($projectID);}")); $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('build', 'view', "buildID=$buildID"))); } @@ -357,7 +358,7 @@ class build extends control { if(empty($builds)) { - echo html::a($this->createLink('build', 'create', "projectID=$projectID"), $this->lang->build->create, '_blank'); + echo html::a($this->createLink('build', 'create', "projectID=$projectID", '', $onlybody = true), $this->lang->build->create, '', "data-toggle='modal' data-type='iframe'"); echo ' '; echo html::a("javascript:loadProjectBuilds($projectID)", $this->lang->refresh); } diff --git a/module/testtask/js/create.js b/module/testtask/js/create.js index 2d2f0f5c45..2a37a05d85 100755 --- a/module/testtask/js/create.js +++ b/module/testtask/js/create.js @@ -22,7 +22,7 @@ function loadProjectBuilds(projectID) selectedBuild = $('#build').val(); if(!selectedBuild) selectedBuild = 0; link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + $('#product').val() + '&varName=testTaskBuild&build=' + selectedBuild); - $('#buildBox').load(link, function(){$('#build').chosen(defaultChosenOptions);}); + $('#buildBox').load(link, function(){$('#build').chosen(window.defaultChosenOptions);}); } /**