[geeklog-cvs] geeklog: Display the number of stories in the current topic in t...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Oct 3 15:18:36 EDT 2009


details:   http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/566b2b4b5535
changeset: 7353:566b2b4b5535
user:      Dirk Haun <dirk at haun-online.de>
date:      Sat Oct 03 20:40:08 2009 +0200
description:
Display the number of stories in the current topic in the Topic Editor (feature request #0000806)

diffstat:

 language/english.php                                          |   3 +-
 language/english_utf-8.php                                    |   3 +-
 public_html/admin/topic.php                                   |  35 +++++++++--
 public_html/docs/english/theme.html                           |   3 +
 public_html/docs/history                                      |   2 +
 public_html/layout/professional/admin/topic/topiceditor.thtml |   4 +
 6 files changed, 41 insertions(+), 9 deletions(-)

diffs (124 lines):

diff -r 7db76f494446 -r 566b2b4b5535 language/english.php
--- a/language/english.php	Sat Oct 03 19:34:59 2009 +0200
+++ b/language/english.php	Sat Oct 03 20:40:08 2009 +0200
@@ -863,7 +863,8 @@
     26 => 'make this the default topic for archived stories. Only one topic allowed.',
     27 => 'Or Upload Topic Icon',
     28 => 'Maximum',
-    29 => 'File Upload Errors'
+    29 => 'File Upload Errors',
+    30 => 'Stories in Topic'
 );
 
 ###############################################################################
diff -r 7db76f494446 -r 566b2b4b5535 language/english_utf-8.php
--- a/language/english_utf-8.php	Sat Oct 03 19:34:59 2009 +0200
+++ b/language/english_utf-8.php	Sat Oct 03 20:40:08 2009 +0200
@@ -863,7 +863,8 @@
     26 => 'make this the default topic for archived stories. Only one topic allowed.',
     27 => 'Or Upload Topic Icon',
     28 => 'Maximum',
-    29 => 'File Upload Errors'
+    29 => 'File Upload Errors',
+    30 => 'Stories in Topic'
 );
 
 ###############################################################################
diff -r 7db76f494446 -r 566b2b4b5535 public_html/admin/topic.php
--- a/public_html/admin/topic.php	Sat Oct 03 19:34:59 2009 +0200
+++ b/public_html/admin/topic.php	Sat Oct 03 20:40:08 2009 +0200
@@ -174,10 +174,20 @@
     $topic_templates->set_var('max_url_length', 255);
     $topic_templates->set_var('image_url', $A['imageurl']);
 
-    $topic_templates->set_var('lang_metadescription', $LANG_ADMIN['meta_description']);
-    $topic_templates->set_var('meta_description', stripslashes($A['meta_description']));
-    $topic_templates->set_var('lang_metakeywords', $LANG_ADMIN['meta_keywords']);
-    $topic_templates->set_var('meta_keywords', stripslashes($A['meta_keywords']));
+    $topic_templates->set_var('lang_metadescription',
+                              $LANG_ADMIN['meta_description']);
+    $topic_templates->set_var('lang_metakeywords',
+                              $LANG_ADMIN['meta_keywords']);
+    $desc = '';
+    if (! empty($A['meta_description'])) {
+        $desc = $A['meta_description'];
+    }
+    $keywords = '';
+    if (! empty($A['meta_keywords'])) {
+        $keywords = $A['meta_keywords'];
+    }
+    $topic_templates->set_var('meta_description', $desc);
+    $topic_templates->set_var('meta_keywords', $keywords);
 
     $topic_templates->set_var ('lang_defaulttopic', $LANG27[22]);
     $topic_templates->set_var ('lang_defaulttext', $LANG27[23]);
@@ -199,6 +209,17 @@
             $topic_templates->set_var ('archive_disabled', 'disabled');
         }
     }
+
+    if (empty($tid)) {
+        $num_stories = $LANG_ADMIN['na'];
+    } else {
+        $nresult = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['stories']} WHERE tid = '" . addslashes($tid) . "'" . COM_getPermSql('AND'));
+        $N = DB_fetchArray( $nresult );
+        $num_stories = $N['count'];
+    }
+
+    $topic_templates->set_var('lang_num_stories', $LANG27[30]);
+    $topic_templates->set_var('num_stories', $num_stories);
     $topic_templates->set_var('gltoken_name', CSRF_TOKEN);
     $topic_templates->set_var('gltoken', SEC_createToken());
     $topic_templates->parse('output', 'editor');
@@ -259,9 +280,9 @@
         if ($imageurl == '/images/topics/') {
             $imageurl = '';
         }
-        $topic = addslashes ($topic);
-        $meta_description = addslashes ($meta_description);
-        $meta_keywords = addslashes ($meta_keywords);
+        $topic = addslashes($topic);
+        $meta_description = addslashes(strip_tags($meta_description));
+        $meta_keywords = addslashes(strip_tags($meta_keywords));
 
         if ($is_default == 'on') {
             $is_default = 1;
diff -r 7db76f494446 -r 566b2b4b5535 public_html/docs/english/theme.html
--- a/public_html/docs/english/theme.html	Sat Oct 03 19:34:59 2009 +0200
+++ b/public_html/docs/english/theme.html	Sat Oct 03 20:40:08 2009 +0200
@@ -198,6 +198,9 @@
 <h2><a name="changes">Theme changes in Geeklog 1.6.1</a></h2>
 
 <ul>
+<li>The Topic Editor now contains a line displaying the number of stories in
+    the current topic. New variables in <tt>admin/topic/topiceditor.thtml</tt>:
+    <code>{lang_num_stories}</code>, <code>{num_stories}</tt></li>
 <li>Cosmetics: Fixed the position of the story preview when using the
     advanced editor (was slightly shifted to the right, <a
     href="http://project.geeklog.net/tracking/view.php?id=963">bug #0000963</a>). Changes to the <code><div id="preview"></code> in
diff -r 7db76f494446 -r 566b2b4b5535 public_html/docs/history
--- a/public_html/docs/history	Sat Oct 03 19:34:59 2009 +0200
+++ b/public_html/docs/history	Sat Oct 03 20:40:08 2009 +0200
@@ -3,6 +3,8 @@
 Oct ??, 2009 (1.6.1)
 ------------
 
+- Display the number of stories in the current topic in the Topic Editor
+  (feature request #0000806) [Dirk]
 - Call CUSTOM_userCheck from admin/user.php (bug #0000925) [Dirk]
 - You can now have one featured story per topic (feature request #0000750,
   patch provided by Tom Homer)
diff -r 7db76f494446 -r 566b2b4b5535 public_html/layout/professional/admin/topic/topiceditor.thtml
--- a/public_html/layout/professional/admin/topic/topiceditor.thtml	Sat Oct 03 19:34:59 2009 +0200
+++ b/public_html/layout/professional/admin/topic/topiceditor.thtml	Sat Oct 03 20:40:08 2009 +0200
@@ -41,6 +41,10 @@
                                         <td><input type="checkbox" name="is_archive" {archive_checked} {archive_disabled}{xhtml}> ({lang_archivetext})</td>
                                     </tr>
                                     <tr>
+                                        <td class="alignright">{lang_num_stories}:</td>
+                                        <td>{num_stories}</td>
+                                    </tr>
+                                    <tr>
                                         <td colspan="2"><hr{xhtml}></td>
                                     </tr>
                                     <tr>



More information about the geeklog-cvs mailing list