source: extensions/UserCollections/template/collection_edit.tpl @ 29317

Last change on this file since 29317 was 29317, checked in by mistic100, 10 years ago

Add allow_send_admin parameter

File size: 11.9 KB
Line 
1{strip}
2{combine_css path=$USER_COLLEC_PATH|cat:'template/style_collections.css'}
3
4{include file=$USER_COLLEC_ABS_PATH|cat:'template/thumbnails_colorbox.tpl'}
5
6{*<!-- datepicker and timepicker -->*}
7{combine_script id='jquery.ui.datepicker' load='footer' path='themes/default/js/ui/jquery.ui.datepicker.js'}
8{combine_script id='jquery.ui.timepicker' load='footer' require='jquery.ui.slider' path=$USER_COLLEC_PATH|cat:'template/resources/jquery-timepicker/jquery-ui-timepicker-addon.js'}
9
10{assign var=datepicker_language value='themes/default/js/ui/i18n/jquery.ui.datepicker-'|cat:$lang_info.code|cat:'.js'}
11{if 'PHPWG_ROOT_PATH'|constant|cat:$datepicker_language|file_exists}
12{combine_script id='jquery.ui.datepicker-'|cat:$lang_info.code load='footer' require='jquery.ui.datepicker' path=$datepicker_language}
13{/if}
14
15{assign var=timepicker_language value=$USER_COLLEC_PATH|cat:'template/resources/jquery-timepicker/i18n/jquery-ui-timepicker-'|cat:$lang_info.code|cat:'.js'}
16{if 'PHPWG_ROOT_PATH'|constant|cat:$timepicker_language|file_exists}
17{combine_script id='jquery.ui.timepicker-'|cat:$lang_info.code load='footer' require='jquery.ui.timepicker' path=$timepicker_language}
18{/if}
19
20{combine_css path='themes/default/js/ui/theme/jquery.ui.core.css'}
21{combine_css path='themes/default/js/ui/theme/jquery.ui.theme.css'}
22{combine_css path='themes/default/js/ui/theme/jquery.ui.datepicker.css'}
23{combine_css path='themes/default/js/ui/theme/jquery.ui.slider.css'}
24{combine_css path=$USER_COLLEC_PATH|cat:'template/resources/jquery-timepicker/jquery-ui-timepicker-addon.css'}
25{/strip}
26
27{footer_script require='jquery'}
28var bg_color = jQuery('#the_page #content').css('background-color');
29if (!bg_color || bg_color=='transparent') {
30  bg_color = jQuery('body').css('background-color');
31}
32
33{if isset($U_SHARE)}
34  var $share_form = jQuery('#share_form');
35
36  // functions
37  jQuery.fn.extend({
38      hideVis: function() {
39          jQuery(this).css('visibility', 'hidden');
40          return this;
41      },
42      showVis: function() {
43          jQuery(this).css('visibility', 'visible');
44          return this;
45      },
46      toggleVis: function(toggle) {
47          if (jQuery(this).css('visibility')=='hidden' || toggle === true){
48              return jQuery(this).showVis();
49          } else {
50              return jQuery(this).hideVis();
51          }
52      }
53  });
54
55  function enterShareKeyEdit() {
56      $share_form.find('.url-edit').show();
57      $share_form.find('.url-normal').hide();
58      jQuery('.share_colorbox_open').colorbox.resize({ldelim}speed:0});
59  }
60  function exitShareKeyEdit() {
61      $share_form.find('.url-edit').hide();
62      $share_form.find('.url-normal').show();
63      jQuery('.share_colorbox_open').colorbox.resize({ldelim}speed:0});
64  }
65
66  // hide some inputs
67  exitShareKeyEdit();
68
69  // display key
70  $share_form.find('.url-more').text($share_form.find('input[name="share_key"]').val());
71
72  // url edition
73  $share_form.find('.edit_share_key').on('click', function(e) {
74      enterShareKeyEdit();
75      e.preventDefault();
76  });
77  $share_form.find('.set_share_key').on('click', function(e) {
78      if ($share_form.find('input[name="share_key"]').val().length < 8) {
79          alert('{'The key must be at least 8 characters long'|translate|escape:javascript}');
80      }
81      else {
82          $share_form.find('.url-more').text($share_form.find('input[name="share_key"]').val());
83          exitShareKeyEdit();
84      }
85      e.preventDefault();
86  });
87  $share_form.find('.cancel_share_key').on('click', function(e) {
88      $share_form.find('input[name="share_key"]').val($share_form.find('.url-more').text());
89      exitShareKeyEdit();
90      e.preventDefault();
91  });
92  $share_form.find('.url-more').on('dblclick', function() {
93      enterShareKeyEdit();
94  });
95
96  // optional inputs
97  $share_form.find('.share-option').each(function() {
98      $share_form.find('input[name="'+ jQuery(this).data('for') +'"]').hideVis();
99  }).on('change', function() {
100      $share_form.find('input[name="'+ jQuery(this).data('for') +'"]').toggleVis($(this).is(':checked'));
101  });
102
103  // datetime picker
104  $share_form.find('input[name="share_deadline"]').datetimepicker({
105      dateFormat: 'yy-mm-dd',
106      minDate: new Date()
107  });
108
109
110  // popup
111  jQuery('.share_colorbox_open').colorbox({
112    {if isset($share.open)}open: true, transition:"none",{/if}
113    inline:true
114  });
115  jQuery('.share_colorbox_close').click(function(e) {
116    jQuery('.share_colorbox_open').colorbox.close();
117    e.preventDefault();
118  });
119  jQuery('#share_form').css('background-color', bg_color);
120{/if}
121
122{if isset($U_MAIL)}
123  jQuery('.mail_colorbox_open').colorbox({
124    {if isset($contact.open)}open: true, transition:"none",{/if}
125    inline:true
126  });
127  jQuery('.mail_colorbox_close').click(function(e) {
128    jQuery('.mail_colorbox_open').colorbox.close();
129    e.preventDefault();
130  });
131
132  jQuery('#mail_form [name=to]').on('change', function() {
133    $('.recipient-input').toggle(jQuery(this).val() == 'email');
134    jQuery.colorbox.resize();
135  });
136
137  jQuery('#mail_form').css('background-color', bg_color);
138{/if}
139
140jQuery('#edit_form_show').click(function() {
141  jQuery('#edit_form_show').hide();
142  jQuery('.additional_info').hide();
143  jQuery('#edit_form').show();
144});
145jQuery('#edit_form_hide').click(function() {
146  jQuery('#edit_form_show').show();
147  jQuery('.additional_info').show();
148  jQuery('#edit_form').hide();
149});
150{/footer_script}
151
152
153{if isset($collection)}
154
155<p style="text-align:center;"><input type="submit" id="edit_form_show" value="{'Edit'|translate}"></p>
156
157{* <!-- edit collection -->*}
158<form action="{$F_ACTION}" method="post" id="edit_form" style="display:none;">
159<fieldset id="colProperties">
160  <legend>{'Edit'|translate}</legend>
161
162  <p class="title"><label for="name">{'Name'|translate}</label></p>
163  <p><input type="text" name="name" id="name" value="{$collection.NAME|escape:html}" size="60"></p>
164
165  <p class="title"><label for="comment">{'Description'|translate}</label></p>
166  <p><textarea name="comment" id="comment" style="width:400px;height:100px;">{$collection.COMMENT}</textarea></p>
167
168  <p>
169    <input type="submit" name="save_col" value="{'Save'|translate}">
170    <a id="edit_form_hide">{'Cancel'|translate}</a>
171  </p>
172</fieldset>
173</form>
174
175{*<!-- create share links -->*}
176{if isset($U_SHARE)}
177<div style="display:none;">
178  <form id="share_form" class="uc_form" action="{$F_ACTION}" method="post">
179    {include file='infos_errors.tpl' errors=$share.errors infos=$share.infos}
180
181    <table>
182      <tr>
183        <td colspan="2" class="url-preview" style="white-space:nowrap;">
184          <span class="url-base">{$U_SHARE}</span><span class="url-more url-normal"></span>
185          <input type="text" name="share_key" class="url-edit" size="20" value="{$share.share_key}">
186          <button class="url-normal edit_share_key">{'Edit'|translate}</button>
187          <button class="url-edit set_share_key">{'OK'|translate}</button>
188          <a href="#" class="url-edit cancel_share_key">{'Cancel'|translate}</button>
189        </td>
190      </tr>
191      <tr>
192        <td class="title"><label>
193          {'Password'|translate}
194          <input type="checkbox" name="use_share_password" data-for="share_password" class="share-option">
195        </label></td>
196        <td>
197          <input type="text" name="share_password" size="25" maxlength="25" value="{$share.password}" placeholder="{'Password'|translate}">
198        </td>
199      </tr>
200      <tr>
201        <td class="title"><label>
202          {'Expiration date'|translate}
203          <input type="checkbox" name="use_share_deadline" data-for="share_deadline" class="share-option">
204        </label></td>
205        <td>
206          <input type="text" name="share_deadline" size="25" value="{$share.deadline}" placeholder="{'Date'|translate}">
207        </td>
208      </tr>
209      <tr>
210        <td class="title">&nbsp;</td>
211        <td>
212          <input class="submit" type="submit" name="add_share" value="{'Add'|translate}">
213          <a class="share_colorbox_close" href="#">{'Cancel'|translate}</a>
214          <input type="hidden" name="key" value="{$UC_TKEY}">
215        </td>
216      </tr>
217    </table>
218
219  {if not empty($collection.SHARES)}
220    <table class="shares_list">
221      <tr class="header">
222        <th>{'Share key'|translate}</th>
223        <th>{'Creation date'|translate}</th>
224        <th>{'Password'|translate}</th>
225        <th>{'Expiration date'|translate}</th>
226        <th></th>
227      </tr>
228    {foreach from=$collection.SHARES item=share}
229      <tr class="{cycle values='row2,row1'} {if $share.expired}expired{/if}">
230        <td><a href="{$share.url}">{$share.share_key}</a></td>
231        <td>{$share.add_date_readable}</td>
232        <td>{if $share.params.password}{'Yes'|translate}{else}{'No'|translate}{/if}</td>
233        <td>{if $share.params.deadline}{$share.params.deadline_readable}{else}{'No'|translate}{/if}</td>
234        <td><a href="{$share.u_delete}" onClick="return confirm('{'Are you sure?'|translate}');">
235          <img src="{$ROOT_URL}{$USER_COLLEC_PATH}template/resources/delete.png" width=16 height=16></a>
236        </td>
237      </tr>
238    {/foreach}
239    </table>
240  {/if}
241  </form>
242</div>
243{/if}
244
245{*<!-- send collection by mail -->*}
246{if isset($U_MAIL)}
247<div style="display:none;">
248  <form id="mail_form" class="uc_form" action="{$F_ACTION}" method="post">
249    {include file='infos_errors.tpl' errors=$contact.errors}
250
251    <table>
252      <tr>
253        <td class="title"><label for="sender_name">{'Your name'|translate}</label></td>
254        <td>
255          <input type="text" name="sender_name" id="sender_name" size="40" value="{$contact.sender_name}">
256        </td>
257      </tr>
258      <tr>
259        <td class="title"><label for="sender_email">{'Your e-mail'|translate}</label></td>
260        <td>
261          <input type="text" name="sender_email" id="sender_email" size="40" value="{$contact.sender_email}">
262        </td>
263      </tr>
264      {if $UC_CONFIG.allow_send_admin && !$UC_CONFIG.allow_mails}
265      <tr>
266        <td class="title">{'To'|translate}</td>
267        <td>{'Administrator'|translate}</td>
268      </tr>
269      {/if}
270      <tr {if !$UC_CONFIG.allow_send_admin || !$UC_CONFIG.allow_mails}style="display:none"{/if}>
271        <td class="title">{'To'|translate}</td>
272        <td>
273          <label><input type="radio" name="to" value="admin" checked> {'Administrator'|translate}</label>
274          <label><input type="radio" name="to" value="email"> {'Someone else'|translate}</label>
275        </td>
276      </tr>
277      <tr style="display:none" class="recipient-input">
278        <td class="title"><label for="recipient_name">{'Recipient name'|translate}</label></td>
279        <td>
280          <input type="text" name="recipient_name" id="recipient_name" size="40" value="{$contact.recipient_name}">
281        </td>
282      </tr>
283      <tr style="display:none" class="recipient-input">
284        <td class="title"><label for="recipient_email">{'Recipient e-mail'|translate}</label></td>
285        <td>
286          <input type="text" name="recipient_email" id="recipient_email" size="40" value="{$contact.recipient_email}">
287        </td>
288      </tr>
289      <tr>
290        <td class="title"><label for="nb_images">{'Number of images'|translate}</label></td>
291        <td>
292          <select name="nb_images">
293            <option value="2" {if $contact.nb_images==2}selected="selected"{/if}>2</option>
294            <option value="4" {if $contact.nb_images==4}selected="selected"{/if}>4</option>
295            <option value="8" {if $contact.nb_images==8}selected="selected"{/if}>8</option>
296          </select>
297        </td>
298      </tr>
299      <tr>
300        <td class="title"><label for="message">{'Message (optional)'|translate}</label></td>
301        <td><textarea name="message" id="message" rows="6" style="width:350px;">{$contact.message}</textarea></td>
302      </tr>
303      <tr>
304        <td class="title">&nbsp;</td>
305        <td>
306          <input class="submit" type="submit" name="send_mail" value="{'Send'|translate}">
307          <a class="mail_colorbox_close" href="#">{'Cancel'|translate}</a>
308          <input type="hidden" name="key" value="{$UC_TKEY}">
309        </td>
310      </tr>
311    </table>
312  </form>
313</div>
314{/if}
315
316{if empty($THUMBNAILS)}
317<p><i>{'This collection is empty'|translate}</i></p>
318{/if}
319
320{/if}
Note: See TracBrowser for help on using the repository browser.