Merge branch 'master' of github.com:easysoft/zentaopms
This commit is contained in:
@@ -73,7 +73,7 @@ class company extends control
|
||||
/* Get users. */
|
||||
$users = $this->company->getUsers($type, $queryID, $deptID, $sort, $pager);
|
||||
|
||||
/* Set view. */
|
||||
/* Assign. */
|
||||
$this->view->title = $this->lang->company->index . $this->lang->colon . $this->lang->dept->common;
|
||||
$this->view->position[] = $this->lang->dept->common;
|
||||
$this->view->users = $users;
|
||||
|
||||
@@ -147,7 +147,7 @@ class product extends control
|
||||
$this->product->buildSearchForm($productID, $this->products, $queryID, $actionURL);
|
||||
$this->loadModel('search')->setSearchParams($this->config->product->search);
|
||||
|
||||
/* Set view. */
|
||||
/* Assign. */
|
||||
$this->view->title = $this->products[$productID]. $this->lang->colon . $this->lang->product->browse;
|
||||
$this->view->position[] = $this->products[$productID];
|
||||
$this->view->position[] = $this->lang->product->browse;
|
||||
|
||||
@@ -69,27 +69,29 @@ class search extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a query
|
||||
*
|
||||
* @param int $queryID
|
||||
* Delete current search query.
|
||||
*
|
||||
* @param int $queryID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function deleteQuery($queryID)
|
||||
{
|
||||
$this->dao->delete()->from(TABLE_USERQUERY)->where('id')->eq($queryID)->andWhere('account')->eq($this->app->user->account)->exec();
|
||||
$this->ajaxGetQuery();
|
||||
$this->search->deleteQuery($queryID);
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
die('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax get query.
|
||||
*
|
||||
* AJAX: get search query.
|
||||
*
|
||||
* @param string $module
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetQuery()
|
||||
public function ajaxGetQuery($module = '')
|
||||
{
|
||||
$module = $this->session->searchParams['module'];
|
||||
$module = empty($module) ? $this->session->searchParams['module'] : $module;
|
||||
$queries = $this->search->getQueryPairs($module);
|
||||
die(html::select('queryID', $queries, '', 'onchange=executeQuery(this.value) class=form-control'));
|
||||
}
|
||||
|
||||
@@ -255,6 +255,18 @@ class searchModel extends model
|
||||
$this->dao->insert(TABLE_USERQUERY)->data($query)->autoCheck()->check('title', 'notempty')->exec();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete current query from db.
|
||||
*
|
||||
* @param int $queryID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function deleteQuery($queryID)
|
||||
{
|
||||
$this->dao->delete()->from(TABLE_USERQUERY)->where('id')->eq($queryID)->andWhere('account')->eq($this->app->user->account)->exec();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title => id pairs of a user.
|
||||
*
|
||||
|
||||
@@ -245,7 +245,7 @@ function saveQuery()
|
||||
saveQueryLink = createLink('search', 'saveQuery');
|
||||
$.post(saveQueryLink, {title: r, module: module}, function(data)
|
||||
{
|
||||
if(data == 'success') $('#queryBox').load(createLink('search', 'ajaxGetQuery'));
|
||||
if(data == 'success') $('#queryBox').load(createLink('search', 'ajaxGetQuery', 'module=' + module));
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -273,8 +273,11 @@ function deleteQuery()
|
||||
{
|
||||
queryID = $('#queryID').val();
|
||||
if(!queryID) return;
|
||||
deleteLink = createLink('search', 'deleteQuery', 'queryID=' + queryID);
|
||||
$('#queryBox').load(deleteLink);
|
||||
deleteQueryLink = createLink('search', 'deleteQuery', 'queryID=' + queryID);
|
||||
$.get(deleteQueryLink, function(data)
|
||||
{
|
||||
if(data == 'success') $('#queryBox').load(createLink('search', 'ajaxGetQuery', 'module=' + module));
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -904,17 +904,17 @@ class story extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* Link stories.
|
||||
* If type is linkStories, link related stories else link child stories.
|
||||
*
|
||||
* @param int $storyID
|
||||
* @param string $linkType
|
||||
* @param string $type
|
||||
* @param string $stories
|
||||
* @param string $browseType
|
||||
* @param int $param
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function linkStory($storyID, $linkType = '', $stories = '', $browseType = '', $param = 0)
|
||||
public function linkStory($storyID, $type = '', $stories = '', $browseType = '', $param = 0)
|
||||
{
|
||||
/* Get story, product, and products. */
|
||||
$story = $this->story->getById($storyID);
|
||||
@@ -931,29 +931,14 @@ class story extends control
|
||||
/* Link stories. */
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$linkedStories = $this->story->linkStories($storyID, $linkType, $stories);
|
||||
if(isonlybody()) die(js::closeModal('parent.parent', '', "function(){parent.parent.loadLinkedStories('$storyID', '$linkType', '$linkedStories')}"));
|
||||
$stories = $this->story->linkStories($storyID, $type, $stories);
|
||||
if(isonlybody()) die(js::closeModal('parent.parent', '', "function(){parent.parent.loadLinkedStories('$storyID', '$type', '$stories')}"));
|
||||
die(js::locate($browseLink, 'parent'));
|
||||
}
|
||||
|
||||
/* Build search form. */
|
||||
unset($this->config->product->search['fields']['module']);
|
||||
$this->config->product->search['actionURL'] = $this->createLink('story', 'linkStory', "storyID=$storyID&linkType=$linkType&stories=$stories&browseType=bySearch&queryID=myQueryID", '', true);
|
||||
$this->config->product->search['queryID'] = $queryID;
|
||||
$this->config->product->search['params']['product']['values'] = array($story->product => $products[$story->product], 'all' => $this->lang->product->allProduct);
|
||||
$this->config->product->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts($products);
|
||||
unset($this->lang->story->statusList['draft']);
|
||||
if($product->type != 'normal')
|
||||
{
|
||||
$this->config->product->search['fields']['branch'] = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]);
|
||||
$this->config->product->search['params']['branch']['values'] = array('' => '') + $branches;
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($this->config->product->search['fields']['branch']);
|
||||
unset($this->config->product->search['params']['branch']);
|
||||
}
|
||||
$this->config->product->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => $this->lang->story->statusList);
|
||||
$actionURL = $this->createLink('story', 'linkStory', "storyID=$storyID&type=$type&stories=$stories&browseType=bySearch&queryID=myQueryID", '', true);
|
||||
$this->loadModel('product')->buildSearchForm($story->product, $products, $queryID, $actionURL);
|
||||
$this->loadModel('search')->setSearchParams($this->config->product->search);
|
||||
|
||||
/* Get stories to link. */
|
||||
@@ -963,45 +948,45 @@ class story extends control
|
||||
}
|
||||
else
|
||||
{
|
||||
$allStories = $this->story->getProductStories($story->product, 0, $moduleID = '0');
|
||||
$allStories = $this->story->getProductStories($story->product);
|
||||
}
|
||||
|
||||
$title = $this->lang->story->linkStory;
|
||||
$position[] = html::a($browseLink, $story->title);
|
||||
$position[] = $this->lang->story->linkStory;
|
||||
|
||||
$this->view->title = $title;
|
||||
$this->view->position = $position;
|
||||
/* Assign. */
|
||||
$this->view->title = $this->lang->story->linkStory;
|
||||
$this->view->position[] = html::a($browseLink, $story->title);
|
||||
$this->view->position[] = $this->lang->story->linkStory;
|
||||
$this->view->product = $product;
|
||||
$this->view->products = $products;
|
||||
$this->view->branches = $branches;
|
||||
$this->view->linkType = $linkType;
|
||||
$this->view->type = $type;
|
||||
$this->view->story = $story;
|
||||
$this->view->allStories = $allStories;
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX: Get linked story.
|
||||
* AJAX: If type is linkStories, get related stories else get child stories.
|
||||
*
|
||||
* @param int $storyID
|
||||
* @param string $type
|
||||
* @param string $linkedStories
|
||||
* @access public
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
public function ajaxGetLinkedStories($storyID, $type = '', $linkedStories)
|
||||
public function ajaxGetLinkedStories($storyID, $type = '', $linkedStories = '')
|
||||
{
|
||||
$stories = $this->story->getLinkedStories($linkedStories);
|
||||
$story = $this->story->getById($storyID);
|
||||
|
||||
$output = "<ul class='list-unstyled'>";
|
||||
if($type == 'linkStories') $output .= html::a($this->createLink('story', 'linkStory', "storyID=$storyID&linkType=$type&stories=$story->linkStories", '', true), $this->lang->story->linkStory, '', "class='iframe' data-width='85%'");
|
||||
if($type == 'childStories') $output .= html::a($this->createLink('story', 'linkStory', "storyID=$storyID&linkType=$type&stories=$story->childStories", '', true), $this->lang->story->linkStory, '', "class='iframe' data-width='85%'");
|
||||
foreach($stories as $storyId => $title)
|
||||
$output .= html::a($this->createLink('story', 'linkStory', "storyID=$storyID&type=$type&stories={$story->$type}", '', true), $this->lang->story->linkStory, '', "class='iframe' data-width='85%'");
|
||||
foreach($stories as $storyId => $storyTitle)
|
||||
{
|
||||
$output .= '<li>' . html::a(inlink('view', "storyID=$storyId"), "#$storyId " . $title) . html::a("javascript:deleteLinkedStory($storyID, \"$type\", $storyId)", '<i class="icon-remove"></i>', '', "style='float:right'");
|
||||
$output .= '<li>';
|
||||
$output .= html::a(inlink('view', "storyID=$storyId"), "#$storyId " . $storyTitle);
|
||||
$output .= html::a("javascript:deleteLinkedStory($storyID, \"$type\", $storyId)", '<i class="icon-remove"></i>', '', "title='{$this->lang->unlink}' style='float:right'");
|
||||
$output .= '</li>';
|
||||
}
|
||||
$output .= '</ul>';
|
||||
|
||||
@@ -1009,24 +994,27 @@ class story extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX: delete linked story.
|
||||
* AJAX: Delete linked story.
|
||||
*
|
||||
* @param int $storyID
|
||||
* @param string $type
|
||||
* @param int $deleteStory
|
||||
* @access public
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
public function ajaxDeleteLinkedStory($storyID, $type = '', $deleteStory)
|
||||
public function ajaxDeleteLinkedStory($storyID, $type = '', $deleteStory = 0)
|
||||
{
|
||||
$stories = $this->story->deleteLinkedStory($storyID, $type, $deleteStory);
|
||||
$story = $this->story->getById($storyID);
|
||||
|
||||
$output = "<ul class='list-unstyled'>";
|
||||
if($type == 'linkStories') $output .= html::a($this->createLink('story', 'linkStory', "storyID=$storyID&linkType=$type&stories=$story->linkStories", '', true), $this->lang->story->linkStory, '', "class='iframe' data-width='85%'");
|
||||
if($type == 'childStories') $output .= html::a($this->createLink('story', 'linkStory', "storyID=$storyID&linkType=$type&stories=$story->childStories", '', true), $this->lang->story->linkStory, '', "class='iframe' data-width='85%'");
|
||||
foreach($stories as $storyId => $title)
|
||||
$output .= html::a($this->createLink('story', 'linkStory', "storyID=$storyID&type=$type&stories={$story->$type}", '', true), $this->lang->story->linkStory, '', "class='iframe' data-width='85%'");
|
||||
foreach($stories as $storyId => $storyTitle)
|
||||
{
|
||||
$output .= '<li>' . html::a(inlink('view', "storyID=$storyId"), "#$storyId " . $title) . html::a("javascript:deleteLinkedStory($storyID, \"$type\", $storyId)", '<i class="icon-remove"></i>', '', "style='float:right'");
|
||||
$output .= '<li>';
|
||||
$output .= html::a(inlink('view', "storyID=$storyId"), "#$storyId " . $storyTitle);
|
||||
$output .= html::a("javascript:deleteLinkedStory($storyID, \"$type\", $storyId)", '<i class="icon-remove"></i>', '', "title='{$this->lang->unlink}' style='float:right'");
|
||||
$output .= '</li>';
|
||||
}
|
||||
$output .= '</ul>';
|
||||
|
||||
|
||||
@@ -1039,19 +1039,19 @@ class storyModel extends model
|
||||
* Link stories.
|
||||
*
|
||||
* @param int $storyID
|
||||
* @param string $linkType
|
||||
* @param string $type
|
||||
* @param string $stories
|
||||
* @access public
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
public function linkStories($storyID, $linkType, $linkedStories)
|
||||
public function linkStories($storyID, $type = 'linkStories', $stories = '')
|
||||
{
|
||||
if($this->post->stories == false) return false;
|
||||
$stories = implode(',', $this->post->stories) . ',' . trim($linkedStories, ',');
|
||||
$this->dao->update(TABLE_STORY)->set($linkType)->eq($stories)->where('id')->eq($storyID)->exec();
|
||||
if($this->post->stories == false) return $stories;
|
||||
|
||||
$stories = implode(',', $this->post->stories) . ',' . trim($stories, ',');
|
||||
$this->dao->update(TABLE_STORY)->set($type)->eq(trim($stories,','))->where('id')->eq($storyID)->exec();
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
$this->loadModel('action')->create('story', $storyID, $linkType, '', implode(',', $this->post->stories));
|
||||
$this->loadModel('action')->create('story', $storyID, $type, '', implode(',', $this->post->stories));
|
||||
|
||||
return $stories;
|
||||
}
|
||||
@@ -1063,11 +1063,12 @@ class storyModel extends model
|
||||
* @param string $type
|
||||
* @param int $deleteStory
|
||||
* @access public
|
||||
* @return void
|
||||
* @return array
|
||||
*/
|
||||
public function deleteLinkedStory($storyID, $type, $deleteStory)
|
||||
{
|
||||
$story = $this->getById($storyID);
|
||||
|
||||
$stories = explode(',', trim($story->$type, ','));
|
||||
foreach($stories as $key => $storyId)
|
||||
{
|
||||
@@ -1077,8 +1078,7 @@ class storyModel extends model
|
||||
|
||||
$this->dao->update(TABLE_STORY)->set($type)->eq($stories)->where('id')->eq($storyID)->exec();
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
|
||||
$action = 'mv' . $type;
|
||||
$action = ($type == 'linkStories') ? 'mvLinkStories' : 'mvChildStories';
|
||||
$this->loadModel('action')->create('story', $storyID, $action, '', $deleteStory);
|
||||
|
||||
return $this->getLinkedStories($stories);
|
||||
@@ -1089,7 +1089,7 @@ class storyModel extends model
|
||||
*
|
||||
* @param string $stories
|
||||
* @access public
|
||||
* @return void
|
||||
* @return array
|
||||
*/
|
||||
public function getLinkedStories($stories)
|
||||
{
|
||||
|
||||
@@ -173,12 +173,18 @@
|
||||
<th><?php echo $lang->story->linkStories;?></th>
|
||||
<td id='linkStoriesBox'>
|
||||
<ul class='list-unstyled'>
|
||||
<?php echo html::a($this->createLink('story', 'linkStory', "storyID=$story->id&linkType=linkStories&stories=$story->linkStories", '', true), $lang->story->linkStory, '', "class='iframe' data-width='85%'");?>
|
||||
<?php echo html::a($this->createLink('story', 'linkStory', "storyID=$story->id&type=linkStories&stories=$story->linkStories", '', true), $lang->story->linkStory, '', "class='iframe' data-width='85%'");?>
|
||||
<?php
|
||||
$linkStories = explode(',', $story->linkStories);
|
||||
foreach($linkStories as $linkStoryID)
|
||||
{
|
||||
if(isset($story->extraStories[$linkStoryID])) echo '<li>' . html::a(inlink('view', "storyID=$linkStoryID"), "#$linkStoryID " . $story->extraStories[$linkStoryID]) . html::a("javascript:deleteLinkedStory($story->id, \"linkStories\", $linkStoryID)", '<i class="icon-remove"></i>', '', "style='float:right'");
|
||||
if(isset($story->extraStories[$linkStoryID]))
|
||||
{
|
||||
echo '<li>';
|
||||
echo html::a(inlink('view', "storyID=$linkStoryID"), "#$linkStoryID " . $story->extraStories[$linkStoryID]);
|
||||
echo html::a("javascript:deleteLinkedStory($story->id, \"linkStories\", $linkStoryID)", '<i class="icon-remove"></i>', '', "title='{$lang->unlink}' style='float:right'");
|
||||
echo '</li>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
@@ -188,12 +194,18 @@
|
||||
<th><?php echo $lang->story->childStories;?></th>
|
||||
<td id='childStoriesBox'>
|
||||
<ul class='list-unstyled'>
|
||||
<?php echo html::a($this->createLink('story', 'linkStory', "storyID=$story->id&linkType=childStories&stories=$story->childStories", '', true), $lang->story->linkStory, '', "class='iframe' data-width='85%'");?>
|
||||
<?php echo html::a($this->createLink('story', 'linkStory', "storyID=$story->id&type=childStories&stories=$story->childStories", '', true), $lang->story->linkStory, '', "class='iframe' data-width='85%'");?>
|
||||
<?php
|
||||
$childStories = explode(',', $story->childStories);
|
||||
foreach($childStories as $childStoryID)
|
||||
{
|
||||
if(isset($story->extraStories[$childStoryID])) echo '<li>' . html::a(inlink('view', "storyID=$childStoryID"), "#$childStoryID" . $story->extraStories[$childStoryID]) . html::a("javascript:deleteLinkedStory($story->id, \"childStories\", $childStoryID)", '<i class="icon-remove"></i>', '', "style='float:right'") . '</li>';
|
||||
if(isset($story->extraStories[$childStoryID]))
|
||||
{
|
||||
echo '<li>';
|
||||
echo html::a(inlink('view', "storyID=$childStoryID"), "#$childStoryID" . $story->extraStories[$childStoryID]);
|
||||
echo html::a("javascript:deleteLinkedStory($story->id, \"childStories\", $childStoryID)", '<i class="icon-remove"></i>', '', "title='{$lang->unlink}' style='float:right'");
|
||||
echo '</li>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Fei Chen <chenfei@cnezsoft.com>
|
||||
* @package project
|
||||
* @package story
|
||||
* @version $Id: linkstory.html.php 4129 2016-03-09 08:58:13Z chenfei $
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
@@ -38,17 +38,17 @@
|
||||
<tbody>
|
||||
<?php $storyCount = 0;?>
|
||||
<?php foreach($allStories as $storyDetail):?>
|
||||
<?php if(in_array($storyDetail->id, explode(',', $story->$linkType))) continue;?>
|
||||
<?php if(in_array($storyDetail->id, explode(',', $story->$type))) continue;?>
|
||||
<?php $storyLink = $this->createLink('story', 'view', "storyID=$storyDetail->id");?>
|
||||
<tr class='text-center'>
|
||||
<td class='text-left'>
|
||||
<input type='checkbox' name='stories[]' value='<?php echo $storyDetail->id;?>'/>
|
||||
<input type='hidden' name='products[]' value='<?php echo $storyDetail->product;?>' />
|
||||
<input type='hidden' name='products[]' value='<?php echo $storyDetail->product;?>'/>
|
||||
<?php echo html::a($storyLink, sprintf('%03d', $storyDetail->id));?>
|
||||
</td>
|
||||
<td><span class='<?php echo 'pri' . zget($lang->story->priList, $storyDetail->pri, $storyDetail->pri)?>'><?php echo zget($lang->story->priList, $storyDetail->pri, $storyDetail->pri);?></span></td>
|
||||
<td><?php echo html::a($this->createLink('product', 'browse', "productID=$storyDetail->product&branch=$storyDetail->branch"), $products[$storyDetail->product], '_blank');?></td>
|
||||
<td class='text-left nobr' title="<?php echo $storyDetail->title?>"><?php echo html::a($storyLink, $storyDetail->title);?></td>
|
||||
<td class='text-left nobr' title="<?php echo $storyDetail->title?>"><?php echo html::a($storyLink, $storyDetail->title, '_blank');?></td>
|
||||
<td><?php echo $storyDetail->planTitle;?></td>
|
||||
<?php if($product->type != 'normal'):?>
|
||||
<td><?php if(isset($branches[$storyDetail->branch])) echo $branches[$storyDetail->branch];?></td>
|
||||
@@ -63,10 +63,7 @@
|
||||
<tr>
|
||||
<td colspan='<?php echo $product->type == 'normal' ? '7' :'8';?>' class='text-left'>
|
||||
<div class='table-actions clearfix'>
|
||||
<?php
|
||||
if($storyCount) echo html::selectButton() . html::submitButton();
|
||||
else echo "<div class='text'>" . $lang->project->whyNoStories . '</div>';
|
||||
?>
|
||||
<?php if($storyCount) echo html::selectButton() . html::submitButton();?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -75,6 +72,6 @@
|
||||
</form>
|
||||
</div>
|
||||
<script type='text/javascript'>
|
||||
$(function(){ajaxGetSearchForm()});
|
||||
$(function(){ajaxGetSearchForm();});
|
||||
</script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
Reference in New Issue
Block a user