Implement Dashboard into the core
Update-Notifier, future Entries, new comments so far
This commit is contained in:
parent
f2e39bf9be
commit
80a34b036d
@ -4,41 +4,40 @@ if (IN_serendipity !== true) {
|
||||
die ("Don't hack!");
|
||||
}
|
||||
|
||||
global $serendipity;
|
||||
|
||||
$user = serendipity_fetchAuthor($serendipity['authorid']);
|
||||
|
||||
// old s9y variant
|
||||
// $bookmarklet = "javascript:bm=document.selection?document.selection.createRange().text:document.getSelection();void(newwin=open('" . $serendipity['baseURL'] . "serendipity_admin.php?serendipity[adminModule]=entries&serendipity[adminAction]=new&serendipity[title]='+escape(document.title)+'&serendipity[body]='+escape(bm)+'&serendipity[url]='+escape(location.href),'new_log_entry','resizable=yes,scrollbars=yes,width=800,height=600,location=yes,status=yes'));newwin.focus();";
|
||||
|
||||
// non-popup variant
|
||||
$bookmarklet = "javascript:if(navigator.userAgent.indexOf('Safari')%20>=%200){Q=getSelection();}else{Q=document.selection?document.selection.createRange().text:document.getSelection();}location.href='" . $serendipity['baseURL'] . "'+encodeURIComponent(document.title)+'encodeURIComponent(Q)+''+encodeURIComponent(location.href)";
|
||||
|
||||
// chrome-compatible, from Oliver Gassner, adapted from TextPattern. Hi guys, keep it up. :-)
|
||||
$bookmarklet = "javascript:var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='" . $serendipity['baseURL'] . "',l=d.location,e=encodeURIComponent,p='serendipity_admin.php?serendipity[adminModule]=entries&serendipity[adminAction]=new&serendipity[title]='+e(d.title)+'&serendipity[body]='+e(s)+'&serendipity[url]='+location.href,u=f+p;a=function(){%20%20if(!w.open(u,'t','toolbar=0,resizable=1,scrollbars=1,status=1,width=800,height=800'))%20%20%20%20l.href=u;};if(/Firefox/.test(navigator.userAgent))%20%20setTimeout(a,0);else%20%20a();void(0)";
|
||||
|
||||
$output = array(
|
||||
'welcome' => WELCOME_BACK . ' ' . htmlspecialchars($user[0]['realname']),
|
||||
'show_links' => true,
|
||||
'links_title' => FURTHER_LINKS,
|
||||
'bookmarklet' => $bookmarklet,
|
||||
'links' => array(
|
||||
'<a href="http://www.s9y.org/">' . FURTHER_LINKS_S9Y . '</a>',
|
||||
'<a href="http://www.s9y.org/33.html">' . FURTHER_LINKS_S9Y_DOCS . '</a>',
|
||||
'<a href="http://blog.s9y.org/">' . FURTHER_LINKS_S9Y_BLOG . '</a>',
|
||||
'<a href="http://www.s9y.org/forums/">' . FURTHER_LINKS_S9Y_FORUMS . '</a>',
|
||||
'<a href="http://spartacus.s9y.org/">' . FURTHER_LINKS_S9Y_SPARTACUS . '</a>',
|
||||
'<a href="' . $bookmarklet . '" onclick="alert(\'' . FURTHER_LINKS_S9Y_BOOKMARKLET_DESC . '\'); return false;" title="' . FURTHER_LINKS_S9Y_BOOKMARKLET_DESC . '">' . FURTHER_LINKS_S9Y_BOOKMARKLET . '</a>'
|
||||
),
|
||||
'links_css' => 'further_links',
|
||||
'more' => ''
|
||||
$data = array();
|
||||
$data['bookmarklet'] = $bookmarklet;
|
||||
$data['username'] = $user[0]['realname'];
|
||||
|
||||
$output = array();
|
||||
serendipity_plugin_api::hook_event('backend_frontpage_display', $output);
|
||||
$data['backend_frontpage_display'] = $output['more'];
|
||||
|
||||
$data['curVersion'] = serendipity_getCurrentVersion();
|
||||
$data['usedVersion'] = $serendipity['version'];
|
||||
$data['update'] = version_compare($data['usedVersion'], $data['curVersion'], '<');
|
||||
|
||||
|
||||
$data['comments'] = serendipity_db_query("SELECT c.*, e.title FROM {$serendipity['dbPrefix']}comments c
|
||||
LEFT JOIN {$serendipity['dbPrefix']}entries e ON (e.id = c.entry_id)
|
||||
ORDER BY c.id DESC LIMIT 5");
|
||||
|
||||
$data['entries'] = serendipity_fetchEntries(
|
||||
false,
|
||||
false,
|
||||
5,
|
||||
true,
|
||||
false,
|
||||
'timestamp DESC',
|
||||
'e.timestamp >= ' . serendipity_serverOffsetHour()
|
||||
);
|
||||
|
||||
serendipity_plugin_api::hook_event('backend_frontpage_display', $output);
|
||||
|
||||
$data['output'] = $output;
|
||||
|
||||
if (!is_object($serendipity['smarty'])) {
|
||||
serendipity_smarty_init();
|
||||
}
|
||||
$data['token'] = serendipity_setFormToken('url');
|
||||
|
||||
echo serendipity_smarty_show('admin/overview.inc.tpl', $data);
|
||||
|
||||
|
@ -1195,4 +1195,22 @@ function serendipity_verifyFTPChecksums() {
|
||||
|
||||
return $badsums;
|
||||
}
|
||||
|
||||
function serendipity_getCurrentVersion() {
|
||||
$updateURL = 'https://raw.github.com/s9y/Serendipity/master/docs/RELEASE';
|
||||
|
||||
$file = fopen($updateURL, 'r');
|
||||
if (!$file) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (!feof($file)) {
|
||||
$line = fgets($file);
|
||||
|
||||
if (preg_match('/stable:(.+$)/', $line, $match)) {
|
||||
return $match[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* vim: set sts=4 ts=4 sw=4 expandtab : */
|
||||
|
@ -1,13 +1,88 @@
|
||||
<h2>{$output.welcome}</h2>
|
||||
{$output.more}
|
||||
{if $output.show_links}
|
||||
<aside class="{$output.links_css}">
|
||||
<h3>{$output.links_title}</h3>
|
||||
<h2>{$CONST.WELCOME_BACK} {$username|escape:"html"}</h2>
|
||||
|
||||
<aside id="further_links">
|
||||
<h3>{$CONST.FURTHER_LINKS}</h3>
|
||||
|
||||
<ul class="plainList">
|
||||
{foreach $output.links AS $link}
|
||||
<li>{$link}</li>
|
||||
{/foreach}
|
||||
<li><a href="http://www.s9y.org/">{$CONST.FURTHER_LINKS_S9Y}</a></li>
|
||||
<li><a href="http://www.s9y.org/33.html">{$CONST.FURTHER_LINKS_S9Y_DOCS}</a></li>
|
||||
<li><a href="http://blog.s9y.org/">{$CONST.FURTHER_LINKS_S9Y_BLOG}</a></li>
|
||||
<li><a href="http://www.s9y.org/forums/">{$CONST.FURTHER_LINKS_S9Y_FORUMS}</a></li>
|
||||
<li><a href="http://spartacus.s9y.org/">{$CONST.FURTHER_LINKS_S9Y_SPARTACUS}</a></li>
|
||||
<li>
|
||||
<a href="{$bookmarklet}" onclick="alert('{$CONST.FURTHER_LINKS_S9Y_BOOKMARKLET_DESC}'); return false;" title="{$CONST.FURTHER_LINKS_S9Y_BOOKMARKLET_DESC}">
|
||||
{$CONST.FURTHER_LINKS_S9Y_BOOKMARKLET}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</aside>
|
||||
|
||||
|
||||
{$backend_frontpage_display}
|
||||
|
||||
{if $update}
|
||||
<section id="dashboard_update" class="dashboard">
|
||||
<h4>UPDATER_TITLE</h4>
|
||||
New Version available: {$curVersion}
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
{if is_array($comments)}
|
||||
<section id="dashboard_comments" class="dashboard">
|
||||
<h4>{$CONST.COMMENTS}</h4>
|
||||
<ol>
|
||||
{foreach $comments as $comment}
|
||||
<li>
|
||||
{$comment.body}
|
||||
<ul class="plainList actions">
|
||||
{if ($comment.status == 'pending') || ($comment.status == 'confirm')}
|
||||
<li><a class="button_link" href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=approve&serendipity[id]={$comment.id}&{$token}" title="{$CONST.APPROVE}"><span class="icon-lock-open"></span><span class="visuallyhidden">{$CONST.APPROVE}</span></a></li>
|
||||
{/if}
|
||||
{if ($comment.status == 'approved')}
|
||||
<li><a class="button_link" href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=pending&serendipity[id]={$comment.id}&{$token}" title="{$CONST.SET_TO_MODERATED}"><span class="icon-lock"></span><span class="visuallyhidden"> {$CONST.SET_TO_MODERATED}</span></a></li>
|
||||
{/if}
|
||||
{if $comment.excerpt}
|
||||
<li><a class="button_link toggle_comment_full" href="#c{$comment.id}_full" title="{$CONST.TOGGLE_ALL}"><span class="icon-plus"></span><span class="visuallyhidden"> {$CONST.TOGGLE_ALL}</span></a></li>
|
||||
{/if}
|
||||
<li><a class="button_link" href="{$comment.entrylink}" title="{$CONST.VIEW}"><span class="icon-eye"></span><span class="visuallyhidden"> {$CONST.VIEW}</span></a></li>
|
||||
<li><a class="button_link" href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=edit&serendipity[id]={$comment.id}&serendipity[entry_id]={$comment.entry_id}&{$token}" title="{$CONST.EDIT}"><span class="icon-edit"></span><span class="visuallyhidden"> {$CONST.EDIT}</span></a></li>
|
||||
<li><a class="button_link comments_delete" href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=delete&serendipity[id]={$comment.id}&serendipity[entry_id]={$comment.entry_id}&{$token}" data-delmsg='{($CONST.COMMENT_DELETE_CONFIRM|sprintf:$comment.id:$comment.author)|escape}' title="{$CONST.DELETE}"><span class="icon-trash"></span><span class="visuallyhidden"> {$CONST.DELETE}</span></a></li>
|
||||
<li><a class="button_link comments_reply" href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=reply&serendipity[id]={$comment.id}&serendipity[entry_id]={$comment.entry_id}&serendipity[noBanner]=true&serendipity[noSidebar]=true&{$token}" title="{$CONST.REPLY}"><span class="icon-chat"></span><span class="visuallyhidden"> {$CONST.REPLY}</span></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ol>
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
{if is_array($entries)}
|
||||
<section id="dashboard_entries" class="dashboard">
|
||||
<h4>Future Entries</h4>
|
||||
<ol>
|
||||
{foreach $entries as $entry}
|
||||
<li>
|
||||
{$entry.title}
|
||||
<ul class="plainList actions">
|
||||
<li>
|
||||
<a class="button_link" href="?serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=preview&{$token}&serendipity[id]={$entry.id}" title="{$CONST.PREVIEW} #{$entry.id}">
|
||||
<span class="icon-eye"></span>
|
||||
<span class="visuallyhidden">
|
||||
{$CONST.PREVIEW}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="button_link" href="?serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=edit&serendipity[id]={$entry.id}" title="{$CONST.EDIT} #{$entry.id}">
|
||||
<span class="icon-edit"></span>
|
||||
<span class="visuallyhidden">
|
||||
{$CONST.EDIT}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ol>
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
|
@ -1541,6 +1541,10 @@ form > .button_link:first-of-type {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#further_links {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* FOOTER
|
||||
----------------------------------------------------------------- */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user