[pLog-svn] r6903 - in plugins/branches/lifetype-1.2/submissions: . class/action class/view locale templates
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Wed Jun 17 12:28:12 EDT 2009
Author: jondaley
Date: 2009-06-17 12:28:11 -0400 (Wed, 17 Jun 2009)
New Revision: 6903
Modified:
plugins/branches/lifetype-1.2/submissions/class/action/addsubmissionaction.class.php
plugins/branches/lifetype-1.2/submissions/class/action/adminsubmissionspluginupdatesettingsaction.class.php
plugins/branches/lifetype-1.2/submissions/class/action/showsubmissionformaction.class.php
plugins/branches/lifetype-1.2/submissions/class/view/adminsubmissionspluginsettingsview.class.php
plugins/branches/lifetype-1.2/submissions/locale/locale_en_UK.php
plugins/branches/lifetype-1.2/submissions/pluginsubmissions.class.php
plugins/branches/lifetype-1.2/submissions/templates/pluginsettings.template
plugins/branches/lifetype-1.2/submissions/templates/submitform.template
Log:
added a checkbox to make the user type in something in the name field (of course, they can just type in 'junk' or 'spammer', but a user requested it...
Modified: plugins/branches/lifetype-1.2/submissions/class/action/addsubmissionaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/submissions/class/action/addsubmissionaction.class.php 2009-06-17 15:47:41 UTC (rev 6902)
+++ plugins/branches/lifetype-1.2/submissions/class/action/addsubmissionaction.class.php 2009-06-17 16:28:11 UTC (rev 6903)
@@ -45,6 +45,13 @@
$this->_userName = $userName;
}
}
+ else{
+ $blogSettings = $this->_blogInfo->getSettings();
+ if($blogSettings->getValue( "plugin_submissions_name_required", false )){
+ $errors["submissionUserName"] = true;
+ $message["submissionUserName"] = $this->_locale->tr("error_submission_no_name");
+ }
+ }
$userEmailAddress = $this->_request->getValue( "userEmailAddress" );
if($userEmailAddress){
if( !$val1->validate( $userEmailAddress )) {
@@ -93,7 +100,8 @@
}
if( $errors ) {
- $this->_view = new PluginTemplatedView( $this->_blogInfo, "submissions", "submitform", SMARTY_VIEW_CACHE_DISABLED );
+ $this->_view = new PluginTemplatedView( $this->_blogInfo, "submissions", "submitform",
+ SMARTY_VIEW_CACHE_DISABLED );
$this->_view->setValue( "userName", $this->_userName );
$this->_view->setValue( "userEmailAddress", $this->_userEmailAddress );
$this->_view->setValue( "submissionTopic", $this->_topic );
@@ -101,6 +109,9 @@
$this->_view->setValue( "submissionCategories", $this->_categoryIds );
$this->_view->setValue( "message", $message );
$this->_view->setValue( "errors", $errors );
+ $blogSettings = $this->_blogInfo->getSettings();
+ $this->_view->setValue( "nameRequired",
+ $blogSettings->getValue( "plugin_submissions_name_required", false ));
$this->setCommonData();
return false;
Modified: plugins/branches/lifetype-1.2/submissions/class/action/adminsubmissionspluginupdatesettingsaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/submissions/class/action/adminsubmissionspluginupdatesettingsaction.class.php 2009-06-17 15:47:41 UTC (rev 6902)
+++ plugins/branches/lifetype-1.2/submissions/class/action/adminsubmissionspluginupdatesettingsaction.class.php 2009-06-17 16:28:11 UTC (rev 6903)
@@ -12,6 +12,7 @@
var $_pluginEnabled;
var $_htmlareaEnabled;
var $_notificationsEnabled;
+ var $_nameRequired;
/**
* Constructor. If nothing else, it also has to call the constructor of the parent
@@ -35,6 +36,9 @@
$this->_notificationsEnabled = $this->_request->getValue( "notificationsEnabled" );
$this->_notificationsEnabled = ($this->_notificationsEnabled != "" );
+ $this->_nameRequired = $this->_request->getValue( "nameRequired" );
+ $this->_nameRequired = ($this->_nameRequired != "" );
+
return true;
}
@@ -115,6 +119,7 @@
// update the plugin configurations to blog setting
$blogSettings = $this->_blogInfo->getSettings();
$blogSettings->setValue( "plugin_submissions_enabled", $this->_pluginEnabled );
+ $blogSettings->setValue( "plugin_submissions_name_required", $this->_nameRequired );
$blogSettings->setValue( "plugin_submissions_htmlarea_enabled", $this->_htmlareaEnabled );
$blogSettings->setValue( "plugin_submissions_notifications_enabled", $this->_notificationsEnabled );
$this->_blogInfo->setSettings( $blogSettings );
Modified: plugins/branches/lifetype-1.2/submissions/class/action/showsubmissionformaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/submissions/class/action/showsubmissionformaction.class.php 2009-06-17 15:47:41 UTC (rev 6902)
+++ plugins/branches/lifetype-1.2/submissions/class/action/showsubmissionformaction.class.php 2009-06-17 16:28:11 UTC (rev 6903)
@@ -33,6 +33,9 @@
$this->_view = new PluginTemplatedView($this->_blogInfo, "submissions", "submitform",
SMARTY_VIEW_CACHE_CHECK, array("categoryId" => $this->_categoryId));
$this->_view->setValue("categoryId", $this->_categoryId);
+ $blogSettings = $this->_blogInfo->getSettings();
+ $this->_view->setValue( "nameRequired",
+ $blogSettings->getValue( "plugin_submissions_name_required", false ));
$this->setCommonData();
return true;
Modified: plugins/branches/lifetype-1.2/submissions/class/view/adminsubmissionspluginsettingsview.class.php
===================================================================
--- plugins/branches/lifetype-1.2/submissions/class/view/adminsubmissionspluginsettingsview.class.php 2009-06-17 15:47:41 UTC (rev 6902)
+++ plugins/branches/lifetype-1.2/submissions/class/view/adminsubmissionspluginsettingsview.class.php 2009-06-17 16:28:11 UTC (rev 6903)
@@ -20,11 +20,13 @@
$pluginEnabled = $blogSettings->getValue( "plugin_submissions_enabled" );
$htmlareaEnabled = $blogSettings->getValue( "plugin_submissions_htmlarea_enabled" );
$notificationsEnabled = $blogSettings->getValue( "plugin_submissions_notifications_enabled" );
+ $nameRequired = $blogSettings->getValue( "plugin_submissions_name_required", false );
// create a view and export the settings to the template
$this->setValue( "pluginEnabled", $pluginEnabled );
$this->setValue( "htmlareaEnabled", $htmlareaEnabled );
$this->setValue( "notificationsEnabled", $notificationsEnabled );
+ $this->setValue( "nameRequired", $nameRequired );
parent::render();
}
Modified: plugins/branches/lifetype-1.2/submissions/locale/locale_en_UK.php
===================================================================
--- plugins/branches/lifetype-1.2/submissions/locale/locale_en_UK.php 2009-06-17 15:47:41 UTC (rev 6902)
+++ plugins/branches/lifetype-1.2/submissions/locale/locale_en_UK.php 2009-06-17 16:28:11 UTC (rev 6903)
@@ -7,9 +7,11 @@
$messages["submissions_htmlarea_enabled"] = "Enable the built-in visual editor of HTML code";
$messages["submissions_settings_saved_ok"] = "Submissions settings saved successfully!";
+$messages["submissions_name_required"] = "Require at least 'something' to be typed into the name field.";
$messages["error_submissions_not_enabled"] = "Please enable the Submissions plugin first.";
$messages["error_submission_no_topic"] = "Topic should not be empty.";
$messages["error_submission_no_text"] = "Content should not be empty.";
+$messages["error_submission_no_name"] = "This site requires you to enter your name (or enter Anonymous).";
$messages["error_submission_no_category"] = "You need to select at least one or more article categories.";
$messages["submission_accepted_ok"] = "Thank you, your submission was successful!";
@@ -18,8 +20,10 @@
$messages["label_configuration"] = "Configuration";
$messages["label_enable"] = "Enable";
$messages["label_htmlarea_enabled"] = "Enable Editor";
+$messages["label_name_required"] = "Require a Name";
-$messages["your_name"] = "Your Name (Optional): ";
+$messages["your_name"] = "Your Name: ";
+$messages["your_name_optional"] = "Your Name (Optional): ";
$messages["your_email_address"] = "Your Email Address (Optional): ";
$messages["story_topic"] = "Your Topic: ";
$messages["story_contents"] = "Your Content: ";
Modified: plugins/branches/lifetype-1.2/submissions/pluginsubmissions.class.php
===================================================================
--- plugins/branches/lifetype-1.2/submissions/pluginsubmissions.class.php 2009-06-17 15:47:41 UTC (rev 6902)
+++ plugins/branches/lifetype-1.2/submissions/pluginsubmissions.class.php 2009-06-17 16:28:11 UTC (rev 6903)
@@ -17,7 +17,7 @@
$this->id = "submissions";
$this->desc = "Allows visitors to submit stories to the blog.";
$this->author = "The LifeType Project";
- $this->version = "20090612";
+ $this->version = "20090617";
if( $source == "admin" )
$this->initAdmin();
@@ -92,6 +92,8 @@
Array("name" => "plugin_submissions_htmlarea_enabled",
"type" => "boolean"),
Array("name" => "plugin_submissions_notifications_enabled",
+ "type" => "boolean"),
+ Array("name" => "plugin_submissions_require_name",
"type" => "boolean")
));
}
Modified: plugins/branches/lifetype-1.2/submissions/templates/pluginsettings.template
===================================================================
--- plugins/branches/lifetype-1.2/submissions/templates/pluginsettings.template 2009-06-17 15:47:41 UTC (rev 6902)
+++ plugins/branches/lifetype-1.2/submissions/templates/pluginsettings.template 2009-06-17 16:28:11 UTC (rev 6903)
@@ -41,6 +41,17 @@
</div>
</div>
+ <div class="field">
+ <label for="nameRequired">{$locale->tr("label_name_required")}</label>
+ <span class="required"></span>
+ <div class="formHelp">
+ <input class="checkbox" type="checkbox" name="nameRequired" id="nameRequired" {if $nameRequired} checked="checked" {/if}
+ {user_cannot_override
+ key=plugin_submissions_name_required}disabled="disabled"
+ {/user_cannot_override}
+ value="1" />{$locale->tr("submissions_name_required")}
+ </div>
+ </div>
</fieldset>
Modified: plugins/branches/lifetype-1.2/submissions/templates/submitform.template
===================================================================
--- plugins/branches/lifetype-1.2/submissions/templates/submitform.template 2009-06-17 15:47:41 UTC (rev 6902)
+++ plugins/branches/lifetype-1.2/submissions/templates/submitform.template 2009-06-17 16:28:11 UTC (rev 6903)
@@ -14,7 +14,13 @@
</p>
{/if}
<form name="submission" method="post" action="{$url->getIndexUrl()}">
- <label for="userName" style="text-align:left">{$locale->tr("your_name")}</label>
+ <label for="userName" style="text-align:left">
+ {if $nameRequired}
+ {$locale->tr("your_name")}
+ {else}
+ {$locale->tr("your_name_optional")}
+ {/if}
+ </label>
<input type="text" name="userName" value="{$userName}" style="width:100%" /><br/>
{if $errors.submissionUserName}<span style="background:red;color:white;font-weight:bold"> ! </span> {$message.submissionUserName}</p><br/>{/if}
More information about the pLog-svn
mailing list