Ignore:
Timestamp:
Sep 11, 2013, 6:44:54 PM (11 years ago)
Author:
mistic100
Message:

new system for shares : password protection, link timeout, management popup + for mails
handle lightbox conflicts
menublock is visible by AMM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/UserCollections/template/collection_edit.tpl

    r23551 r24421  
    11{combine_css path=$USER_COLLEC_PATH|cat:'template/style_collections.css'}
    2 {combine_script id='ZeroClipboard' path=$USER_COLLEC_PATH|cat:'template/resources/ZeroClipboard.min.js'}
     2
    33{include file=$USER_COLLEC_ABS_PATH|cat:'template/thumbnails_colorbox.tpl'}
    44
    5 {footer_script require='jquery'}
    6 {if $user_collections.allow_public}
    7 ZeroClipboard.setDefaults( {ldelim} moviePath: "{$ROOT_URL}{$USER_COLLEC_PATH}template/resources/ZeroClipboard.swf" } );
    8 var clip = new ZeroClipboard();
    9 
    10 clip.glue(jQuery("#publicURL .button").get());
    11 clip.addEventListener('onMouseOver', function() {ldelim}
    12   clip.setText(jQuery("#publicURL .url").val());
    13 });
    14 clip.addEventListener('complete', function() {ldelim}
    15   jQuery('.confirm').remove();
    16   jQuery("#publicURL .url").select();
    17   jQuery('<span class="confirm" style="display:none;">{'Copied'|@translate}</span>').appendTo("#publicURL")
    18     .fadeIn(400).delay(1000).fadeOut(400, function(){ldelim} jQuery(this).remove(); });
    19 });
    20 
    21 jQuery("#publicURL .url").click(function() {ldelim}
    22   jQuery(this).select();
    23 });
    24 
    25 jQuery("input[name='public']").change(function() {ldelim}
    26   jQuery("#publicURL").fadeToggle("fast");
    27 });
    28 {/if}
    29 
    30 {if $collection.PUBLIC && $user_collections.allow_mails}
    31   jQuery(window).load(function(){ldelim}
    32     jQuery(".mail_colorbox_open").colorbox({ldelim}
    33       {if isset($uc_mail_errors)}open: true, transition:"none",{/if}
    34       inline:true
    35     });
    36     jQuery(".mail_colorbox_close").click(function() {ldelim}
    37       jQuery(".mail_colorbox_open").colorbox.close();
     5{*<!-- datepicker and timepicker -->*}
     6{include file='include/datepicker.inc.tpl'}
     7{combine_script id='jquery.ui.timepicker' load='footer' require='jquery.ui.datepicker,jquery.ui.slider' path=$USER_COLLEC_PATH|cat:'template/resources/jquery-timepicker/jquery-ui-timepicker-addon.js'}
     8
     9{assign var="timepicker_language" value=$USER_COLLEC_PATH|cat:'template/resources/jquery-timepicker/i18n/jquery-ui-timepicker-'|cat:$lang_info.code|cat:'.js'}
     10{if "PHPWG_ROOT_PATH"|@constant|@cat:$timepicker_language|@file_exists}
     11{combine_script id="jquery.ui.timepicker-$lang_info.code" load='footer' require='jquery.ui.timepicker' path=$timepicker_language}
     12{/if}
     13
     14{combine_css path='themes/default/js/ui/theme/jquery.ui.core.css'}
     15{combine_css path='themes/default/js/ui/theme/jquery.ui.theme.css'}
     16{combine_css path='themes/default/js/ui/theme/jquery.ui.slider.css'}
     17{combine_css path=$USER_COLLEC_PATH|cat:'template/resources/jquery-timepicker/jquery-ui-timepicker-addon.css'}
     18
     19
     20<script>
     21{footer_script require='jquery,jquery.ui.timepicker'}
     22{if isset($U_SHARE)}
     23{literal}
     24  var $share_form = jQuery('#share_form');
     25 
     26  // functions
     27  jQuery.fn.extend({
     28      hideVis: function() {
     29          $(this).css('visibility', 'hidden');
     30          return this;
     31      },
     32      showVis: function() {
     33          $(this).css('visibility', 'visible');
     34          return this;
     35      },
     36      toggleVis: function(toggle) {
     37          if ($(this).css('visibility')=='hidden' || toggle === true){
     38              return $(this).showVis();
     39          } else {
     40              return $(this).hideVis();
     41          }
     42      }
     43  });
     44 
     45  function enterShareKeyEdit() {
     46      $share_form.find('.url-edit').show();
     47      $share_form.find('.url-normal').hide();
     48      jQuery(".share_colorbox_open").colorbox.resize({speed:0});
     49  }
     50  function exitShareKeyEdit() {
     51      $share_form.find('.url-edit').hide();
     52      $share_form.find('.url-normal').show();
     53      jQuery(".share_colorbox_open").colorbox.resize({speed:0});
     54  }
     55 
     56  // hide some inputs
     57  exitShareKeyEdit();
     58 
     59  // display key
     60  $share_form.find('.url-more').text($share_form.find('input[name="share_key"]').val());
     61 
     62  // url edition
     63  $share_form.find('.edit_share_key').on('click', function() {
     64      enterShareKeyEdit();
    3865      return false;
    39     })
     66  });
     67  $share_form.find('.set_share_key').on('click', function() {
     68      if ($share_form.find('input[name="share_key"]').val().length < 8) {
     69          alert("{/literal}{'The key must be at least 8 characters long'|@translate}{literal}");
     70      }
     71      else {
     72          $share_form.find('.url-more').text($share_form.find('input[name="share_key"]').val());
     73          exitShareKeyEdit();
     74      }
     75      return false;
     76  });
     77  $share_form.find('.cancel_share_key').on('click', function() {
     78      $share_form.find('input[name="share_key"]').val($share_form.find('.url-more').text());
     79      exitShareKeyEdit();
     80      return false;
     81  });
     82  $share_form.find('.url-more').on('dblclick', function() {
     83      enterShareKeyEdit();
     84  });
     85 
     86  // optional inputs
     87  $share_form.find('.share-option').each(function() {
     88      $share_form.find('input[name="'+ $(this).data('for') +'"]').hideVis();
     89  }).on('change', function() {
     90      $share_form.find('input[name="'+ $(this).data('for') +'"]').toggleVis($(this).is(':checked'));
     91  });
     92 
     93  // datetime picker
     94  $share_form.find('input[name="share_deadline"]').datetimepicker({
     95      dateFormat: 'yy-mm-dd',
     96      minDate: new Date()
     97  });
     98 
     99 
     100  // popup
     101  jQuery(".share_colorbox_open").colorbox({
     102    {/literal}{if isset($share.open)}open: true, transition:"none",{/if}{literal}
     103    inline:true
     104  });
     105  jQuery(".share_colorbox_close").click(function() {
     106    jQuery(".share_colorbox_open").colorbox.close();
     107    return false;
     108  });
     109  jQuery("#share_form").css('background-color', jQuery("#the_page #content").css('background-color'));
     110{/literal}
     111{/if}
     112
     113{if isset($U_MAIL)}
     114{literal}
     115  jQuery(".mail_colorbox_open").colorbox({
     116    {/literal}{if isset($contact.open)}open: true, transition:"none",{/if}{literal}
     117    inline:true
     118  });
     119  jQuery(".mail_colorbox_close").click(function() {
     120    jQuery(".mail_colorbox_open").colorbox.close();
     121    return false;
    40122  });
    41123  jQuery("#mail_form").css('background-color', jQuery("#the_page #content").css('background-color'));
    42 {/if}
    43 
    44 jQuery("#edit_form_show").click(function() {ldelim}
     124{/literal}
     125{/if}
     126
     127{literal}
     128jQuery("#edit_form_show").click(function() {
    45129  jQuery("#edit_form_show").hide();
    46130  jQuery(".additional_info").hide();
    47131  jQuery("#edit_form").show();
    48132});
    49 jQuery("#edit_form_hide").click(function() {ldelim}
     133jQuery("#edit_form_hide").click(function() {
    50134  jQuery("#edit_form_show").show();
    51135  jQuery(".additional_info").show();
    52136  jQuery("#edit_form").hide();
    53137});
     138{/literal}
    54139{/footer_script}
     140</script>
    55141
    56142
     
    71157
    72158
     159{if isset($collection)}
     160
    73161{if !empty($CONTENT_DESCRIPTION)}
    74162<div class="additional_info">
     
    89177  <p class="title"><label for="comment">{'Description'|@translate}</label></p>
    90178  <p><textarea name="comment" id="comment" style="width:400px;height:100px;">{$collection.COMMENT}</textarea></p>
    91  
    92 {if $user_collections.allow_public}
    93   <p class="title">{'Public collection'|@translate}</p>
    94   <p>
    95     <label><input type="radio" name="public" value="0" {if not $collection.PUBLIC}checked="checked"{/if}> {'No'|@translate}</label>
    96     <label><input type="radio" name="public" value="1" {if $collection.PUBLIC}checked="checked"{/if}> {'Yes'|@translate}</label>
    97     <span id="publicURL" {if not $collection.PUBLIC}style="display:none;"{/if}><!--
    98     --><span class="button" title="{'Copy to clipboard'|@translate}">&nbsp;</span><!--
    99     --><input type="text" class="url" value="{$collection.U_PUBLIC}" size="{$collection.U_PUBLIC|strlen}"><!--
    100   --></span>
    101   </p>
    102 {/if}
    103179
    104180  <p>
     
    109185</form>
    110186
    111 
    112 {* <!-- send collection by mail -->*}
    113 {if $user_collections.allow_public && $user_collections.allow_mails}
     187{*<!-- create share links -->*}
     188{if isset($U_SHARE)}
    114189<div style="display:none;">
    115   <form id="mail_form" action="{$F_ACTION}" method="post">
    116   {if isset($uc_mail_errors)}
    117     {assign var=errors value=$uc_mail_errors}
    118     {include file='infos_errors.tpl'}
     190  <form id="share_form" class="uc_form" action="{$F_ACTION}" method="post">
     191    {include file='infos_errors.tpl' errors=$share.errors infos=$share.infos}
     192   
     193    <table>
     194      <tr>
     195        <td colspan="2" class="url-preview" style="white-space:nowrap;">
     196          <span class="url-base">{$U_SHARE}</span><span class="url-more url-normal"></span>
     197          <input type="text" name="share_key" class="url-edit" size="20" value="{$share.share_key}">
     198          <button class="url-normal edit_share_key">{'Edit'|@translate}</button>
     199          <button class="url-edit set_share_key">{'OK'|@translate}</button>
     200          <a href="#" class="url-edit cancel_share_key">{'Cancel'|@translate}</button>
     201        </td>
     202      </tr>
     203      <tr>
     204        <td class="title"><label>
     205          {'Password'|@translate}
     206          <input type="checkbox" name="use_share_password" data-for="share_password" class="share-option">
     207        </label></td>
     208        <td>
     209          <input type="text" name="share_password" size="25" maxlength="25" value="{$share.password}" placeholder="{'Password'|@translate}">
     210        </td>
     211      </tr>
     212      <tr>
     213        <td class="title"><label>
     214          {'Expiration date'|@translate}
     215          <input type="checkbox" name="use_share_deadline" data-for="share_deadline" class="share-option">
     216        </label></td>
     217        <td>
     218          <input type="text" name="share_deadline" size="25" value="{$share.deadline}" placeholder="{'Date'|@translate}">
     219        </td>
     220      </tr>
     221      <tr>
     222        <td class="title">&nbsp;</td>
     223        <td>
     224          <input class="submit" type="submit" name="add_share" value="{'Add'|@translate}">
     225          <a class="share_colorbox_close" href="#">{'Cancel'|@translate}</a>
     226          <input type="hidden" name="key" value="{$UC_TKEY}">
     227        </td>
     228      </tr>
     229    </table>
     230   
     231  {if not empty($collection.SHARES)}
     232    <table class="shares_list">
     233      <tr class="header">
     234        <th>{'Share key'|@translate}</th>
     235        <th>{'Creation date'|@translate}</th>
     236        <th>{'Password'|@translate}</th>
     237        <th>{'Expiration date'|@translate}</th>
     238        <th></th>
     239      </tr>
     240    {foreach from=$collection.SHARES item=share}
     241      <tr class="{cycle values='row2,row1'} {if $share.expired}expired{/if}">
     242        <td><a href="{$share.url}">{$share.share_key}</a></td>
     243        <td>{$share.add_date_readable}</td>
     244        <td>{if $share.params.password}{'Yes'|@translate}{else}{'No'|@translate}{/if}</td>
     245        <td>{if $share.params.deadline}{$share.params.deadline_readable}{else}{'No'|@translate}{/if}</td>
     246        <td><a href="{$share.u_delete}" onClick="return confirm('{'Are you sure?'|@translate}');">
     247          <img src="{$ROOT_URL}{$USER_COLLEC_PATH}template/resources/delete.png" width=16 height=16></a>
     248        </td>
     249      </tr>
     250    {/foreach}
     251    </table>
    119252  {/if}
     253  </form>
     254</div>
     255{/if}
     256
     257{*<!-- send collection by mail -->*}
     258{if isset($U_MAIL)}
     259<div style="display:none;">
     260  <form id="mail_form" class="uc_form" action="{$F_ACTION}" method="post">
     261    {include file='infos_errors.tpl' errors=$contact.errors}
    120262
    121263    <table>
     
    163305          <input class="submit" type="submit" name="send_mail" value="{'Send'|@translate}">
    164306          <a class="mail_colorbox_close" href="#">{'Cancel'|@translate}</a>
    165           <input type="hidden" name="key" value="{$contact.KEY}" />
     307          <input type="hidden" name="key" value="{$UC_TKEY}">
    166308        </td>
    167309      </tr>
     
    183325{if !empty($navbar)}{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
    184326
     327{/if}
    185328
    186329{if isset($clear)}<div style="clear: both;"></div>
Note: See TracChangeset for help on using the changeset viewer.