});
}
});
- });
+ });
+
+ }
+
+ activate_autocomplete($('#id_code, #id_instruments, #id_collectors, #id_location'));
+
+ var colSort = [];
+
-
- $.tablesorter.addParser({
- id: 'numerised',
- is: function (s) {
- return false;
- },
- format: function (s, table, cell) {
- var _class = $(cell).find('center span').attr('class');
- _class = _class == undefined ? 1 : 0;
- return _class;
- },
- type: 'number'
- });
-
-
+ if (sessionStorage['sort'] && sessionStorage['order']) {
+ $.tablesorter.defaults.sortList = [[sessionStorage['sort'], sessionStorage['order']]];
+ }
+ else {
+ $.tablesorter.defaults.sortList = [[1, 0]];
+ }
+
+ $('#searchtable th').each(function (index) {
+ colSort[index] = $(this).text();
+ });
+
+
+ $('#searchtable th').on('click', function () {
+ var index = colSort.indexOf($(this).text());
+ var order = $.tablesorter.defaults.headerList[index]['order'];
+ if (index != sessionStorage['sort']) {
+ sessionStorage['order'] = 0;
+ }
+ else {
+ sessionStorage['order'] = (sessionStorage['order'] == 0) ? 1 : 0;
+ }
+ sessionStorage['sort'] = index;
+ });
+
+ $("#searchtable").tablesorter({
+ headers: {
-
+ 0: {sorter: false},
- 2: {sorter: 'numerised'}
+ }
-
+ });
+
+
+ $('#dialog').dialog({
+ autoOpen: false,
+ width: '40%',
+ height: 600,
+ });
+
+ $('.fieldWrapper a').click(function () {
+ $('#dialog').dialog("open");
+ });
+
+ var deleteButton = '<a class="btn btn-default" id="del" href="#">' + gettrans('delete field') + '</a><br/>';
+
+ var tag = $('#copy').clone();
+ $(tag).children().each(function () {
+ $(this).val('').prop('checked', false).prop('selected', false);
+ });
+
+ function deleteField(e) {
+ e.preventDefault();
+ var number = $('input[name*="text_field"]').length;
+ if (number == 3) {
+ $('#del').remove();
+ }
+ $('#bloc-' + (number - 1)).remove();
+ $('#id_form-TOTAL_FORMS').attr('value', number - 1);
+
+ }
+
+ function addField(e) {
+ e.preventDefault();
+ var number = $('input[name*="text_field"]').length;
+ var tag_field = $(tag).clone().attr('id', 'bloc-' + number);
+ if (number == 2) {
+ $('#add').after(deleteButton);
+ $('#del').click(deleteField);
+ }
+ $('#add').before(tag_field);
+ $('#bloc-' + number).html($('#bloc-' + number).html().replace(/1/g, number));
+ activate_autocomplete($('#id_form-' + number + '-text_field'), 'instruments');
+ $('#id_form-TOTAL_FORMS').attr('value', number + 1);
+ }
+
+ $('#add').click(addField);
+
+ activate_autocomplete($('#id_form-0-text_field, #id_form-1-text_field'), 'instruments');
+
+ var interval = null;
+ var textInput = "";
+
+ $('#dialog form').on('submit change', function (e) {
+ if (e.type != 'keypress') e.preventDefault();
+ $.ajax({
+ url: '/search/booleaninstru/',
+ dataType: 'json',
+ data: $(this).serialize(),
+ success: function (donnees) {
+ if (e.type == 'submit' && !donnees.result.match(/\[ERROR\]/g)) {
+ $("#dialog").dialog("close");
+ $('#id_instruments').val(donnees.result);
+ }
+ $('#res').html(gettrans('final query') + " :<br/><strong>" + gettrans(donnees.result) + '</strong>');
+ },
+ });
+ });
+
+ $('#dialog input[type="text"]').on('focus', function () {
+ textInput = $(this).val();
+ var self = this;
+ interval = setInterval(function () {
+ if ($(self).val() != textInput) {
+ textInput = $(self).val();
+ $('#dialog form').trigger('change');
+ }
+ }, 500);
+ });
+
+ $('#dialog input[type="text"]').on('blur', function () {
+ clearInterval(interval);
+ textInput = ""
+ });
+
+
+});
});
}
});
++
++ var colSort = [];
++
++ if (sessionStorage['sort'] && sessionStorage['order']) {
++ $.tablesorter.defaults.sortList = [[sessionStorage['sort'], sessionStorage['order']]];
++ }
++ else {
++ $.tablesorter.defaults.sortList = [[1, 0]];
++ }
++
++ $('#searchtable th').each(function (index) {
++ colSort[index] = $(this).text();
++ });
++
++
++ $('#searchtable th').on('click', function () {
++ var index = colSort.indexOf($(this).text());
++ var order = $.tablesorter.defaults.headerList[index]['order'];
++ if (index != sessionStorage['sort']) {
++ sessionStorage['order'] = 0;
++ }
++ else {
++ sessionStorage['order'] = (sessionStorage['order'] == 0) ? 1 : 0;
++ }
++ sessionStorage['sort'] = index;
++ });
++
++ $("#searchtable").tablesorter({
++ headers: {
++
++ 0: {sorter: false},
++ }
++
++ });
++
});
$.tablesorter.defaults.sortList = [[2,0]];
{% for playlist in playlists %}
- $("#{{playlist.playlist.public_id}}tb").tablesorter({headers: {6:{sorter:false}}} );
+ {% if playlist.resources|length != 0 %}
- $("#{{playlist.playlist.public_id}}tb").tablesorter({headers: {6:{sorter:false}}} );
++ $("#{{playlist.playlist.public_id}}tb").tablesorter({headers: {0:{sorter:false}}} );
+ {% endif %}
{% endfor %}
});
</script>
</td>
<td align="center" style="vertical-align:middle;">
{% if resource.element.file or resource.element.has_mediafile %}
- <!--<a class="playButton" href="javascript:">-->
- <span class="glyphicon glyphicon-volume-up" style="font-size: 1.3em;"><p style="opacity:0;font-size:0">d</p></span>
- <!--</a>-->
+ <span class="glyphicon glyphicon-ok" style="font-size: 1.3em;color: green;"><p style="opacity:0;font-size:0">d</p></span>
{% endif %}
</td>
- <td style="vertical-align:middle">
- <a href="#" onclick="if(confirm(gettrans('delete the resource from the playlist permanently?'))){playlistUtils.removeResource('{{resource.public_id}}', '{{ forloop.parentloop.counter0 }}');};return false;" class="component_icon button icon_cancel" style="padding: 4px 12px;"></a>
+ <td align="center" style="vertical-align:middle;">
- <a href="#" onclick="if(confirm(gettrans('delete the resource from the playlist permanently?'))){playlistUtils.removeResource('{{resource.public_id}}');};return false;">
- <span class="glyphicon glyphicon-trash" style="font-size: 1.3em;color: black;"><p style="opacity:0;font-size:0">d</p></span>
- </a>
++ <a href="#" onclick="if(confirm(gettrans('delete the resource from the playlist permanently?'))){playlistUtils.removeResource('{{resource.public_id}}', '{{ forloop.parentloop.counter0 }}');};return false;">
++ <span class="glyphicon glyphicon-trash" style="font-size: 1.3em;color: black;"><p style="opacity:0;font-size:0">d</p></span>
++ </a>
</td>
</tr>
{% endfor %}