[pLog-svn] r927 - in plog/trunk: . class/summary/action locale templates/admin templates/summary

oscar at devel.plogworld.net oscar at devel.plogworld.net
Wed Feb 2 19:38:01 GMT 2005


Author: oscar
Date: 2005-02-02 19:38:01 +0000 (Wed, 02 Feb 2005)
New Revision: 927

Added:
   plog/trunk/class/summary/action/summaryregistrationdisabledaction.class.php
Modified:
   plog/trunk/locale/locale_en_UK.php
   plog/trunk/summary.php
   plog/trunk/templates/admin/globalsettings_summary.template
   plog/trunk/templates/summary/message.template
Log:
implemented issue 196 (http://bugs.plogworld.net/view.php?id=196) -- please test and report!

Added: plog/trunk/class/summary/action/summaryregistrationdisabledaction.class.php
===================================================================
--- plog/trunk/class/summary/action/summaryregistrationdisabledaction.class.php	2005-02-02 13:31:09 UTC (rev 926)
+++ plog/trunk/class/summary/action/summaryregistrationdisabledaction.class.php	2005-02-02 19:38:01 UTC (rev 927)
@@ -0,0 +1,22 @@
+<?php
+	
+	include_once( PLOG_CLASS_PATH."class/summary/action/summaryaction.class.php" );
+	include_once( PLOG_CLASS_PATH."class/summary/view/summarymessageview.class.php" );
+
+	/**
+	 * a very stupid action that only shows a view with an error message, but it was easier
+	 * to do this than to modify all the registration actions to perform a check...
+	 *
+	 * @see SummaryAction
+	 * @see SummaryMessageView
+	 */
+	class SummaryRegistrationDisabledAction extends SummaryAction
+	{
+		function perform()
+		{
+			$this->_view = new SummaryMessageView();
+			$this->_view->setErrorMessage( $this->_locale->tr("error_registration_disabled"));
+			$this->setCommonData();
+		}
+	}
+?>
\ No newline at end of file

Modified: plog/trunk/locale/locale_en_UK.php
===================================================================
--- plog/trunk/locale/locale_en_UK.php	2005-02-02 13:31:09 UTC (rev 926)
+++ plog/trunk/locale/locale_en_UK.php	2005-02-02 19:38:01 UTC (rev 927)
@@ -699,6 +699,7 @@
 $messages['help_force_one_blog_per_email_account'] = 'Restrict to only one blog per email account';
 $messages['help_summary_show_agreement'] = 'Show and an agreement text and make users accept it before proceeding to the registration process';
 $messages['help_need_email_confirm_registration'] = 'Force users to confirm their registration by clicking a link embedded in an email sent to their account';
+$messages['help_summary_disable_registration'] = 'Whether users are allowed to register new blogs in this site';
 // templates
 $messages['help_template_folder'] = 'Folder where templates are stored';
 $messages['help_default_template'] = 'Default template for new blogs';
@@ -832,6 +833,7 @@
 $messages['register_blog_link'] = 'If you would like to take a look at your new blog, you can go there now: <a href="%2$s">%1$s</a>';
 $messages['register_blog_admin_link'] = 'If you prefer to start posting right away, please click to go to the <a href="admin.php">administration interface</a>';
 $messages['register_error'] = 'There was an error during the process';
+$messages['error_registration_disabled'] = 'Sorry, registration of new blogs in this site has been disabled';
 // registration article topic and text
 $messages['register_default_article_topic'] = 'Congratulations!';
 $messages['register_default_article_text'] = 'If you can read this post, it means that the registration process was successful and that you can start blogging';

Modified: plog/trunk/summary.php
===================================================================
--- plog/trunk/summary.php	2005-02-02 13:31:09 UTC (rev 926)
+++ plog/trunk/summary.php	2005-02-02 19:38:01 UTC (rev 927)
@@ -45,12 +45,23 @@
 	$_actionMap["UserProfile"] = "UserProfileAction";
 	$_actionMap["BlogProfile"] = "BlogProfileAction";
     $_actionMap["Faq"]           = "FaqAction";
-    $_actionMap["RegisterStep0"] = "doReadAgreement";
-    $_actionMap["RegisterStep1"] = "doUserRegister";
-    $_actionMap["RegisterStep2"] = "doUserCreation";
-    $_actionMap["RegisterStep3"] = "doBlogRegistration";
-    $_actionMap["RegisterStep4"] = "ChooseBlogTemplateAction";    
-    $_actionMap["RegisterStep5"] = "doFinishRegister";    
+	// conditional action registration... you've got to love this :)))
+	if( !$config->getValue( 'summary_disable_registration' )) {
+		$_actionMap["RegisterStep0"] = "doReadAgreement";
+		$_actionMap["RegisterStep1"] = "doUserRegister";
+		$_actionMap["RegisterStep2"] = "doUserCreation";
+		$_actionMap["RegisterStep3"] = "doBlogRegistration";
+		$_actionMap["RegisterStep4"] = "ChooseBlogTemplateAction";    
+		$_actionMap["RegisterStep5"] = "doFinishRegister";
+	}
+	else {
+		$_actionMap["RegisterStep0"] = "SummaryRegistrationDisabledAction";
+		$_actionMap["RegisterStep1"] = "SummaryRegistrationDisabledAction";
+		$_actionMap["RegisterStep2"] = "SummaryRegistrationDisabledAction";
+		$_actionMap["RegisterStep3"] = "SummaryRegistrationDisabledAction";
+		$_actionMap["RegisterStep4"] = "SummaryRegistrationDisabledAction";    
+		$_actionMap["RegisterStep5"] = "SummaryRegistrationDisabledAction";	
+	}
 	$_actionMap["resetPasswordForm"] = "SummaryShowResetPasswordForm";
 	$_actionMap["sendResetEmail"] = "SummarySendResetEmail";
 	$_actionMap["setNewPassword"] = "SummarySetNewPassword";

Modified: plog/trunk/templates/admin/globalsettings_summary.template
===================================================================
--- plog/trunk/templates/admin/globalsettings_summary.template	2005-02-02 13:31:09 UTC (rev 926)
+++ plog/trunk/templates/admin/globalsettings_summary.template	2005-02-02 19:38:01 UTC (rev 927)
@@ -13,7 +13,14 @@
     <label for="config[summary_blogs_per_page]">summary_blogs_per_page</label>
     <div class="formHelp">{$locale->tr("help_summary_blogs_per_page")}</div>
     <input style="width:100%" type="text" id="config[summary_blogs_per_page]" name="config[summary_blogs_per_page]" value="{$summary_blogs_per_page}"/>
-   </div>      
+   </div>
+   <!-- summary_disable_registration -->
+   <div class="field">
+    <label for="config[summary_disable_registration]">summary_disable_registration</label>
+	<div class="formHelp">{$locale->tr("help_summary_disable_registration")}</div>
+    <input class="radio" type="radio" id="config[summary_disable_registration]" name="config[summary_disable_registration]" value="1" {if $summary_disable_registration == 1 } checked="checked" {/if} />{$locale->tr("yes")}
+    <input class="radio" type="radio" id="config[summary_disable_registration]" name="config[summary_disable_registration]" value="0" {if $summary_disable_registration == 0 } checked="checked" {/if} />{$locale->tr("no")}
+   </div>
    <!-- forbidden_usernames -->
    <div class="field">
     <label for="config[forbidden_usernames]">forbidden_usernames</label>

Modified: plog/trunk/templates/summary/message.template
===================================================================
--- plog/trunk/templates/summary/message.template	2005-02-02 13:31:09 UTC (rev 926)
+++ plog/trunk/templates/summary/message.template	2005-02-02 19:38:01 UTC (rev 927)
@@ -1,5 +1,16 @@
 {include file="summary/header.template" section=$locale->tr("message")}
 <div id="onecolumn">
-{$viewSuccessMessage}
+{if $viewIsSuccess}
+<div id="FormInfo">
+  <img src="imgs/icon_info-16.png" alt="Info" class="InfoIcon" />
+  <p class="InfoText">{if $message==""}{$viewSuccessMessage}{else}{$message}{/if}</p>
 </div>
+{/if}
+{if $viewIsError}
+<div id="FormError">
+  <img src="imgs/icon_warning-16.png" alt="Info" class="InfoIcon" />
+  <p class="ErrorText">{if $message==""}{$viewErrorMessage}{else}{$message}{/if}</p>
+</div>
+{/if}
+</div>
 {include file="summary/footer.template"}
\ No newline at end of file




More information about the pLog-svn mailing list