Enables NoWhereMan's statistics panel

Fixes #241 and enables NoWhereMan's statistics panel
This commit is contained in:
Fraenkiman 2023-05-07 15:23:40 +02:00
parent e779dcd348
commit af5c77e166
13 changed files with 348 additions and 195 deletions

View File

@ -24,7 +24,7 @@
'commedit' => false, 'commedit' => false,
'delete' => false, 'delete' => false,
'cats' => true, 'cats' => true,
'stats' => false 'stats' => true
); );
var $defaultaction = 'list'; var $defaultaction = 'list';

View File

@ -30,7 +30,7 @@
function setup() { function setup() {
global $lang; global $lang;
$lang ['admin'] ['entry'] ['stats'] = array(); $lang ['admin'] ['entry'] ['stats'] = array();
$this->smarty->assign('warnings', '[Dev Notice] Panel lang strings are currently hardcoded.'); // $this->smarty->assign('warnings', '[Dev Notice] Panel lang strings are currently hardcoded.');
} }
function main() { function main() {
@ -62,11 +62,9 @@
list($id, $e) = $q->getEntry(); list($id, $e) = $q->getEntry();
$entries ['count'] ++; $entries ['count'] ++;
$entries['words'] += str_word_count($e['subject']) + $entries ['words'] += str_word_count($e ['subject']) + str_word_count($e ['content']);
str_word_count($e['content']);
$entries['chars'] += strlen($e['subject']) + $entries ['chars'] += strlen($e ['subject']) + strlen($e ['content']);
strlen($e['content']);
$entries ['size'] += filesize(entry_exists($id)); $entries ['size'] += filesize(entry_exists($id));

View File

@ -1,29 +1,25 @@
<h2>{"Statistics"}</h2> <h2>{$panelstrings.head}</h2>
{include file='shared:errorlist.tpl'} {include file="shared:errorlist.tpl"}
<h3>{"Entries"}</h3> <h3>{$panelstrings.entries}</h3>
{"<p>You have <strong>%s</strong> <p>{$panelstrings.you_have} <strong>{"%s"|sprintf:$entries.count}</strong>
entries using <strong>%s</strong> characters {$panelstrings.entries_using} <strong>{"%s"|sprintf:$entries.chars}</strong> {$panelstrings.characters_in} <strong>{"%s"|sprintf:$entries.words}</strong> {$panelstrings.words}.</p>
in <strong>%s</strong> words.</p> <p>{$panelstrings.total_disk_space_is} <strong>{"%s"|sprintf:$entries.size}</strong>.</p>
<p>Total disk space is
<strong>%s</strong>.</p>"|sprintf:$entries.count:$entries.chars:$entries.words:$entries.size}
<h3>{"Comments"}</h3> <h3>{$panelstrings.comments}</h3>
{"<p>You have <strong>%s</strong> <p>{$panelstrings.you_have} <strong>{"%s"|sprintf:$comments.count}</strong>
comments using <strong>%s</strong> characters {$panelstrings.comments_using} <strong>{"%s"|sprintf:$comments.chars}</strong> {$panelstrings.characters_in} <strong>{"%s"|sprintf:$comments.words}</strong> {$panelstrings.words}.</p>
in <strong>%s</strong> words.</p> <p>{$panelstrings.total_disk_space_is} <strong>{"%s"|sprintf:$comments.size}</strong>.</p>
<p>Total disk space is
<strong>%s</strong>.</p>"|sprintf:$comments.count:$comments.chars:$comments.words:$comments.size}
{if $entries.topten} {if $entries.topten}
<h3> {$entries.topten|@count} {"most commented entries"} </h3> <h3>{$panelstrings.the} {$entries.topten|@count} {$panelstrings.most_commented_entries} </h3>
<ol> <ol>
{foreach from=$entries.topten key=id item=this_entry} {foreach from=$entries.topten key=id item=this_entry}
<li><a href="{$id|link:post_link}">{$this_entry.subject}</a> ({$this_entry.comments})</li> <li><a href="{$panel_url|action_link:commentlist}&amp;entry={$id}">{$this_entry.subject}</a> ({$this_entry.comments})</li>
{/foreach} {/foreach}
</ol> </ol>

View File

@ -2,7 +2,8 @@
$lang ['admin'] ['entry'] ['submenu'] = array( $lang ['admin'] ['entry'] ['submenu'] = array(
'list' => 'Spravovat příspěvky', 'list' => 'Spravovat příspěvky',
'write' => 'Přidat nový příspěvek', 'write' => 'Přidat nový příspěvek',
'cats' => 'Spravovat kategorie' 'cats' => 'Manage Categories',
'stats' => 'Statistiky'
); );
/* default action */ /* default action */
@ -152,4 +153,18 @@ Různé :5
-3 => 'ID kategorií musí být KLADNÉ!!' -3 => 'ID kategorií musí být KLADNÉ!!'
); );
/* stats */
$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Statistiky',
'entries' => 'Záznamy',
'you_have' => 'Máte',
'entries_using' => 'záznamů s',
'characters_in' => 'znaky v',
'words' => 'slovech',
'total_disk_space_is' => 'Celkový prostor v paměti je',
'comments' => 'Komentáře',
'comments_using' => 'komentářů s',
'the' => '',
'most_commented_entries' => 'nejkomentovanější příspěvky'
);
?> ?>

View File

@ -2,7 +2,8 @@
$lang ['admin'] ['entry'] ['submenu'] = array( $lang ['admin'] ['entry'] ['submenu'] = array(
'list' => 'Beiträge verwalten', 'list' => 'Beiträge verwalten',
'write' => 'Beitrag schreiben', 'write' => 'Beitrag schreiben',
'cats' => 'Kategorien verwalten' 'cats' => 'Kategorien verwalten',
'stats' => 'Statiskiken'
); );
/* default action */ /* default action */
@ -152,4 +153,19 @@ $lang ['admin'] ['entry'] ['cats'] ['msgs'] = array(
-3 => 'Die Kategorie ID <strong>muss größer als 0 sein</strong>. Der Wert <strong>0</strong> ist nicht erlaubt.' -3 => 'Die Kategorie ID <strong>muss größer als 0 sein</strong>. Der Wert <strong>0</strong> ist nicht erlaubt.'
); );
/* stats */
$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Statistiken',
'entries' => 'Beiträge',
'you_have' => 'Du hast',
'entries_using' => 'Beiträge mit',
'characters_in' => 'Zeichen in',
'words' => 'Wörtern',
'total_disk_space_is' => 'Der gesamte Speicherplatz beträgt',
'comments' => 'Kommentare',
'comments_using' => 'Kommentare mit',
'the' => 'Die',
'most_commented_entries' => 'meist kommentierten Beiträge'
);
?> ?>

View File

@ -2,7 +2,8 @@
$lang ['admin'] ['entry'] ['submenu'] = array( $lang ['admin'] ['entry'] ['submenu'] = array(
'list' => 'Διαχείριση καταχωρήσεων', 'list' => 'Διαχείριση καταχωρήσεων',
'write' => 'Δημιουργία καταχώρησης', 'write' => 'Δημιουργία καταχώρησης',
'cats' => 'Διαχείριση κατηγοριών' 'cats' => 'Διαχείριση κατηγοριών',
'stats' => 'Στατιστική'
); );
/* default action */ /* default action */
@ -155,4 +156,19 @@ $lang ['admin'] ['entry'] ['cats'] ['msgs'] = array(
-3 => 'Τα IDs των κατηγοριών πρέπει να είναι οπωσδήποτε θετικά (το 0 δεν επιτρέπεται)' -3 => 'Τα IDs των κατηγοριών πρέπει να είναι οπωσδήποτε θετικά (το 0 δεν επιτρέπεται)'
); );
/* stats */
$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Στατιστική',
'entries' => 'Ενδείξεις',
'you_have' => 'Έχετε',
'entries_using' => 'καταχωρήσεις με',
'characters_in' => 'χαρακτήρες',
'words' => 'λέξεις',
'total_disk_space_is' => 'Ο συνολικός χώρος αποθήκευσης είναι',
'comments' => 'Σχόλια',
'comments_using' => 'σχόλια με',
'the' => 'Οι',
'most_commented_entries' => 'πιο σχολιασμένες αναρτήσεις'
);
?> ?>

View File

@ -2,7 +2,8 @@
$lang ['admin'] ['entry'] ['submenu'] = array( $lang ['admin'] ['entry'] ['submenu'] = array(
'list' => 'Manage Entries', 'list' => 'Manage Entries',
'write' => 'Write Entry', 'write' => 'Write Entry',
'cats' => 'Manage Categories' 'cats' => 'Manage Categories',
'stats' => 'Stats'
); );
/* default action */ /* default action */
@ -155,4 +156,19 @@ $lang ['admin'] ['entry'] ['cats'] ['msgs'] = array(
-3 => 'Category IDs must be strictly positive (0 is not allowed)' -3 => 'Category IDs must be strictly positive (0 is not allowed)'
); );
/* stats */
$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Stats',
'entries' => 'Entries',
'you_have' => 'You have',
'entries_using' => 'entries using',
'characters_in' => 'characters in',
'words' => 'words',
'total_disk_space_is' => 'Total disk space is',
'comments' => 'Comments',
'comments_using' => 'comments using',
'the' => 'The',
'most_commented_entries' => 'most commented entries'
);
?> ?>

View File

@ -2,7 +2,8 @@
$lang ['admin'] ['entry'] ['submenu'] = array( $lang ['admin'] ['entry'] ['submenu'] = array(
'list' => 'Administrar entradas', 'list' => 'Administrar entradas',
'write' => 'Escribir entrada', 'write' => 'Escribir entrada',
'cats' => 'Administrar Categorías' 'cats' => 'Administrar Categorías',
'stats' => 'Estadísticas'
); );
/* default action */ /* default action */
@ -155,4 +156,19 @@ $lang ['admin'] ['entry'] ['cats'] ['msgs'] = array(
-3 => 'Los ID de categoría deben ser estrictamente positivos (0 is not allowed)' -3 => 'Los ID de categoría deben ser estrictamente positivos (0 is not allowed)'
); );
/* stats */
$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Estadísticas',
'entries' => 'Entradas',
'you_have' => 'Tiene',
'entries_using' => 'entradas con',
'characters_in' => 'caracteres en',
'words' => 'palabras',
'total_disk_space_is' => 'El espacio de almacenamiento total es de',
'comments' => 'Comentarios',
'comments_using' => 'comentarios con',
'the' => 'Las',
'most_commented_entries' => 'entradas más comentadas'
);
?> ?>

View File

@ -2,7 +2,8 @@
$lang ['admin'] ['entry'] ['submenu'] = array( $lang ['admin'] ['entry'] ['submenu'] = array(
'list' => 'G&eacute;rer les billets', 'list' => 'G&eacute;rer les billets',
'write' => '&Eacute;crire un billet', 'write' => '&Eacute;crire un billet',
'cats' => 'G&eacute;rer les cat&eacute;gories' 'cats' => 'G&eacute;rer les cat&eacute;gories',
'stats' => 'Statistiques'
); );
/* action par défaut */ /* action par défaut */
@ -152,4 +153,19 @@ $lang ['admin'] ['entry'] ['cats'] ['msgs'] = array(
-3 => 'Le num&eacute;ro de cat&eacute;gorie doit &ecirc;tre positif (0 pas permis)' -3 => 'Le num&eacute;ro de cat&eacute;gorie doit &ecirc;tre positif (0 pas permis)'
); );
/* stats */
$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Statistiques',
'entries' => 'Entrées',
'you_have' => 'Tu as',
'entries_using' => 'entrées avec',
'characters_in' => 'caractères dans',
'words' => 'mots',
'total_disk_space_is' => 'L\'espace mémoire total est de',
'comments' => 'Commentaires',
'comments_using' => 'commentaires avec',
'the' => 'Les',
'most_commented_entries' => 'entrées les plus commentées'
);
?> ?>

View File

@ -2,7 +2,8 @@
$lang ['admin'] ['entry'] ['submenu'] = array( $lang ['admin'] ['entry'] ['submenu'] = array(
'list' => 'Gestione Articoli', 'list' => 'Gestione Articoli',
'write' => 'Scrivi Articolo', 'write' => 'Scrivi Articolo',
'cats' => 'Gestione Categorie' 'cats' => 'Gestione Categorie',
'stats' => 'Statistica'
); );
/* default action */ /* default action */
@ -155,4 +156,19 @@ $lang ['admin'] ['entry'] ['cats'] ['msgs'] = array(
-3 => 'Gli ID delle categorie devono essere assolutamente positivi (lo 0 non è consentito)' -3 => 'Gli ID delle categorie devono essere assolutamente positivi (lo 0 non è consentito)'
); );
/* stats */
$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Statistica',
'entries' => 'Entrate',
'you_have' => 'Hai',
'entries_using' => 'voci con',
'characters_in' => 'caratteri in',
'words' => 'parole',
'total_disk_space_is' => 'Lo spazio di archiviazione totale è di',
'comments' => 'Commenti',
'comments_using' => 'commenti con',
'the' => 'Le',
'most_commented_entries' => 'voci più commentate'
);
?> ?>

View File

@ -2,7 +2,8 @@
$lang ['admin'] ['entry'] ['submenu'] = array( $lang ['admin'] ['entry'] ['submenu'] = array(
'list' => '記事の管理', 'list' => '記事の管理',
'write' => '記事の作成', 'write' => '記事の作成',
'cats' => '記事カテゴリの管理' 'cats' => '記事カテゴリの管理',
'stats' => '統計情報'
); );
/* default action */ /* default action */
@ -152,4 +153,19 @@ $lang ['admin'] ['entry'] ['cats'] ['msgs'] = array(
-3 => 'Category IDs must be strictly positive (0 is not allowed)' -3 => 'Category IDs must be strictly positive (0 is not allowed)'
); );
/* stats */
$lang ['admin'] ['entry'] ['stats'] = array(
'head' => '統計情報',
'entries' => 'エントリー',
'you_have' => '',
'entries_using' => '件、',
'characters_in' => '文字、',
'words' => '語。',
'total_disk_space_is' => '総収納容量は',
'comments' => 'コメント',
'comments_using' => '件',
'the' => 'コメント数が多かった',
'most_commented_entries' => '作品'
);
?> ?>

View File

@ -2,7 +2,8 @@
$lang ['admin'] ['entry'] ['submenu'] = array( $lang ['admin'] ['entry'] ['submenu'] = array(
'list' => 'Vermeldingen beheren', 'list' => 'Vermeldingen beheren',
'write' => 'Schrijf vermelding', 'write' => 'Schrijf vermelding',
'cats' => 'Categorie beheren' 'cats' => 'Categorie beheren',
'stats' => 'Statistieken'
); );
/* default action */ /* default action */
@ -155,4 +156,19 @@ $lang ['admin'] ['entry'] ['cats'] ['msgs'] = array(
-3 => 'Categorie ID moeten strikt positief zijn (0 is niet toegestaan)' -3 => 'Categorie ID moeten strikt positief zijn (0 is niet toegestaan)'
); );
/* stats */
$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Statistieken',
'entries' => 'Vermeldingen',
'you_have' => 'Je hebt',
'entries_using' => 'berichten met',
'characters_in' => 'tekens in',
'words' => 'woorden',
'total_disk_space_is' => 'De totale opslagruimte is',
'comments' => 'Reacties',
'comments_using' => 'reacties met',
'the' => 'De',
'most_commented_entries' => 'meest becommentarieerde inzendingen'
);
?> ?>

View File

@ -3,7 +3,8 @@
$lang ['admin'] ['entry'] ['submenu'] = array( $lang ['admin'] ['entry'] ['submenu'] = array(
'list' => 'Lista de posts', 'list' => 'Lista de posts',
'write' => 'Criar um post', 'write' => 'Criar um post',
'cats' => 'Administrar as categorias' 'cats' => 'Administrar as categorias',
'stats' => 'Estatísticas'
); );
/* default action */ /* default action */
@ -153,4 +154,19 @@ $lang ['admin'] ['entry'] ['cats'] ['msgs'] = array(
-3 => 'Os IDs da categoria devem ser apenas positivos. (0 não é permitido.)' -3 => 'Os IDs da categoria devem ser apenas positivos. (0 não é permitido.)'
); );
/* stats */
$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Estatísticas',
'entries' => 'Entradas',
'you_have' => 'Você tem',
'entries_using' => 'entradas com',
'characters_in' => 'caracteres em',
'words' => 'palavras',
'total_disk_space_is' => 'O espaço total de armazenamento é de',
'comments' => 'Comentários',
'comments_using' => 'comentários com',
'the' => 'As',
'most_commented_entries' => 'entradas mais comentadas'
);
?> ?>