* finish task #2161.
This commit is contained in:
@@ -11,10 +11,11 @@ $(document).ready(function()
|
||||
}).on('keyup change paste', 'input', function()
|
||||
{
|
||||
var val = $(this).val().toLowerCase();
|
||||
if(val == '') return $('.assign-menu > .option').removeClass('hide');
|
||||
$('.assign-menu > .option').each(function()
|
||||
{
|
||||
var $option = $(this);
|
||||
$option.toggleClass('hide', $option.text().toLowerCase().indexOf(val) < 0 && $option.data('key').toLowerCase().indexOf(val) < 0);
|
||||
$option.toggleClass('hide', $option.text().toLowerCase().indexOf(val) < 0 || $option.data('key').toLowerCase().indexOf(val) < 0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -168,7 +168,7 @@ class product extends control
|
||||
$this->view->moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'story', $startModuleID = 0, array('treeModel', 'createStoryLink'));
|
||||
$this->view->parentModules = $this->tree->getParents($moduleID);
|
||||
$this->view->pager = $pager;
|
||||
$this->view->users = $this->user->getPairs('noletter');
|
||||
$this->view->users = $this->user->getPairs('nodeleted|noletter|pofirst');
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->moduleID = $moduleID;
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
.assign-menu {min-width: 150px; overflow: hidden; max-height: 305px}
|
||||
.assign-menu.with-search {padding-bottom: 34px;}
|
||||
.assign-menu > .assign-search {padding: 0; position: absolute; z-index: 0; bottom: 0; left: 0; right: 0}
|
||||
.assign-menu > .assign-search .input-group-addon {position: absolute; right: 10px; top: 0; z-index: 10; background: none; border: none; color: #666}
|
||||
@@ -1,4 +1,19 @@
|
||||
$(function()
|
||||
{
|
||||
if(browseType == 'bysearch') ajaxGetSearchForm();
|
||||
|
||||
$('.assign-search').click(function(e)
|
||||
{
|
||||
e.stopPropagation();
|
||||
return false;
|
||||
}).on('keyup change paste', 'input', function()
|
||||
{
|
||||
var val = $(this).val().toLowerCase();
|
||||
if(val == '') return $('.assign-menu > .option').removeClass('hide');
|
||||
$('.assign-menu > .option').each(function()
|
||||
{
|
||||
var $option = $(this);
|
||||
$option.toggleClass('hide', $option.text().toLowerCase().indexOf(val) < 0 || $option.data('key').toLowerCase().indexOf(val) < 0);
|
||||
});
|
||||
});
|
||||
})
|
||||
|
||||
@@ -220,6 +220,28 @@
|
||||
{
|
||||
echo '<li>' . html::a('javascript:;', $lang->story->stageAB, '', $class) . '</li>';
|
||||
}
|
||||
|
||||
if(common::hasPriv('story', 'batchAssignTo'))
|
||||
{
|
||||
$withSearch = count($users) > 10;
|
||||
$actionLink = $this->createLink('story', 'batchAssignTo', "productID=$productID");
|
||||
echo html::select('assignedTo', $users, '', 'class="hidden"');
|
||||
echo "<li class='dropdown-submenu'>";
|
||||
echo html::a('javascript::', $lang->story->assignedTo, 'id="assignItem"');
|
||||
echo "<ul class='dropdown-menu assign-menu" . ($withSearch ? ' with-search':'') . "'>";
|
||||
foreach ($users as $key => $value)
|
||||
{
|
||||
if(empty($key)) continue;
|
||||
echo "<li class='option' data-key='$key'>" . html::a("javascript:$(\"#assignedTo\").val(\"$key\");setFormAction(\"$actionLink\")", $value, '', '') . '</li>';
|
||||
}
|
||||
if($withSearch) echo "<li class='assign-search'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></li>";
|
||||
echo "</ul>";
|
||||
echo "</li>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<li>' . html::a('javascript:;', $lang->story->assignedTo, '', $class) . '</li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -11,10 +11,11 @@ $(function()
|
||||
}).on('keyup change paste', 'input', function()
|
||||
{
|
||||
var val = $(this).val().toLowerCase();
|
||||
if(val == '') return $('.assign-menu > .option').removeClass('hide');
|
||||
$('.assign-menu > .option').each(function()
|
||||
{
|
||||
var $option = $(this);
|
||||
$option.toggleClass('hide', $option.text().toLowerCase().indexOf(val) < 0 && $option.data('key').toLowerCase().indexOf(val) < 0);
|
||||
$option.toggleClass('hide', $option.text().toLowerCase().indexOf(val) < 0 || $option.data('key').toLowerCase().indexOf(val) < 0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -799,6 +799,28 @@ class story extends control
|
||||
die(js::locate($this->session->storyList, 'parent'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch assign to.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchAssignTo()
|
||||
{
|
||||
if(!empty($_POST) && isset($_POST['storyIDList']))
|
||||
{
|
||||
$allChanges = $this->story->batchAssignTo();
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
foreach($allChanges as $storyID => $changes)
|
||||
{
|
||||
$actionID = $this->action->create('story', $storyID, 'Edited');
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
$this->sendmail($storyID, $actionID);
|
||||
}
|
||||
}
|
||||
die(js::locate($this->session->storyList));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tasks of a story.
|
||||
*
|
||||
|
||||
@@ -768,6 +768,36 @@ class storyModel extends model
|
||||
return $allChanges;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch assign to.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function batchAssignTo()
|
||||
{
|
||||
$now = helper::now();
|
||||
$allChanges = array();
|
||||
$storyIDList = $this->post->storyIDList;
|
||||
$assignedTo = $this->post->assignedTo;
|
||||
$oldStories = $this->getByList($storyIDList);
|
||||
foreach($storyIDList as $storyID)
|
||||
{
|
||||
$oldStory = $oldStories[$storyID];
|
||||
if($assignedTo == $oldStory->assignedTo) continue;
|
||||
|
||||
$story = new stdclass();
|
||||
$story->lastEditedBy = $this->app->user->account;
|
||||
$story->lastEditedDate = $now;
|
||||
$story->assignedTo = $assignedTo;
|
||||
$story->assignedDate = $now;
|
||||
|
||||
$this->dao->update(TABLE_STORY)->data($story)->autoCheck()->where('id')->eq((int)$storyID)->exec();
|
||||
if(!dao::isError()) $allChanges[$storyID] = common::createChanges($oldStory, $story);
|
||||
}
|
||||
return $allChanges;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate a story.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user