This commit is contained in:
daitingting
2018-07-10 15:00:46 +08:00
8 changed files with 73 additions and 4 deletions
+2 -1
View File
@@ -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();
+39
View File
@@ -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);
}
}
}
+3
View File
@@ -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';
+3
View File
@@ -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 = '移除';
+1
View File
@@ -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;
+22 -1
View File
@@ -99,7 +99,28 @@ config.confirmRemoveBlock = '<?php echo $lang->block->confirmRemoveBlock; ?>';
var module = '<?php echo $module?>';
var useGuest = <?php echo $useGuest ? 'true' : 'false';?>;
<?php if(!$useGuest):?>
$('#subHeader #pageActions .btn-toolbar:last').append(<?php echo json_encode(html::a($this->createLink("block", "admin", "id=0&module=$module"), "<i class='icon icon-plus text-muted'></i> {$lang->block->createBlock}", '', "class='btn' data-toggle='modal' data-type='ajax' data-width='700' data-title='{$lang->block->createBlock}'"))?>);
<?php
$dropmenu = "<div class='btn-group'>";
$dropmenu .= html::a($this->createLink("block", "admin", "id=0&module=$module"), "<i class='icon icon-plus text-muted'></i> {$lang->block->createBlock}", '', "class='btn' data-toggle='modal' data-type='ajax' data-width='700' data-title='{$lang->block->createBlock}'");
$dropmenu .= "<button type='button' class='btn dropdown-toggle' data-toggle='dropdown' style='padding-bottom:7px;'><span class='caret'></span></button>";
$dropmenu .= "<ul class='dropdown-menu pull-right' role='menu'>";
$dropmenu .= "<li>" . html::a($this->createLink("block", "ajaxReset", "module=$module"), $lang->block->reset, 'hiddenwin') . "</li>";
$dropmenu .= '</ul></div>';
?>
$('#subHeader #pageActions .btn-toolbar:last').append(<?php echo json_encode($dropmenu)?>);
<?php if(!isset($config->$module->block->initVersion) or $config->$module->block->initVersion < '2'):?>
$(function()
{
if(confirm('<?php echo $lang->block->noticeNewBlock;?>'))
{
$('#hiddenwin').attr('src', '<?php echo $this->createLink('block', 'ajaxUseNew', "module=$module&confirm=yes");?>');
}
else
{
$('#hiddenwin').attr('src', '<?php echo $this->createLink('block', 'ajaxUseNew', "module=$module&confirm=no");?>');
}
})
<?php endif;?>
<?php endif;?>
</script>
<?php if($extView = $this->getExtViewFile(__FILE__)){include $extView; return helper::cd();}?>
+2 -1
View File
@@ -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 '&nbsp; ';
echo html::a("javascript:loadProjectBuilds($projectID)", $this->lang->refresh);
}
+1 -1
View File
@@ -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);});
}
/**