Merge branch 'master' of git@github.com:easysoft/zentaopms

This commit is contained in:
azhi
2013-08-01 16:53:10 +08:00
15 changed files with 74 additions and 190 deletions
+23 -1
View File
@@ -171,9 +171,11 @@ function loadProjectStories(projectID)
*/
function loadProductPlans(productID)
{
link = createLink('productplan', 'ajaxGetPlans', 'productID=' + $('#product').val() + '&planID=' + planID);
if(typeof(planID) == 'undefined') planID = 0;
link = createLink('product', 'ajaxGetPlans', 'productID=' + $('#product').val() + '&planID=' + planID);
$('#planIdBox').load(link, function(){$('#story').chosen({no_results_text:noResultsMatch});});
}
/**
* Load builds of a project.
*
@@ -200,3 +202,23 @@ function loadProjectBuilds(projectID)
$('#resolvedBuildBox').load(link);
}
}
/**
* Set story field.
*
* @param moduleID $moduleID
* @param productID $productID
* @access public
* @return void
*/
function setStories(moduleID, productID)
{
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&moduleID=' + moduleID);
$.get(link, function(stories)
{
if(!stories) stories = '<select id="story" name="story"></select>';
$('#story').replaceWith(stories);
$('#story_chzn').remove();
$("#story").chosen({no_results_text: ''});
});
}
-20
View File
@@ -40,26 +40,6 @@ function setAssignedTo(moduleID, productID)
});
}
/**
* Set story field.
*
* @param moduleID $moduleID
* @param productID $productID
* @access public
* @return void
*/
function setStories(moduleID, productID)
{
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&moduleID=' + moduleID);
$.get(link, function(stories)
{
if(!stories) stories = '<select id="story" name="story"></select>';
$('#story').replaceWith(stories);
$('#story_chzn').remove();
$("#story").chosen({no_results_text: ''});
});
}
/* Save template. */
KindEditor.plugin('savetemplate', function(K)
{
+13
View File
@@ -41,3 +41,16 @@ function getList(module)
$('#taskListIdBox a').attr("href", link);
}
}
/**
* load stories of module.
*
* @access public
* @return void
*/
function loadModuleRelated()
{
moduleID = $('#module').val();
productID = $('#product').val();
setStories(moduleID, productID);
}
+4
View File
@@ -25,6 +25,10 @@ js::set('mailto', $lang->bug->chosen->mailto);
<th class='rowhead'><?php echo $lang->bug->assignedTo;?></th>
<td><?php echo html::select('assignedTo', $users, $bug->assignedTo, "class='text-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->severity;?></th>
<td><?php echo html::select('severity', $lang->bug->severityList, $bug->severity, 'class=select-2');?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->bug->mailto;?></td>
<td><?php echo html::select('mailto[]', $users, str_replace(' ' , '', $bug->mailto), 'class="text-1" multiple');?></td>
+2
View File
@@ -475,12 +475,14 @@ $lang->resource->mail->detect = 'detect';
$lang->resource->mail->edit = 'edit';
$lang->resource->mail->save = 'save';
$lang->resource->mail->test = 'test';
$lang->resource->mail->reset = 'reset';
$lang->mail->methodOrder[5] = 'index';
$lang->mail->methodOrder[10] = 'detect';
$lang->mail->methodOrder[15] = 'edit';
$lang->mail->methodOrder[20] = 'save';
$lang->mail->methodOrder[25] = 'test';
$lang->mail->methodOrder[30] = 'reset';
/* Subversion. */
$lang->resource->svn = new stdclass();
+12
View File
@@ -158,4 +158,16 @@ class mail extends control
$this->view->users = $this->dao->select('account, CONCAT(realname, " ", email) AS email' )->from(TABLE_USER)->where('email')->ne('')->orderBy('account')->fetchPairs();
$this->display();
}
/**
* Reset the email config.
*
* @access public
* @return void
*/
public function reset()
{
$this->dao->delete('*')->from(TABLE_CONFIG)->where('module')->eq('mail')->exec();
$this->locate(inlink('detect'));
}
}
+1
View File
@@ -5,6 +5,7 @@ $lang->mail->detect = 'Detect';
$lang->mail->edit = 'Configure';
$lang->mail->save = 'Successfully saved';
$lang->mail->test = 'Testing';
$lang->mail->reset = 'Reset';
$lang->mail->turnon = 'Turnon';
$lang->mail->fromAddress = 'From email';
+1
View File
@@ -5,6 +5,7 @@ $lang->mail->detect = '检测';
$lang->mail->edit = '编辑配置';
$lang->mail->save = '成功保存';
$lang->mail->test = '测试发信';
$lang->mail->reset = '重置';
$lang->mail->turnon = '是否打开';
$lang->mail->fromAddress = '发信邮箱';
+13 -7
View File
@@ -244,22 +244,28 @@ class mailModel extends model
if(!$this->config->mail->turnon) return;
ob_start();
$toList = $toList ? explode(',', str_replace(' ', '', $toList)) : array();
$ccList = $ccList ? explode(',', str_replace(' ', '', $ccList)) : array();
/* Process toList and ccList, remove current user from them. If toList is empty, use the first cc as to. */
if($includeMe == false)
{
$account = isset($this->app->user->account) ? $this->app->user->account : '';
$toList = $toList ? explode(',', str_replace(' ', '', $toList)) : array();
$ccList = $ccList ? explode(',', str_replace(' ', '', $ccList)) : array();
foreach($toList as $key => $to) if(trim($to) == $account or !trim($to)) unset($toList[$key]);
foreach($ccList as $key => $cc) if(trim($cc) == $account or !trim($cc)) unset($ccList[$key]);
if(!$toList and !$ccList) return;
if(!$toList and $ccList) $toList = array(array_shift($ccList));
$toList = join(',', $toList);
$ccList = join(',', $ccList);
}
/* Remove deleted users. */
$users = $this->loadModel('user')->getPairs('nodeleted');
foreach($toList as $key => $to) if(!isset($users[trim($to)])) unset($toList[$key]);
foreach($ccList as $key => $cc) if(!isset($users[trim($cc)])) unset($ccList[$key]);
if(!$toList and !$ccList) return;
if(!$toList and $ccList) $toList = array(array_shift($ccList));
$toList = join(',', $toList);
$ccList = join(',', $ccList);
/* Get realname and email of users. */
$this->loadModel('user');
$emails = $this->user->getRealNameAndEmails(str_replace(' ', '', $toList . ',' . $ccList));
+1
View File
@@ -64,6 +64,7 @@ include '../../common/view/header.html.php';
<?php
echo html::submitButton();
if($this->config->mail->turnon and $mailExist) echo html::linkButton($lang->mail->test, inlink('test'));
echo html::linkButton($lang->mail->reset, inlink('reset'));
?>
</td>
</tr>
-14
View File
@@ -395,18 +395,4 @@ class productplan extends control
}
die(js::reload('parent'));
}
/**
* AJAX: get plans of a product in html select.
*
* @param int $productID
* @param int $planID
* @access public
* @return void
*/
public function ajaxGetPlans($productID, $planID = 0)
{
$plans = $this->productplan->getPairs($productID);
die(html::select('plan', $plans, $planID, 'class=select-3'));
}
}
-20
View File
@@ -20,23 +20,3 @@ $(function()
$("#story").chosen({no_results_text: noResultsMatch});
$("#preview").colorbox({width:960, height:550, iframe:true, transition:'none', scrolling:true});
})
/**
* Set story field.
*
* @access public
* @return void
*/
function setStories()
{
moduleID = $('#module').val();
productID = $('#product').val();
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&moduleID=' + moduleID);
$.get(link, function(stories)
{
if(!stories) stories = '<select id="story" name="story"></select>';
$('#story').replaceWith(stories);
$('#story_chzn').remove();
$("#story").chosen({no_results_text: ''});
});
}
+2 -2
View File
@@ -10,7 +10,7 @@
* @link http://www.zentao.net
*/
?>
<?php include './header.html.php';?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/form.html.php';?>
<?php include '../../common/view/chosen.html.php';?>
<form method='post' enctype='multipart/form-data' id='dataform' class='ajaxForm'>
@@ -22,7 +22,7 @@
<?php echo html::select('product', $products, $productID, "onchange=loadAll(this.value); class='select-3'");?>
<span id='moduleIdBox'>
<?php
echo html::select('module', $moduleOptionMenu, $currentModuleID, "onchange=setStories();");
echo html::select('module', $moduleOptionMenu, $currentModuleID, "onchange=loadModuleRelated();");
if(count($moduleOptionMenu) == 1)
{
echo html::a($this->createLink('tree', 'browse', "rootID=$productID&view=case"), $lang->tree->manage, '_blank');
+2 -2
View File
@@ -10,7 +10,7 @@
* @link http://www.zentao.net
*/
?>
<?php include './header.html.php';?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/chosen.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<form method='post' enctype='multipart/form-data' target='hiddenwin' id='dataform'>
@@ -82,7 +82,7 @@
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->module;?></td>
<td><span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $currentModuleID, "class='select-1'");?></span></td>
<td><span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $currentModuleID, "onchange='loadModuleRelated()' class='select-1'");?></span></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->story;?></td>
-124
View File
@@ -1,124 +0,0 @@
<?php include '../../common/view/header.html.php';?>
<style>
#story {width:90%}
.delbutton{font-size:12px; color:red; width:80px; padding:0}
.addbutton{font-size:12px; color:darkgreen; width:80px; padding:0}
</style>
<script language='Javascript'>
var newRowID = 0;
/**
* Load modules and stories of a product.
*
* @param int $productID
* @access public
* @return void
*/
function loadAll(productID)
{
loadProductModules(productID);
loadStory(productID);
}
/**
* Load module.
*
* @param int $productID
* @access public
* @return void
*/
function loadProductModules(productID)
{
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=case&rootModuleID=0&returnType=html&needManage=true');
$('#moduleIdBox').load(link);
}
/**
* Load stories.
*
* @param int $productID
* @access public
* @return void
*/
function loadStory(productID)
{
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID);
$('#storyIdBox').load(link, function(){$('#story').chosen({no_results_text: noResultsMatch});});
}
/**
* Delete a step row.
*
* @param int $rowID
* @access public
* @return void
*/
function deleteRow(rowID)
{
if($('.stepID').size() == 1) return;
$('#row' + rowID).remove();
updateStepID();
}
/**
* Insert before the step.
*
* @param int $rowID
* @access public
* @return void
*/
function preInsert(rowID)
{
$('#row' + rowID).before(createRow());
updateStepID();
}
/**
* Insert after the step.
*
* @param int $rowID
* @access public
* @return void
*/
function postInsert(rowID)
{
$('#row' + rowID).after(createRow());
updateStepID();
}
/**
* Create a step row.
*
* @access public
* @return void
*/
function createRow()
{
if(newRowID == 0) newRowID = $('.stepID').size();
newRowID ++;
var lblDelete = '<?php echo $lang->testcase->deleteStep;?>';
var lblBefore = '<?php echo $lang->testcase->insertBefore;?>';
var lblAfter = '<?php echo $lang->testcase->insertAfter;?>';
var newRow = "<tr class='a-center' id='row" + newRowID + "'>";
newRow += "<th class='stepID'></th>";
newRow += "<td class='w-p50'><textarea name='steps[]' rows=3 class='w-p100'></textarea></td>";
newRow += "<td><textarea name='expects[]' rows=3 class='w-p100'></textarea></td>";
newRow += "<td class='a-left w-100px'><nobr>";
newRow += "<input type='button' tabindex='-1' class='addbutton' value='" + lblBefore + "' onclick='preInsert(" + newRowID + ")' /><br />";
newRow += "<input type='button' tabindex='-1' class='addbutton' value='" + lblAfter + "' onclick='postInsert(" + newRowID + ")' /><br />";
newRow += "<input type='button' tabindex='-1' class='delbutton' value='" + lblDelete + "' onclick='deleteRow(" + newRowID + ")' /><br />";
newRow += "</nobr></td>";
return newRow;
}
/**
* Update the step id.
*
* @access public
* @return void
*/
function updateStepID()
{
var i = 1;
$('.stepID').each(function(){$(this).html(i ++)});
}
</script>