[geeklog-cvs] geeklog: Display a message when no topics exist and don't let th...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sun Nov 16 11:40:08 EST 2008


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/c81141899488
changeset: 6473:c81141899488
user:      Dirk Haun <dirk at haun-online.de>
date:      Sun Nov 16 17:39:54 2008 +0100
description:
Display a message when no topics exist and don't let the user enter the story editors (bug #0000738)

diffstat:

9 files changed, 55 insertions(+), 16 deletions(-)
language/english.php             |    3 ++-
language/english_utf-8.php       |    3 ++-
language/german.php              |    6 +++++-
language/german_formal.php       |    6 +++++-
language/german_formal_utf-8.php |    6 +++++-
language/german_utf-8.php        |    6 +++++-
public_html/admin/story.php      |   21 +++++++++++++++++----
public_html/docs/history         |    2 ++
public_html/submit.php           |   18 ++++++++++++------

diffs (205 lines):

diff -r b89f8ccd00fe -r c81141899488 language/english.php
--- a/language/english.php	Sun Nov 16 17:17:28 2008 +0100
+++ b/language/english.php	Sun Nov 16 17:39:54 2008 +0100
@@ -1202,7 +1202,8 @@
     97 => 'Not all required fields have been passed validation - default custom membership message',
     98 => 'The plugin was successfully uploaded.',
     99 => 'The plugin already exists.',
-    100 => 'The plugin file you uploaded was not a GZip or Zip compressed archive.'
+    100 => 'The plugin file you uploaded was not a GZip or Zip compressed archive.',
+    101 => 'There are no topics (that you have access to). You need at least one topic to be able to submit stories.'
 );
 
 ###############################################################################
diff -r b89f8ccd00fe -r c81141899488 language/english_utf-8.php
--- a/language/english_utf-8.php	Sun Nov 16 17:17:28 2008 +0100
+++ b/language/english_utf-8.php	Sun Nov 16 17:39:54 2008 +0100
@@ -1202,7 +1202,8 @@
     97 => 'Not all required fields have been passed validation - default custom membership message',
     98 => 'The plugin was successfully uploaded.',
     99 => 'The plugin already exists.',
-    100 => 'The plugin file you uploaded was not a GZip or Zip compressed archive.'
+    100 => 'The plugin file you uploaded was not a GZip or Zip compressed archive.',
+    101 => 'There are no topics (that you have access to). You need at least one topic to be able to submit stories.'
 );
 
 ###############################################################################
diff -r b89f8ccd00fe -r c81141899488 language/german.php
--- a/language/german.php	Sun Nov 16 17:17:28 2008 +0100
+++ b/language/german.php	Sun Nov 16 17:39:54 2008 +0100
@@ -1184,7 +1184,11 @@
     94 => 'Backup Failed: Dateigröße unter 1kb',
     95 => 'Es gab einen Fehler.',
     96 => 'Sorry, kein Zugang zur Admin-Seite. Unzulässige Zugangsversuche werden gelogged.',
-    97 => 'Not all required fields have been passed validation - default custom membership message'
+    97 => 'Not all required fields have been passed validation - default custom membership message',
+    98 => 'The plugin was successfully uploaded.',
+    99 => 'The plugin already exists.',
+    100 => 'The plugin file you uploaded was not a GZip or Zip compressed archive.',
+    101 => 'There are no topics (that you have access to). You need at least one topic to be able to submit stories.'
 );
 
 ###############################################################################
diff -r b89f8ccd00fe -r c81141899488 language/german_formal.php
--- a/language/german_formal.php	Sun Nov 16 17:17:28 2008 +0100
+++ b/language/german_formal.php	Sun Nov 16 17:39:54 2008 +0100
@@ -1185,7 +1185,11 @@
     94 => 'Backup Failed: Dateigröße unter 1kb',
     95 => 'Es gab einen Fehler.',
     96 => 'Sorry, kein Zugang zur Admin-Seite. Unzulässige Zugangsversuche werden gelogged.',
-    97 => 'Not all required fields have been passed validation - default custom membership message'
+    97 => 'Not all required fields have been passed validation - default custom membership message',
+    98 => 'The plugin was successfully uploaded.',
+    99 => 'The plugin already exists.',
+    100 => 'The plugin file you uploaded was not a GZip or Zip compressed archive.',
+    101 => 'There are no topics (that you have access to). You need at least one topic to be able to submit stories.'
 );
 
 ###############################################################################
diff -r b89f8ccd00fe -r c81141899488 language/german_formal_utf-8.php
--- a/language/german_formal_utf-8.php	Sun Nov 16 17:17:28 2008 +0100
+++ b/language/german_formal_utf-8.php	Sun Nov 16 17:39:54 2008 +0100
@@ -1185,7 +1185,11 @@
     94 => 'Backup Failed: Dateigröße unter 1kb',
     95 => 'Es gab einen Fehler.',
     96 => 'Sorry, kein Zugang zur Admin-Seite. Unzulässige Zugangsversuche werden gelogged.',
-    97 => 'Not all required fields have been passed validation - default custom membership message'
+    97 => 'Not all required fields have been passed validation - default custom membership message',
+    98 => 'The plugin was successfully uploaded.',
+    99 => 'The plugin already exists.',
+    100 => 'The plugin file you uploaded was not a GZip or Zip compressed archive.',
+    101 => 'There are no topics (that you have access to). You need at least one topic to be able to submit stories.'
 );
 
 ###############################################################################
diff -r b89f8ccd00fe -r c81141899488 language/german_utf-8.php
--- a/language/german_utf-8.php	Sun Nov 16 17:17:28 2008 +0100
+++ b/language/german_utf-8.php	Sun Nov 16 17:39:54 2008 +0100
@@ -1184,7 +1184,11 @@
     94 => 'Backup Failed: Dateigröße unter 1kb',
     95 => 'Es gab einen Fehler.',
     96 => 'Sorry, kein Zugang zur Admin-Seite. Unzulässige Zugangsversuche werden gelogged.',
-    97 => 'Not all required fields have been passed validation - default custom membership message'
+    97 => 'Not all required fields have been passed validation - default custom membership message',
+    98 => 'The plugin was successfully uploaded.',
+    99 => 'The plugin already exists.',
+    100 => 'The plugin file you uploaded was not a GZip or Zip compressed archive.',
+    101 => 'There are no topics (that you have access to). You need at least one topic to be able to submit stories.'
 );
 
 ###############################################################################
diff -r b89f8ccd00fe -r c81141899488 public_html/admin/story.php
--- a/public_html/admin/story.php	Sun Nov 16 17:17:28 2008 +0100
+++ b/public_html/admin/story.php	Sun Nov 16 17:39:54 2008 +0100
@@ -143,10 +143,17 @@
                 $seltopics .= '>' . $T['topic'] . '</option>' . LB;
             }
             $excludetopics .= ') ';
+        } else {
+            $retval .= COM_showMessage(101);
+            return $retval;
         }
     } else {
         $excludetopics = " tid = '$current_topic' ";
         $seltopics = COM_topicList ('tid,topic', $current_topic, 1, true);
+        if (empty($seltopics)) {
+            $retval .= COM_showMessage(101);
+            return $retval;
+        }
     }
 
     $alltopics = '<option value="' .$LANG09[9]. '"';
@@ -370,8 +377,6 @@
         $story_templates->set_var ('navbar', $navbar->generate() );
     }
 
-    $display .= COM_startBlock ($LANG24[5], '',
-                        COM_getBlockTemplate ('_admin_block', 'header'));
     $oldsid = $story->EditElements('originalSid');
     if (!empty ($oldsid)) {
         $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete']
@@ -517,8 +522,13 @@
     } elseif ($story->EditElements('tid') == '') {
         $story->setTid($currenttopic);
     }
-    $story_templates->set_var ('topic_options',
-                               COM_topicList ('tid,topic', $story->EditElements('tid'), 1, true));
+
+    $tlist = COM_topicList('tid,topic', $story->EditElements('tid'), 1, true);
+    if (empty($tlist)) {
+        $display .= COM_showMessage(101);
+        return $display;
+    }
+    $story_templates->set_var('topic_options', $tlist);
     $story_templates->set_var('lang_show_topic_icon', $LANG24[56]);
     if ($story->EditElements('show_topic_icon') == 1) {
         $story_templates->set_var('show_topic_icon_checked', 'checked="checked"');
@@ -633,6 +643,9 @@
     $story_templates->set_var('gltoken_name', CSRF_TOKEN);
     $story_templates->set_var('gltoken', SEC_createToken());
     $story_templates->parse('output','editor');
+
+    $display .= COM_startBlock ($LANG24[5], '',
+                        COM_getBlockTemplate ('_admin_block', 'header'));
     $display .= $story_templates->finish($story_templates->get_var('output'));
     $display .= COM_endBlock (COM_getBlockTemplate ('_admin_block', 'footer'));
 
diff -r b89f8ccd00fe -r c81141899488 public_html/docs/history
--- a/public_html/docs/history	Sun Nov 16 17:17:28 2008 +0100
+++ b/public_html/docs/history	Sun Nov 16 17:39:54 2008 +0100
@@ -3,6 +3,8 @@
 ??? ??, 2008 (1.5.2)
 ------------
 
+- Display a message when no topics exist and don't let the user enter the story
+  editors (bug #0000738) [Dirk]
 - Improved image quality when using gdlib to rescale images. Also added a
   configuration option to control the JPEG quality (Feature request #0000720)
   [Dirk]
diff -r b89f8ccd00fe -r c81141899488 public_html/submit.php
--- a/public_html/submit.php	Sun Nov 16 17:17:28 2008 +0100
+++ b/public_html/submit.php	Sun Nov 16 17:39:54 2008 +0100
@@ -135,8 +135,6 @@
         $story->initSubmission($topic);
     }
 
-    $retval .= COM_startBlock($LANG12[6],'submitstory.html');
-
     $storyform = new Template($_CONF['path_layout'] . 'submit');
     if (isset ($_CONF['advanced_editor']) && ($_CONF['advanced_editor'] == 1) &&
         file_exists ($_CONF['path_layout'] . 'submit/submitstory_advanced.thtml')) {
@@ -194,7 +192,12 @@
     $storyform->set_var('story_title', $story->EditElements('title'));
     $storyform->set_var('lang_topic', $LANG12[28]);
 
-    $storyform->set_var('story_topic_options', COM_topicList('tid,topic',$story->EditElements('tid')));
+    $tlist = COM_topicList('tid,topic', $story->EditElements('tid'));
+    if (empty($tlist)) {
+        $retval .= COM_showMessage(101);
+        return $retval;
+    }
+    $storyform->set_var('story_topic_options', $tlist);
     $storyform->set_var('lang_story', $LANG12[29]);
     $storyform->set_var('lang_introtext', $LANG12[54]);
     $storyform->set_var('lang_bodytext', $LANG12[55]);
@@ -206,14 +209,17 @@
     $storyform->set_var('story_uid', $story->EditElements('uid'));
     $storyform->set_var('story_sid', $story->EditElements('sid'));
     $storyform->set_var('story_date', $story->EditElements('unixdate'));
+    $storyform->set_var('lang_preview', $LANG12[32]);
 
     if (($_CONF['skip_preview'] == 1) ||
             (isset($_POST['mode']) && ($_POST['mode'] == $LANG12[32]))) {
-        PLG_templateSetVars ('story', $storyform);
-        $storyform->set_var('save_button', '<input name="mode" type="submit" value="' . $LANG12[8] . '"' . XHTML . '>');
+        PLG_templateSetVars('story', $storyform);
+        $storyform->set_var('save_button',
+                            '<input name="mode" type="submit" value="'
+                            . $LANG12[8] . '"' . XHTML . '>');
     }
 
-    $storyform->set_var('lang_preview', $LANG12[32]);
+    $retval .= COM_startBlock($LANG12[6],'submitstory.html');
     $storyform->parse('theform', 'storyform');
     $retval .= $storyform->finish($storyform->get_var('theform'));
     $retval .= COM_endBlock();



More information about the geeklog-cvs mailing list