source: extensions/birthdate/admin/template/birthdates.tpl @ 19773

Last change on this file since 19773 was 19773, checked in by plg, 11 years ago

new plugin birthdate to calculate age of people on each photo

File size: 5.8 KB
Line 
1{combine_script id='jquery.timepicker' require='jquery.ui.datepicker,jquery.ui.slider' load='footer' path=$BIRTHDATE_PATH|@cat:"admin/template/jquery-ui-timepicker-addon.js"}
2
3{assign var="datepicker_language" value="themes/default/js/ui/i18n/jquery.ui.datepicker-`$lang_info.code`.js"}
4
5{if "PHPWG_ROOT_PATH"|@constant|@cat:$datepicker_language|@file_exists}
6{combine_script id="jquery.ui.datepicker-$lang_info.code" load='footer' path=$datepicker_language}
7{/if}
8
9{combine_script id='jquery.chosen' load='footer' path='themes/default/js/plugins/chosen.jquery.min.js'}
10
11{combine_css path="themes/default/js/plugins/chosen.css"}
12{combine_css path="themes/default/js/ui/theme/jquery.ui.datepicker.css"}
13{combine_css path="themes/default/js/ui/theme/jquery.ui.slider.css"}
14
15{footer_script require='jquery.timepicker'}{literal}
16jQuery(document).ready(function() {
17  jQuery("#who").chosen();
18
19  jQuery('#birthdateSelect').datetimepicker({
20    numberOfMonths: 1,
21    changeMonth: true,
22    changeYear: true,
23    yearRange: "1900:+1",
24    dateFormat: "yy-mm-dd",
25    timeText: '{/literal}{'selection'|@translate|escape:javascript}{literal}',
26    hourText: '{/literal}{'Hour'|@translate|escape:javascript}{literal}',
27    minuteText: '{/literal}{'Minute'|@translate|escape:javascript}{literal}',
28    currentText: '{/literal}{'Now'|@translate|escape:javascript}{literal}',
29    closeText: '{/literal}{'Validate'|@translate|escape:javascript}{literal}'
30  });
31
32  jQuery("#displayForm").click(function() {
33    jQuery("#editLegend").hide();
34    jQuery("#addLegend").show();
35
36    jQuery("[name=add_birthdate]").show();
37    jQuery(this).hide();
38    return false;
39  });
40
41  jQuery("#cancelBirthdate").click(function() {
42    jQuery("[name=add_birthdate]").hide();
43    jQuery("#displayForm").show();
44    return false;
45  });
46
47  jQuery(".editBirthdate").click(function() {
48    var tag_id = jQuery(this).data("tag_id");
49    var birthdate = jQuery(this).data("birthdate");
50
51    console.log("tag_id = "+tag_id+"; birthdate = "+birthdate);
52
53    jQuery("#displayForm").hide();
54
55    jQuery("#editLegend").show();
56    jQuery("#addLegend").hide();
57
58    jQuery("[name=add_birthdate]").show();
59    jQuery("#who").val("~~"+tag_id+"~~").trigger("liszt:updated");
60    jQuery("#birthdateSelect").val(birthdate);
61
62    jQuery("#birthdateList tr").removeClass("rowSelected");
63    jQuery(this).parentsUntil("tr").parent().addClass("rowSelected");
64    window.scroll(0,140); // horizontal and vertical scroll targets
65
66    return false;
67  });
68
69  jQuery("form[name=add_birthdate]").submit(function(){
70    jQuery("form[name=add_birthdate] .error").hide();
71    var nb_errors = 0;
72
73    if ("" == jQuery("#who").val()) {
74      jQuery("#whoError").show();
75      nb_errors++;
76    }
77
78    if ("" == jQuery("#birthdateSelect").val()) {
79      jQuery("#birthdateError").show();
80      nb_errors++;
81    }
82
83    if (nb_errors > 0) {
84      return false;
85    }
86  });
87
88});
89{/literal}{/footer_script}
90
91
92{literal}
93<style>
94form fieldset p {text-align:left;margin:0 0 1.5em 0;line-height:20px;}
95.rowSelected {background-color:#C2F5C2 !important}
96form .error {display:none; color:red;}
97.birthdateActions {text-align:center;}
98.birthdateActions a:hover {border:none}
99
100#editLegend {display:none}
101</style>
102{/literal}
103
104<div class="titrePage">
105  <h2>{'Manage birthdates'|@translate}</h2>
106</div>
107
108<p style="text-align:left;margin:0 1em;">
109  <a id="displayForm" href="#">{'Add a birthdate'|@translate}</a>
110</p>
111
112<form method="post" name="add_birthdate" action="{$F_ADD_ACTION}" style="display:none">
113  <fieldset>
114    <legend>
115      <span id="editLegend">{'Edit a birthdate'|@translate}</span>
116      <span id="addLegend">{'Add a birthdate'|@translate}</span>
117    </legend>
118
119    <p>
120      <strong>{'Who?'|@translate}</strong>
121      <br>
122      <select id="who" name="who" data-placeholder="{'Select a tag'|@translate}" style="width:250px;">
123        <option value=""></option>
124{foreach from=$tags item=tag}
125        <option value="{$tag.id}">{$tag.name}</option>
126{/foreach}
127      </select>
128      <span class="error" id="whoError">&#x2718; {'Select a tag'|@translate}</span>
129    </p>
130
131    <p>
132      <strong>{'Birthdate'|@translate}</strong>
133      <br>
134      <input type="text" id="birthdateSelect" name="birthdate" style="width:120px;" value="{$BIRTHDATE}">
135      <span class="error" id="birthdateError">&#x2718; {'Select a birthdate'|@translate}</span>
136    </p>
137
138    <p style="margin:0;">
139      <input class="submit" type="submit" name="submit_add" value="{'Submit'|@translate}"/>
140      <a href="#" id="cancelBirthdate">{'Cancel'|@translate}</a>
141    </p>
142  </fieldset>
143</form>
144
145<table id="birthdateList" class="table2" style="margin:1em;">
146  <tr class="throw">
147    <th>{'Who?'|@translate} ({'Tag'|@translate})</th>
148    <th>{'Birthdate'|@translate}</th>
149    <th>{'Photos'|@translate}</th>
150    <th>{'Actions'|@translate}</th>
151  </tr>
152{if not empty($birthdates)}
153  {foreach from=$birthdates item=birthdate name=birthdate_loop}
154  <tr class="{if $smarty.foreach.birthdate_loop.index is odd}row1{else}row2{/if}{if $birthdate.HIGHLIGHT} rowSelected{/if}">
155    <td>{$birthdate.NAME}</td>
156    <td>{$birthdate.BIRTHDATE}</td>
157    <td>{$birthdate.PHOTOS}</td>
158    <td class="birthdateActions">
159      <a href="#" class="editBirthdate" data-tag_id="{$birthdate.TAG_ID}" data-birthdate="{$birthdate.BIRTHDATE_RAW}">
160        <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/edit_s.png" alt="{'edit'|@translate}" title="{'edit'|@translate}" />
161      </a>
162      <a href="{$birthdate.U_DELETE}" onclick="return confirm( document.getElementById('btn_delete{$birthdate.TAG_ID}').title + '\n\n' + '{'Are you sure?'|@translate|@escape:'javascript'}');">
163        <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/delete.png" id="btn_delete{$birthdate.TAG_ID}" alt="{'delete'|@translate}" title="{'Delete birthdate for %s'|@translate|@sprintf:$birthdate.NAME}" />
164      </a>
165    </td>
166  </tr>
167  {/foreach}
168{/if}
169</table>
Note: See TracBrowser for help on using the repository browser.