Better Submit and Edit Link pages

Register an Account
Pligg Chat Room
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-04-2008, 12:46 PM
AnAlienHolakres3's Avatar
Pligg Donor/Coder
 
Join Date: Jul 2007
Location: Prague
Posts: 116
Send a message via ICQ to AnAlienHolakres3
Hello guys,
many of you have realized that users are lazy and their story description,tags or summary are very short and often incorrect. Most of (my) users do not use summary, moreover some of them are confused of that.

This modification&addon solve following situation:

- short link titles
- a few link tags
- short link description
- confusing summary


First thing need to be done is to disable summary in your Pligg Admin panel so go to Pligg configuration,Summary and disable editing of summary. We wont need that anymore.

No problem,right? The second thing what is needed is open following 3 files:
- lang.conf //libs folder
- submit_step_2.tpl //templates/template folder
- editlink_edit_center.tpl //templates/template folder

First of all it is important to understand that if we dont want users to use summary box we definitely want them to use description box. Description box can now contain both description and summary.

Find and do some modification in lang.conf file:
PLIGG_Visual_Submit2_Description = "Description & Summary"
PLIGG_Visual_Submit2_DescInstruct = "Write your link description. You can also add your summary."

OK now we have to modify 2 following files. The modification is the same so I will show only one of them.

Replace original code in editlink_edit_center.tpl at the beginning {literal}...something...{/literal} with:
Code:
{literal}
<script type="text/javascript">
  function SetState(obj_checkbox, obj_textarea)
  {  if(obj_checkbox.checked)
     { obj_textarea.disabled = false;
     }
     else
     { obj_textarea.disabled = true;
     }
  }
    function textCounter(field, countfield, minlimit,maxlimit) {
    var remaining=0;
        if (field.value.length > maxlimit) {// if too long...trim it!
            field.value = field.value.substring(0, maxlimit);
            alert("max reached");
            // otherwise, update 'characters left' counter
        }else{ 
             remaining= minlimit - field.value.length;    
      
      if (remaining <= 0 ){
         document.getElementById('needchar').style.display="none";
         document.getElementById('chargood').style.display="";
         countfield.style.background="#CCFF66";
         countfield.value="OK";
      
             
      }
      
      if   (remaining >= 0 ){
            document.getElementById('needchar').style.display="";
            document.getElementById('chargood').style.display="none";
            countfield.style.background="#FFEAEA";
            countfield.value = remaining+1;
           
           }
        }       
    }
        function isOK(field,needchar,needwords,okobject,badobject,separator){
        if (separator==1) {
        var a = field.value.split(/\s+/g); // split the sentence into an array of words
        }else{
        var a = field.value.split(","); // split the sentence into an array of words
        }
        
            required = needchar - field.value.length;
            if (required > 0 || a.length < needwords){
             okobject.style.display="none";
             badobject.style.display="";
            }else {
             okobject.style.display="";
             badobject.style.display="none";
            }
       
        }
        function getNeededCount(field,needchar) {
        
            required = needchar - field.value.length;
            if (required <=0) {
                required ="OK";
                 document.getElementById('needchar').style.display="none";
                 document.getElementById('chargood').style.display="";
                 document.getElementById('TextCount').style.background="#CCFF66";
            
            }
            return required;
    }    
</script>
{/literal}
Thats the required javascript code with some added functions. Now find
<input type="text" id="title" name="title" value="{$submit_title}" size="60" maxlength="120" /> and replace with:
Code:
        <input type="text" id="title" name="title" value="{$submit_title}" size="60" maxlength="120" 
         onmouseout="isOK(this.form.title,15,2,document.getElementById('goodtitle'),document.getElementById('badtitle'),1);"
         onkeydown="isOK(this.form.title,15,2,document.getElementById('goodtitle'),document.getElementById('badtitle'),1);" />
         <span id = "goodtitle" style="display:none;color:green;font-weight:bold">OK</span>
         <span id="badtitle" style="display:none;color:#de0808;font-weight:bold">Please add longer title</span>
That was the title section. Please note that isOK() function has 2 number parameters you can change. The first one has default value 15 and it means that link title must be at least 15 characters long. The second one 2 means that title must have at least two words. So if you want you can change that (dont forget to change all isOK() functions).

Next section is for tags find:
{if $enable_tags eq 'true'}...something...{/if} and replace with:
Code:
        {if $enable_tags eq 'true'}                                                                       
            <label>{#PLIGG_Visual_Submit2_Tags#}:</label>
            <span>{#PLIGG_Visual_Submit2_Tags_Inst1#} {#PLIGG_Visual_Submit2_Tags_Example#} <em>{#PLIGG_Visual_Submit2_Tags_Inst2#}</em></span><br />
            <input type="text" id="tags" name="tags" value="{$tags_words}" size="60" maxlength="120" 
            onmouseout="isOK(this.form.tags,20,4,document.getElementById('goodtag'),document.getElementById('badtag'),2);"
            onkeydown="isOK(this.form.tags,20,4,document.getElementById('goodtag'),document.getElementById('badtag'),2);" />
            <span id = "goodtag" style="display:none;color:green;font-weight:bold">OK</span>
            <span id="badtag" style="display:none;color:#de0808;font-weight:bold">Please add more tags</span>
        {/if}
As you can see there is also isOK() function - default values are at least 20 characters and 4 tags.

Following section is description section we have already talked about.Find <label>{#PLIGG_Visual_Submit2_Description#} and end of this section which is defined by <br /><br />.
Replace all this code with:
Code:
        <label>{#PLIGG_Visual_Submit2_Description#}</label><span>{#PLIGG_Visual_Submit2_DescInstruct#}</span> 
            {if $Story_Content_Tags_To_Allow eq ""}
                <br /><b>{#PLIGG_Visual_Submit2_No_HTMLTagsAllowed#}</b> {#PLIGG_Visual_Submit2_HTMLTagsAllowed#}
            {else}
                <br /><span style="font-size:8pt;color:darkgrey">{#PLIGG_Visual_Submit2_HTMLTagsAllowed#}: {$Story_Content_Tags_To_Allow}</span>
                
            {/if}                                           
        <br /><textarea name="bodytext" rows="10" cols="60" id="bodytext"  onKeyDown="textCounter(this.form.bodytext,this.form.TextCount,60,3000);"
        onmouseout="textCounter(this.form.bodytext,this.form.TextCount,60,3000);">{$submit_content}</textarea><br />
    <input readonly id="TextCount" type=text name=TextCount size=3 maxlength=3 value="" style="background:#FFEAEA;border:1px solid grey;padding-left:3px"> 
    
    <span id="needchar">more characters required.</span>
    <span id="chargood" style="display:none">Minimal length is all right.</span>
    
    <script type="text/javascript">
    document.getElementById('TextCount').value=getNeededCount(document.getElementById('bodytext'),60);
    </script>    
    
        <br /><br />
There is a function textCounter(), 60 (+1) is minimal characters count,3000 is maximum char count. You are welcome to change that.

Example of result looks like this:


Now go to admin panel,configure Pligg,submit and change minimum title length(default 15) and minimum story length(default 60) to desired value which is specified in our files.

The last thing. As you can see on Published page or on Upcoming page descriptions are sometimes much longer than 61 chars (or your default value). In this case it is reasonable to use "read more" link. On the other hand if link has quite short description there is no need to have it.

I recommend to follow these instructions: http://forums.pligg.com/pligg-tutori...more-link.html

Thats all what is need to be done
Reply With Quote
  #2 (permalink)  
Old 01-04-2008, 10:21 PM
Banned
Pligg Version: 9.8.
Pligg Template: Custom
 
Join Date: Feb 2007
Location: Canada
Posts: 796
Does this effect the RSS Importer?

Geoserv.
Reply With Quote
  #3 (permalink)  
Old 01-05-2008, 04:00 AM
AnAlienHolakres3's Avatar
Pligg Donor/Coder
 
Join Date: Jul 2007
Location: Prague
Posts: 116
Send a message via ICQ to AnAlienHolakres3
Quote:
Originally Posted by Geoserv View Post
Does this effect the RSS Importer?

Geoserv.
Not directly, description will be longer...
Reply With Quote
  #4 (permalink)  
Old 07-24-2008, 08:44 AM
New Pligger
Pligg Version: 9.9
Pligg Template: default
 
Join Date: Jan 2008
Posts: 2
Hi you say the editing in the two files are the same, but i can't find any of the code to replace in submit_step_2.tpl Please advise! Thanks!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to edit 'Submit New Story' text Four20 Questions and Comments 3 01-22-2009 10:49 AM
Edit link bug cucat Questions and Comments 2 01-21-2009 06:58 PM
Link to Story after or during Submit dattard Questions and Comments 1 12-31-2007 03:27 AM
Every edit link adds line breaks renep Questions and Comments 4 01-24-2007 08:09 AM
Edit link form action="" revolver Questions and Comments 4 01-23-2007 11:30 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development