* code for view todo.

This commit is contained in:
wangyidong
2013-06-20 08:23:08 +00:00
parent abb4e55b32
commit f2d86d3b41
7 changed files with 189 additions and 4 deletions
+2
View File
@@ -308,6 +308,8 @@ class actionModel extends model
$desc = $action->extra ? $this->lang->action->desc->extra : $this->lang->action->desc->common;
}
if($this->app->getViewType() == 'mhtml') $action->date = date('y-m-d H:i', strtotime($action->date));
/* Cycle actions, replace vars. */
foreach($action as $key => $value)
{
+3 -1
View File
@@ -269,6 +269,7 @@ class commonModel extends model
}
unset($this->lang->menuOrder);
unset($this->lang->menugroup);
$this->lang->menu = new stdclass();
$this->lang->menu = $menu;
}
@@ -288,8 +289,9 @@ class commonModel extends model
/* Set the main main menu. */
$mainMenu = $moduleName;
if($moduleName == 'my') $mainMenu = $methodName;
if($moduleName == 'my' and $app->getViewType()) $mainMenu = $methodName;
if(isset($lang->menugroup->$moduleName)) $mainMenu = $lang->menugroup->$moduleName;
if($moduleName == 'todo' and $app->getViewType()) $mainMenu = $moduleName;
/* Sort menu according to menuOrder. */
if(isset($lang->menuOrder))
+123
View File
@@ -0,0 +1,123 @@
<script language='Javascript'>
var fold = '<?php echo $lang->fold;?>';
var unfold = '<?php echo $lang->unfold;?>';
function switchChange(historyID)
{
changeClass = $('#switchButton' + historyID).attr('class');
if(changeClass.indexOf('change-show') > 0)
{
$('#switchButton' + historyID).attr('class', changeClass.replace('change-show', 'change-hide'));
$('#changeBox' + historyID).show();
$('#changeBox' + historyID).prev('.changeDiff').show();
}
else
{
$('#switchButton' + historyID).attr('class', changeClass.replace('change-hide', 'change-show'));
$('#changeBox' + historyID).hide();
$('#changeBox' + historyID).prev('.changeDiff').hide();
}
}
function toggleStripTags(obj)
{
var diffClass = $(obj).attr('class');
if(diffClass.indexOf('diff-all') > 0)
{
$(obj).attr('class', diffClass.replace('diff-all', 'diff-short'));
$(obj).attr('title', '<?php echo $lang->action->textDiff?>');
}
else
{
$(obj).attr('class', diffClass.replace('diff-short', 'diff-all'));
$(obj).attr('title', '<?php echo $lang->action->original?>');
}
var boxObj = $(obj).next();
var oldDiff = '';
var newDiff = '';
$(boxObj).find('blockquote').each(function(){
oldDiff = $(this).html();
newDiff = $(this).next().html();
$(this).html(newDiff);
$(this).next().html(oldDiff);
})
}
function toggleShow(obj)
{
var orderClass = $(obj).find('span').attr('class');
if(orderClass == 'change-show')
{
$(obj).find('span').attr('class', 'change-hide');
}
else
{
$(obj).find('span').attr('class', 'change-show');
}
$('.changes').each(function(){
var box = $(this).parent();
while($(box).attr('tagName').toLowerCase() != 'li') box = $(box).parent();
var switchButtonID = ($(box).find('span').find("span").attr('id'));
switchChange(switchButtonID.replace('switchButton', ''));
})
}
function toggleOrder(obj)
{
var orderClass = $(obj).find('span').attr('class');
if(orderClass == 'log-asc')
{
$(obj).find('span').attr('class', 'log-desc');
}
else
{
$(obj).find('span').attr('class', 'log-asc');
}
$("#historyItem li").reverseOrder();
}
$(function(){
var diffButton = "<span onclick='toggleStripTags(this)' class='hidden changeDiff diff-all hand' title='<?php echo $lang->action->original?>'>&nbsp;</span>";
var newBoxID = ''
var oldBoxID = ''
$('blockquote').each(function(){
newBoxID = $(this).parent().attr('id');
if(newBoxID != oldBoxID)
{
oldBoxID = newBoxID;
if($(this).html() != $(this).next().html()) $(this).parent().before(diffButton);
}
})
})
</script>
<?php if($extView = $this->getExtViewFile(__FILE__)){include $extView; return helper::cd();}?>
<script src='<?php echo $jsRoot;?>jquery/reverseorder/raw.js' type='text/javascript'></script>
<div id='actionbox'>
<fieldset>
<legend>
<?php echo $lang->history?>
</legend>
<ol id='historyItem'>
<?php $i = 1; ?>
<?php foreach($actions as $action):?>
<li value='<?php echo $i ++;?>'>
<?php
if(isset($users[$action->actor])) $action->actor = $users[$action->actor];
if($action->action == 'assigned' and isset($users[$action->extra]) ) $action->extra = $users[$action->extra];
if(strpos($action->actor, ':') !== false) $action->actor = substr($action->actor, strpos($action->actor, ':') + 1);
?>
<span>
<?php $this->action->printAction($action);?>
</span>
<?php if(!empty($action->comment) or !empty($action->history)):?>
<?php if(!empty($action->comment)) echo "<div class='history'>";?>
<?php if($action->comment) echo strip_tags($action->comment) == $action->comment ? nl2br($action->comment) : $action->comment; ?>
<?php if(!empty($action->comment)) echo "</div>";?>
<?php endif;?>
</li>
<?php endforeach;?>
</ol>
</fieldset>
</div>
+1 -1
View File
@@ -69,7 +69,7 @@ class my extends control
* @access public
* @return void
*/
public function todo($type = 'today', $account = '', $status = 'all', $orderBy = "date,status,begin", $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function todo($type = 'today', $account = '', $status = 'all', $orderBy = "date_desc,status,begin", $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
/* Save session. */
$uri = $this->app->getURI(true);
+15 -1
View File
@@ -22,7 +22,21 @@
</div>
<ul data-role='listview'>
<?php foreach($todos as $todo):?>
<li><?php echo html::a($this->createLink('todo', 'view', "todoID=$todo->id&from=my"), $todo->name)?></li>
<li>
<?php echo html::a($this->createLink('todo', 'view', "todoID=$todo->id&from=my"), '#' . $todo->id . ' ' . $todo->name)?>
<span class='ui-li-count'>
<?php
if(empty($todo->begin))
{
echo $lang->todo->lblDisableDate;
}
else
{
echo $todo->begin . ' ~ ' . $todo->end;
}
?>
</span>
</li>
<?php endforeach;?>
</ul>
<p><?php echo $pager->show('right', 'short')?></p>
+1 -1
View File
@@ -23,6 +23,6 @@ echo html::hidden("begins[$i]", '2400');
echo html::hidden("ends[$i]", '2400');
?>
<?php endfor;?>
<p><?php echo html::submitButton()?></p>
<p><?php echo html::submitButton('', "data-inline='true' data-theme='b'")?></p>
</form>
<?php include '../../common/view/m.footer.html.php';?>
+44
View File
@@ -0,0 +1,44 @@
<?php
/**
* The view file of view method of todo module of ZenTaoPMS.
*
* @copyright Copyright 2009-2013 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package todo
* @version $Id: view.html.php 4642 2013-04-11 05:38:37Z chencongzhi520@gmail.com $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/m.header.html.php';?>
</div>
<?php if(!$todo->private or ($todo->private and $todo->account == $app->user->account)):?>
<h3 class='title'><?php echo "TODO #$todo->id $todo->name"?></h3>
<div class='textContent'><?php echo $todo->desc;?></td>
<?php include '../../common/view/m.action.html.php';?>
<?php else:?>
<?php echo $lang->todo->thisIsPrivate;?>
<?php endif;?>
<div data-role='footer' data-position='fixed'>
<div data-role='navbar'>
<ul>
<?php
if($this->session->todoList)
{
$browseLink = $this->session->todoList;
}
else
{
$browseLink = $this->createLink('my', 'todo');
}
if(common::hasPriv('todo', 'finish') and $todo->status != 'done') echo '<li>' . html::a($this->createLink('todo', 'finish', "id=$todo->id"), $lang->todo->finish, 'hiddenwin') . '</li>';
if($todo->account == $app->user->account and common::hasPriv('todo', 'delete'))
{
echo '<li>' . html::a($this->createLink('todo', 'delete', "todoID=$todo->id"), $lang->delete, 'hiddenwin') . '</li>';
}
echo '<li>' . html::a($browseLink, $lang->goback) . '</li>';
?>
</ul>
</div>
</div>
<?php include '../../common/view/m.footer.html.php';?>