[pLog-svn] r6901 - in plugins/branches/lifetype-1.2/submissions: . class/action templates

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Fri Jun 12 17:19:43 EDT 2009


Author: jondaley
Date: 2009-06-12 17:19:43 -0400 (Fri, 12 Jun 2009)
New Revision: 6901

Modified:
   plugins/branches/lifetype-1.2/submissions/class/action/showsubmissionformaction.class.php
   plugins/branches/lifetype-1.2/submissions/pluginsubmissions.class.php
   plugins/branches/lifetype-1.2/submissions/readme.txt
   plugins/branches/lifetype-1.2/submissions/templates/submitform.template
Log:
fixed a stylesheet issue, where the float made the parent div stop (and so the background color was weird).  Also allow the category id to be specified in the URL

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-12 21:17:51 UTC (rev 6900)
+++ plugins/branches/lifetype-1.2/submissions/class/action/showsubmissionformaction.class.php	2009-06-12 21:19:43 UTC (rev 6901)
@@ -2,6 +2,7 @@
 
     lt_include( PLOG_CLASS_PATH."class/action/blogaction.class.php" );
     lt_include( PLOG_CLASS_PATH."class/view/plugintemplatedview.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
     
     /**
      * shows the form that will be used to submit an article to the blog, 
@@ -9,15 +10,29 @@
      */
     class ShowSubmissionFormAction extends BlogAction
     {
-    
+        var $_categoryId;
+        
         function ShowSubmissionFormAction( $actionInfo, $request )
         {
             $this->BlogAction( $actionInfo, $request );
         }
+
+        function validate(){
+            $this->_categoryId = $this->_request->getValue( "categoryId" );
+            if($this->_categoryId){
+                $intv = new IntegerValidator();
+                if(!$intv->validate($this->_categoryId)){
+                    $this->_categoryId = "";
+                }
+            }
+            return true;
+        }
         
         function perform()
         {
-            $this->_view = new PluginTemplatedView( $this->_blogInfo, "submissions", "submitform" );
+            $this->_view = new PluginTemplatedView($this->_blogInfo, "submissions", "submitform",
+                                                   SMARTY_VIEW_CACHE_CHECK, array("categoryId" => $this->_categoryId));
+            $this->_view->setValue("categoryId", $this->_categoryId);
             $this->setCommonData();
             
             return true;

Modified: plugins/branches/lifetype-1.2/submissions/pluginsubmissions.class.php
===================================================================
--- plugins/branches/lifetype-1.2/submissions/pluginsubmissions.class.php	2009-06-12 21:17:51 UTC (rev 6900)
+++ plugins/branches/lifetype-1.2/submissions/pluginsubmissions.class.php	2009-06-12 21:19:43 UTC (rev 6901)
@@ -69,14 +69,16 @@
 	        return $this->notificationsEnabled;
 	    }
 
-        function pluginTemplatePage()
+        function pluginTemplatePage($categoryId = "")
         {
             lt_include( PLOG_CLASS_PATH."class/net/rawrequestgenerator.class.php" );	
  			$rg = new RawRequestGenerator($this->blogInfo);
             
         	$rg->addParameter( "op", "submissionForm" );
             $rg->addParameter( "blogId", $this->blogInfo->getId());
-
+            if($categoryId)
+                $rg->addParameter( "categoryId", $categoryId);
+            
             $templatePage = $rg->getIndexUrl().$rg->getRequest();
 
             return $templatePage;

Modified: plugins/branches/lifetype-1.2/submissions/readme.txt
===================================================================
--- plugins/branches/lifetype-1.2/submissions/readme.txt	2009-06-12 21:17:51 UTC (rev 6900)
+++ plugins/branches/lifetype-1.2/submissions/readme.txt	2009-06-12 21:19:43 UTC (rev 6901)
@@ -8,5 +8,16 @@
 Install:
 2. Configure and enable the Submissions plugin in your LifeType control center
 3. Use {$submissions->pluginTemplatePage()} in your template to get the url to the submissions page
+3a. You can put a categoryId in the function to get a link to a
+    submission page with the category already selected like this:
+   {$submissions->pluginTemplatePage(1)} or perhaps:
+   {$submissions->pluginTemplatePage($myCategory->getId())}
 
 
+The posted username and email address will be added to these custom fields:
+ submittedBy and submittedAddress
+Add them to your template if you want them to appear on the public
+ side of the blog.
+
+
+

Modified: plugins/branches/lifetype-1.2/submissions/templates/submitform.template
===================================================================
--- plugins/branches/lifetype-1.2/submissions/templates/submitform.template	2009-06-12 21:17:51 UTC (rev 6900)
+++ plugins/branches/lifetype-1.2/submissions/templates/submitform.template	2009-06-12 21:19:43 UTC (rev 6901)
@@ -34,23 +34,29 @@
   <textarea rows="15" id="submissionText" name="submissionText" style="width:100%">{$submissionText}</textarea><br/>
   {if $errors.submissionText}<span style="background:red;color:white;font-weight:bold">&nbsp;!&nbsp;</span>&nbsp;{$message.submissionText}</p><br/>{/if}
   <br/>
+
+  <div width:100%">
+   <input type="hidden" name="op" value="submitStory" />
+   <input type="hidden" name="blogId" value="{$blog->getId()}" />
+   <input style="margin-bottom: 10px" type="submit" name="{$locale->tr("submit_story")}" value="{$locale->tr("submit_story")}" />
+  </div>
+
  </div>
  
  <div style="width:29%;float:right;height:100%">
   {$locale->tr("categories")}<br/>
   <select name="submissionCategory[]" multiple="multiple" style="width:100%" size="15">
   {foreach from=$articlecategories item=category}
-    <option value="{$category->getId()}">{$category->getName()}</option>
+    <option {if $categoryId == $category->getId()}selected{/if} value="{$category->getId()}">{$category->getName()}</option>
   {/foreach}
   </select>
   {if $errors.submissionCategory}<span style="background:red;color:white;font-weight:bold">&nbsp;!&nbsp;</span>&nbsp;{$message.submissionCategory}</p><br/>{/if}  
  </div> 
+
+  <br style="clear: both" />
+
  </div>
- <div style="float:left;width:100%">
- <input type="hidden" name="op" value="submitStory" />
- <input type="hidden" name="blogId" value="{$blog->getId()}" />
- <input type="submit" name="{$locale->tr("submit_story")}" value="{$locale->tr("submit_story")}" />
- </div>
+
 </form>
  {else}
   {$locale->tr("error_submissions_not_enabled")}



More information about the pLog-svn mailing list