Skip to content

Commit

Permalink
CS-5659: Show article status, article type in playlists
Browse files Browse the repository at this point in the history
  • Loading branch information
ahilles107 committed Feb 3, 2015
1 parent 2236a7f commit fdbbc8c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
4 changes: 2 additions & 2 deletions newscoop/admin-files/libs/ContextList/ContextList.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,13 @@ public function processItem(Article $article)
<div class="context-item" langid="%s">
<div class="context-drag-topics"><a href="#" title="drag to sort"></a></div>
<div class="context-item-header">
<div class="context-item-date">%s (%s)</div>
<div class="context-item-date">%s (%s) (%s)</div>
<a href="#" class="view-article" onClick="viewArticle($(this).parent(\'div\').parent(\'div\').parent(\'td\').parent(\'tr\').attr(\'id\'), $(this).parents(\'.context-item:eq(0)\').attr(\'langid\'));">%s</a>
</div>
<a href="javascript:void(0)" class="corner-button" style="display: none" onClick="removeFromContext($(this).parent(\'div\').parent(\'td\').parent(\'tr\').attr(\'id\'));removeFromContext($(this).parents(\'.item:eq(0)\').attr(\'id\'));toggleDragZonePlaceHolder();"><span class="ui-icon ui-icon-closethick"></span></a>
<div class="context-item-summary">%s</div>
</div>
', $article->getLanguageId(), $article->getCreationDate(), $article->getWorkflowDisplayString(), $translator->trans('View article', array(), 'library'), $article->getName()),
', $article->getLanguageId(), $article->getLastModified(), $article->getWorkflowDisplayString(), $article->getType(), $translator->trans('View article', array(), 'library'), $article->getName()),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ $articlePreviewUrl = $this->url( array

$js = <<<JS
function getWorkflowDisplayString(string)
{
if (string === 'Y') {
return "{$translator->trans("Published")}";
} else if (string === 'M') {
return "{$translator->trans("Publish with issue")}";
} else if (string === 'S') {
return "{$translator->trans("Submitted")}";
} else if (string === 'N') {
return "{$translator->trans("New")}";
}
}
function toggleDragZonePlaceHolder()
{
if($('#context_list').find('.context-item').html() != null) {
Expand All @@ -58,9 +71,10 @@ function fnLoadContextList(data)
if(data.code == 200) {
var items = data.items;
for(i = 0; i < items.length; i++) {
var item = items[i];
console.log(item);
appendItemToContextList(item.articleId, item.date.date, item.title, item.workflowStatus);
var item = items[i];
var dateObject = new Date(item.date.date);
var res = dateObject.toISOString().slice(0,19).replace("T", " ");
appendItemToContextList(item.articleId, res, item.title, item.workflowStatus, item.type);
}
}
toggleDragZonePlaceHolder();
Expand All @@ -75,10 +89,10 @@ function loadContextList()
aoData.push({ 'playlistId': '{$this->playlistId}' });
callServer('{$dataUrl}', aoData, fnLoadContextList, true);
}
function appendItemToContextList(article_id, article_date, article_title, status)
function appendItemToContextList(article_id, article_date, article_title, status, type)
{
if (typeof status != 'undefined') {
var articleStatus = ' ('+status+')';
var articleStatus = ' ('+getWorkflowDisplayString(status)+')';
} else {
var articleStatus = '';
};
Expand All @@ -90,7 +104,7 @@ function appendItemToContextList(article_id, article_date, article_title, status
'<div class="context-item">'+
'<div class="context-drag-topics"><a href="#" title="drag to sort"></a></div>'+
'<div class="context-item-header">'+
'<div class="context-item-date">'+ article_date + articleStatus +'</div>'+
'<div class="context-item-date">'+ article_date + articleStatus +' ('+type+')</div>'+
'<a href="#" class="view-article" style="display: none" ' +
'onClick="viewArticle($(this).parent(\'div\').parent(\'div\').parent(\'li.item\').attr(\'id\'));">{$t['view-article']}</a>'+
'</div>'+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function articles(Playlist $playlist, Language $lang = null,
{
$em = $this->getEntityManager();
$query = $em->createQuery("
SELECT ".( $fullArticle ? "pa, a" : "a.number articleId, a.name title, a.updated date" )
SELECT ".( $fullArticle ? "pa, a" : "a.number articleId, a.name title, a.updated date, a.workflowStatus workflowStatus, a.type type" )
. " FROM Newscoop\Entity\PlaylistArticle pa
JOIN pa.article a
WHERE pa.playlist = ?1 "
Expand Down

0 comments on commit fdbbc8c

Please sign in to comment.