Ignore:
Timestamp:
Dec 21, 2013, 5:33:24 PM (10 years ago)
Author:
mistic100
Message:

update for Piwigo 2.6 + code clean

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/GuestBook/template/guestbook.tpl

    r25786 r26065  
    1 {combine_css path=$GUESTBOOK_PATH|@cat:"template/style.css"}
    2 {combine_script id="livevalidation" load="footer" path=$GUESTBOOK_PATH|@cat:"template/livevalidation.min.js"}
     1{combine_css path=$GUESTBOOK_PATH|cat:'template/style.css'}
     2{combine_script id='livevalidation' load='footer' path=$GUESTBOOK_PATH|cat:'template/livevalidation.min.js'}
    33
    44{footer_script require='jquery,livevalidation'}
    5 {if !$comment_add.IS_LOGGED}
    6 var author = new LiveValidation('author', {ldelim} onlyOnSubmit: true });
    7 author.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter your username'|@translate}" });
    8 {/if}
     5(function() {
     6  {if !$comment_add.IS_LOGGED}
     7  var author = new LiveValidation('author', {ldelim} onlyOnSubmit: true });
     8  author.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter your username'|translate}" });
     9  {/if}
    910
    10 {if $comment_add.EMAIL_MANDATORY and (!$comment_add.IS_LOGGED or empty($comment_add.EMAIL))}
    11 var email = new LiveValidation('email', {ldelim} onlyOnSubmit: true });
    12 email.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter your e-mail'|@translate}" });
    13 email.add(Validate.Email, {ldelim} failureMessage: "{'mail address must be like xxx@yyy.eee (example : jack@altern.org)'|@translate}" });
    14 {/if}
     11  {if $comment_add.EMAIL_MANDATORY and (!$comment_add.IS_LOGGED or empty($comment_add.EMAIL))}
     12  var email = new LiveValidation('email', {ldelim} onlyOnSubmit: true });
     13  email.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter your e-mail'|translate}" });
     14  email.add(Validate.Email, {ldelim} failureMessage: "{'mail address must be like xxx@yyy.eee (example : jack@altern.org)'|translate}" });
     15  {/if}
    1516
    16 var website = new LiveValidation('website', {ldelim} onlyOnSubmit: true });
    17 website.add(Validate.Format, {ldelim} pattern: /^https?:\/\/[^\s\/$.?#].[^\s]*$/i,
    18   failureMessage: "{'invalid website address'|@translate}"});
     17  var website = new LiveValidation('website', {ldelim} onlyOnSubmit: true });
     18  website.add(Validate.Format, {ldelim} pattern: /^https?:\/\/[^\s\/$.?#].[^\s]*$/i,
     19    failureMessage: "{'invalid website address'|translate}"});
    1920
    20 var content = new LiveValidation('contentid', {ldelim} onlyOnSubmit: true });
    21 content.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a message'|@translate}" });
     21  var content = new LiveValidation('contentid', {ldelim} onlyOnSubmit: true });
     22  content.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a message'|translate}" });
    2223 
    23 jQuery("#addComment").hide();
    24 jQuery("#guestbookAdd").css('width','180px');
    25 jQuery("#expandForm").click(function() {ldelim}
    26   jQuery("#guestbookAdd").animate({ldelim}"width": "550px"}, function() {ldelim}
    27     jQuery("#expandForm").slideUp();
    28     jQuery("#addComment").slideDown("slow");
     24  {if !isset($GB_OPEN)}
     25  jQuery('#addComment').hide();
     26  jQuery('#guestbookAdd').css('width', '180px');
     27  jQuery('#expandForm').click(function() {ldelim}
     28    jQuery('#guestbookAdd').animate({ldelim}'width': '550px'}, function() {ldelim}
     29      jQuery('#expandForm').slideUp();
     30      jQuery('#addComment').slideDown('slow');
     31    });
    2932  });
    30 });
     33  {/if}
    3134
    32 jQuery("#website").on('blur', function() {ldelim}
    33   var val = $(this).val();
    34   if (val.substr(0, 4) != 'http') {ldelim}
    35     $(this).val('http://'+ val);
    36   }
    37 });
     35  jQuery('#website').on('blur', function() {ldelim}
     36    var val = $(this).val();
     37    if (val.substr(0, 4) != 'http') {ldelim}
     38      $(this).val('http://'+ val);
     39    }
     40  });
     41}());
    3842{/footer_script}
    3943
    4044{if $comment_add.ACTIVATE_RATING}
    41   {combine_script id="jquery.raty" path=$GUESTBOOK_PATH|@cat:"template/jquery.raty/jquery.raty.min.js"}
     45  {combine_script id='jquery.raty' path=$GUESTBOOK_PATH|cat:'template/jquery.raty/jquery.raty.min.js'}
    4246  {footer_script}
    43   jQuery("#comment_rate").raty({ldelim}
    44     path: "{$ROOT_URL}{$GUESTBOOK_PATH}template/jquery.raty/",
     47  jQuery('#comment_rate').raty({ldelim}
     48    path: '{$ROOT_URL}{$GUESTBOOK_PATH}template/jquery.raty/',
    4549    half: true
    4650  });
     
    4953
    5054
    51 {* <!-- Menubar & titrePage --> *}
    52 {if $themeconf.name == "stripped" or $themeconf.parent == "stripped"}
    53   {include file=$ABS_GUESTBOOK_PATH|@cat:'template/themes/stripped.tpl'}
    54   {assign var="clear" value="true"}
    55 {elseif $themeconf.name == "simple-grey" or $themeconf.parent == "simple"}
    56   {include file=$ABS_GUESTBOOK_PATH|@cat:'template/themes/simple.tpl'}
    57   {assign var="clear" value="true"}
    58 {else}
    59   {include file=$ABS_GUESTBOOK_PATH|@cat:'template/themes/default.tpl'}
    60 {/if}
    61 
    62 {if isset($errors) or not empty($infos)}
    63 {include file='infos_errors.tpl'}
    64 {/if}
    65 
    66 
    6755{if isset($comment_add)}
    6856<div id="guestbookAdd">
    69   <h4 id="expandForm">{'Sign the guestbook'|@translate}</h4>
     57  <h4 id="expandForm">{'Sign the guestbook'|translate}</h4>
    7058  <form method="post" action="{$comment_add.F_ACTION}" id="addComment" class="contact">
    7159    <table>
     
    7361      <tr>
    7462        <td>
    75           <label for="author">{'Author'|@translate}* :</label>
     63          <label for="author">{'Author'|translate}* :</label>
    7664        {if $comment_add.IS_LOGGED}
    7765          {$comment_add.AUTHOR}
     
    8270        </td>
    8371        <td>
    84           <label for="email">{'Email address'|@translate}{if $comment_add.EMAIL_MANDATORY}*{/if} ({'not publicly visible'|@translate}) :</label>
     72          <label for="email">{'Email address'|translate}{if $comment_add.EMAIL_MANDATORY}*{/if} ({'not publicly visible'|translate}) :</label>
    8573          <input type="text" name="email" id="email" value="{$comment_add.EMAIL}">
    8674        </td>
     
    9078      {if $comment_add.ACTIVATE_RATING}
    9179        <td>
    92           <label>{'Rate'|@translate} :</label>
     80          <label>{'Rate'|translate} :</label>
    9381          <span id="comment_rate"></span>
    9482        </td>
    9583      {/if}
    9684        <td>
    97           <label for="website">{'Website'|@translate} :</label>
     85          <label for="website">{'Website'|translate} :</label>
    9886          <input type="text" name="website" id="website" value="{$comment_add.WEBSITE}">
    9987        </td>
     
    10189      <tr>
    10290        <td colspan="2">
    103           <label for="contentid">{'Comment'|@translate}* :</label>
     91          <label for="contentid">{'Comment'|translate}* :</label>
    10492          <textarea name="content" id="contentid" rows="7">{$comment_add.CONTENT}</textarea>
    10593        </td>
     
    10795      <tr>
    10896        <td colspan="2">
    109           <input type="submit" value="{'Send'|@translate}">
    110           {'* : mandatory fields'|@translate}
     97          <input type="submit" value="{'Send'|translate}">
     98          {'* : mandatory fields'|translate}
    11199        </td>
    112100      </tr>
     
    118106{/if}
    119107
    120 <p class="comment_count">{'There are %d messages'|@translate|@sprintf:$COMMENT_COUNT}</p>
     108<p class="comment_count">{'There are %d messages'|translate:$COMMENT_COUNT}</p>
    121109
    122110{if isset($comments)}
     
    124112  {if !empty($navbar)}
    125113    <div id="pictureCommentNavBar">
    126       {include file='navigation_bar.tpl'|@get_extent:'navbar'}
     114      {include file='navigation_bar.tpl'|get_extent:'navbar'}
    127115    </div>
    128116  {/if}
    129   {include file=$ABS_GUESTBOOK_PATH|@cat:'template/comment_list.tpl'}
     117  {include file=$ABS_GUESTBOOK_PATH|cat:'template/comment_list.tpl'}
    130118</div>
    131119{/if}
    132 
    133 {if $clear}<div style="clear: both;"></div>
    134 </div>{/if}
    135 </div>{* <!-- content --> *}
Note: See TracChangeset for help on using the changeset viewer.