* code for task #8446
This commit is contained in:
@@ -1705,4 +1705,43 @@ class story extends control
|
||||
if($id) die(html::select("storys[$id]", $storys, '', 'class="form-control"'));
|
||||
die(html::select('story', $storys, '', 'class=form-control'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax get story status.
|
||||
*
|
||||
* @param string $method
|
||||
* @param string $params
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetStatus($method, $params = '')
|
||||
{
|
||||
parse_str(str_replace(',', '&', $params), $params);
|
||||
$status = '';
|
||||
if($method == 'create')
|
||||
{
|
||||
$status = 'draft';
|
||||
if(!empty($params['needNotReview'])) $status = 'active';
|
||||
if(!empty($params['project'])) $status = 'active';
|
||||
if($this->story->checkForceReview()) $status = 'draft';
|
||||
}
|
||||
elseif($method == 'change')
|
||||
{
|
||||
$oldStory = $this->dao->findById((int)$params['storyID'])->from(TABLE_STORY)->fetch();
|
||||
$status = $oldStory->status;
|
||||
if($params['changed'] and $oldStory->status == 'active' and empty($params['needNotReview'])) $status = 'changed';
|
||||
if($params['changed'] and $oldStory->status == 'active' and $this->story->checkForceReview()) $status = 'changed';
|
||||
if($params['changed'] and $oldStory->status == 'draft' and $params['needNotReview']) $status = 'active';
|
||||
}
|
||||
elseif($method == 'review')
|
||||
{
|
||||
$oldStory = $this->dao->findById((int)$params['storyID'])->from(TABLE_STORY)->fetch();
|
||||
$status = $oldStory->status;
|
||||
if($params['result'] == 'pass' and $oldStory->status == 'draft') $status = 'active';
|
||||
if($params['result'] == 'pass' and $oldStory->status == 'changed') $status = 'active';
|
||||
if($params['result'] == 'revert') $status = 'active';
|
||||
if($params['result'] == 'reject') $status = 'closed';
|
||||
}
|
||||
die($status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,30 @@ $(function()
|
||||
$('#needNotReview').on('change', function()
|
||||
{
|
||||
$('#assignedTo').attr('disabled', $(this).is(':checked') ? 'disabled' : null).trigger('chosen:updated');
|
||||
getStatus('change', "storyID=" + storyID + ",changed=" + changed + ",needNotReview=" + ($(this).prop('checked') ? 1 : 0));
|
||||
});
|
||||
$('#needNotReview').change();
|
||||
|
||||
$specBox = $('#spec').closest('td').find('.ke-container iframe.ke-edit-iframe').contents().find('.article-content');
|
||||
$verifyBox = $('#verify').closest('td').find('.ke-container iframe.ke-edit-iframe').contents().find('.article-content');
|
||||
$('#title').change(function()
|
||||
{
|
||||
newChanged = ($(this).val() != oldStoryTitle || $specBox.html() != oldStorySpec || $verifyBox.html() != oldStoryVerify || $('.file-input-list .file-input.normal').length > 0) ? 1 : 0;
|
||||
if(changed != newChanged)
|
||||
{
|
||||
changed = newChanged;
|
||||
getStatus('change', "storyID=" + storyID + ",changed=" + changed + ",needNotReview=" + ($('#needNotReview').prop('checked') ? 1 : 0));
|
||||
}
|
||||
});
|
||||
$('.ke-container iframe.ke-edit-iframe').contents().find('.article-content').keyup(function()
|
||||
{
|
||||
newChanged = ($('#title').val() != oldStoryTitle || $specBox.html() != oldStorySpec || $verifyBox.html() != oldStoryVerify || $('.file-input-list .file-input.normal').length > 0) ? 1 : 0;
|
||||
if(changed != newChanged)
|
||||
{
|
||||
changed = newChanged;
|
||||
getStatus('change', "storyID=" + storyID + ",changed=" + changed + ",needNotReview=" + ($('#needNotReview').prop('checked') ? 1 : 0));
|
||||
}
|
||||
});
|
||||
|
||||
if($('.tabs .tab-content .tab-pane.active').children().length == 0) $('.tabs .nav-tabs li.active').css('border-bottom', '1px solid #ccc');
|
||||
});
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
function getStatus(method, params)
|
||||
{
|
||||
$.get(createLink('story', 'ajaxGetStatus', "method=" + method + '¶ms=' + params), function(status)
|
||||
{
|
||||
if($('form #status').length == 0)
|
||||
{
|
||||
$('form').append("<input type='hidden' name='status' id='status' value='" + status + "' />");
|
||||
}
|
||||
else
|
||||
{
|
||||
$('form #status').val(status);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3,6 +3,7 @@ $(function()
|
||||
$('#needNotReview').on('change', function()
|
||||
{
|
||||
$('#assignedTo').attr('disabled', $(this).is(':checked') ? 'disabled' : null).trigger('chosen:updated');
|
||||
getStatus('create', "product=" + $('#product').val() + ",project=" + projectID + ",needNotReview=" + ($(this).prop('checked') ? 1 : 0));
|
||||
});
|
||||
$('#needNotReview').change();
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ function switchShow(result)
|
||||
$('#assignedTo').val(assignedTo);
|
||||
$('#assignedTo').trigger("chosen:updated");
|
||||
}
|
||||
|
||||
getStatus('review', "storyID=" + storyID + ",result=" + result);
|
||||
}
|
||||
|
||||
function setStory(reason)
|
||||
|
||||
@@ -78,4 +78,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php js::set('storyID', $story->id);?>
|
||||
<?php js::set('oldStoryTitle', $story->title);?>
|
||||
<?php js::set('oldStorySpec', $story->spec);?>
|
||||
<?php js::set('oldStoryVerify', $story->verify);?>
|
||||
<?php js::set('changed', 0);?>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<tr>
|
||||
<td colspan='3' class='text-center form-actions'>
|
||||
<?php echo html::submitButton();?>
|
||||
<?php echo html::hidden('status', 'closed');?>
|
||||
<?php echo html::linkButton($lang->goback, $app->session->storyList ? $app->session->storyList : inlink('view', "storyID=$story->id"), 'self', '', 'btn btn-wide');?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -210,5 +210,6 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php js::set('projectID', $projectID);?>
|
||||
<?php js::set('storyModule', $lang->story->module);?>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -89,4 +89,5 @@ var assignedTo = '<?php $story->lastEditedBy ? print($story->lastEditedBy) : pri
|
||||
<div class='main'><?php include '../../common/view/action.html.php';?></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php js::set('storyID', $story->id);?>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -640,7 +640,8 @@ class translateModel extends model
|
||||
$result = true;
|
||||
$tolowerValue = strtolower($value);
|
||||
if($tolowerValue == 'new stdclass()' or $tolowerValue == 'new stdclass') $result = false;
|
||||
if(strpos($value, '$') === 0 and strpos($value, '$lang->productCommon') === false and strpos($value, '$lang->projectCommon') === false and strpos($value, '.') === false and !preg_match('/[^\$\-\>\w\'\"\[\]]/', $value)) $result = false;
|
||||
/* Check for only php variable. */
|
||||
if(strpos($value, '$') === 0 and $value != '$' and strpos($value, '$lang->productCommon') === false and strpos($value, '$lang->projectCommon') === false and strpos($value, '.') === false and !preg_match('/[^\$\-\>\w\'\"\[\]]/', $value)) $result = false;
|
||||
if($value == '$lang->productCommon' or $value == '$lang->projectCommon') $result = false;
|
||||
|
||||
return $result;
|
||||
|
||||
@@ -242,6 +242,8 @@ $(function()
|
||||
$('#modulesTree').find('li:not(.tree-action-item)').each(function()
|
||||
{
|
||||
var $li = $(this);
|
||||
if($li.hasClass('tree-item-branch')) return;
|
||||
|
||||
var item = $li.data();
|
||||
orders['orders[' + item.id + ']'] = $li.attr('data-order') || item.order;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user