wip: js modularization and cleanup

This commit is contained in:
Florian BLOUET
2016-02-23 19:22:01 +01:00
parent 83f3bd4084
commit 239c3c3930
23 changed files with 811 additions and 1489 deletions

View File

@@ -27,6 +27,7 @@ gulp.task('build', ['build-vendors'], function(){
// standalone vendors used across application // standalone vendors used across application
gulp.task('build-vendors', [ gulp.task('build-vendors', [
'build-alchemy-embed', 'build-alchemy-embed',
'build-betterjs',
'build-phraseanet-production-client', 'build-phraseanet-production-client',
'build-bootstrap', 'build-bootstrap',
'build-colorpicker', 'build-colorpicker',

View File

@@ -26,6 +26,7 @@ gulp.task('build-common-css', ['build-common-font-css'],function(){
gulp.task('build-common-js', function(){ gulp.task('build-common-js', function(){
var commonGroup = [ var commonGroup = [
config.paths.src + 'common/js/components/user.js',
// config.paths.dist + 'assets/bootstrap/js/bootstrap.js', // should append no conflict // config.paths.dist + 'assets/bootstrap/js/bootstrap.js', // should append no conflict
config.paths.src + 'vendors/jquery-mousewheel/js/jquery.mousewheel.js', config.paths.src + 'vendors/jquery-mousewheel/js/jquery.mousewheel.js',
// jquery ui date picker langs // jquery ui date picker langs

View File

@@ -73,17 +73,22 @@ gulp.task('build-prod-js', function(){
config.paths.vendors + 'jquery-file-upload/js/jquery.iframe-transport.js', config.paths.vendors + 'jquery-file-upload/js/jquery.iframe-transport.js',
config.paths.vendors + 'jquery-file-upload/js/jquery.fileupload.js', config.paths.vendors + 'jquery-file-upload/js/jquery.fileupload.js',
config.paths.vendors + 'geonames-server-jquery-plugin/jquery.geonames.js', config.paths.vendors + 'geonames-server-jquery-plugin/jquery.geonames.js',
config.paths.src + 'prod/js/core/lists.js',
config.paths.src + 'prod/js/core/selectable.js',
config.paths.src + 'prod/js/core/alert.js',
config.paths.src + 'prod/js/components/search.js',
config.paths.src + 'prod/js/components/publication.js', config.paths.src + 'prod/js/components/publication.js',
config.paths.src + 'prod/js/jquery.form.2.49.js', config.paths.src + 'prod/js/components/workzone.js',
config.paths.src + 'prod/js/jquery.Selection.js', config.paths.src + 'prod/js/components/workzone-basket.js',
config.paths.src + 'prod/js/components/workzone-facets.js',
config.paths.src + 'prod/js/components/utils.js',
// config.paths.src + 'prod/js/jquery.form.2.49.js',
config.paths.src + 'prod/js/jquery.Edit.js', config.paths.src + 'prod/js/jquery.Edit.js',
config.paths.src + 'prod/js/jquery.lists.js',
config.paths.src + 'prod/js/jquery.Prod.js', config.paths.src + 'prod/js/jquery.Prod.js',
config.paths.src + 'prod/js/jquery.Feedback.js', config.paths.src + 'prod/js/jquery.Feedback.js',
config.paths.src + 'prod/js/jquery.Results.js', config.paths.src + 'prod/js/components/search-result.js',
config.paths.src + 'prod/js/jquery.main-prod.js', config.paths.src + 'prod/js/jquery.main-prod.js',
config.paths.src + 'prod/js/jquery.WorkZone.js',
config.paths.src + 'prod/js/jquery.Alerts.js',
config.paths.src + 'prod/js/jquery.Upload.js', config.paths.src + 'prod/js/jquery.Upload.js',
config.paths.src + 'prod/js/ThumbExtractor.js', config.paths.src + 'prod/js/ThumbExtractor.js',
config.paths.src + 'prod/js/publicator.js', config.paths.src + 'prod/js/publicator.js',

View File

@@ -0,0 +1,9 @@
var gulp = require('gulp');
var config = require('../../config.js');
var utils = require('../../utils.js');
gulp.task('build-betterjs', [], function(){
return utils.buildJsGroup([
config.paths.vendors + 'better.js/build/better.js'
], 'better', 'vendors/better');
});

View File

@@ -0,0 +1,39 @@
var userModule = (function(){
function setPref(name, value) {
if (jQuery.data['pref_' + name] && jQuery.data['pref_' + name].abort) {
jQuery.data['pref_' + name].abort();
jQuery.data['pref_' + name] = false;
}
jQuery.data['pref_' + name] = $.ajax({
type: "POST",
url: "/user/preferences/",
data: {
prop: name,
value: value
},
dataType: 'json',
timeout: function () {
jQuery.data['pref_' + name] = false;
},
error: function () {
jQuery.data['pref_' + name] = false;
},
success: function (data) {
if (data.success) {
humane.info(data.message);
}
else {
humane.error(data.message);
}
jQuery.data['pref_' + name] = false;
return;
}
});
}
return {setPref: setPref}
})();

View File

@@ -40,38 +40,6 @@ $(document).ready(function () {
}); });
function setPref(name, value) {
if (jQuery.data['pref_' + name] && jQuery.data['pref_' + name].abort) {
jQuery.data['pref_' + name].abort();
jQuery.data['pref_' + name] = false;
}
jQuery.data['pref_' + name] = $.ajax({
type: "POST",
url: "/user/preferences/",
data: {
prop: name,
value: value
},
dataType: 'json',
timeout: function () {
jQuery.data['pref_' + name] = false;
},
error: function () {
jQuery.data['pref_' + name] = false;
},
success: function (data) {
if (data.success) {
humane.info(data.message);
}
else {
humane.error(data.message);
}
jQuery.data['pref_' + name] = false;
return;
}
});
}
function infoDialog(el) { function infoDialog(el) {

View File

@@ -48,7 +48,7 @@ var publicationModule = (function () {
}); });
} }
} }
afterSearch(); searchModule.afterSearch();
}); });
}); });
@@ -178,7 +178,7 @@ var publicationModule = (function () {
if (ajaxState.isRunning && ajaxState.query.abort) if (ajaxState.isRunning && ajaxState.query.abort)
answAjax.abort(); answAjax.abort();
if (page === 0) if (page === 0)
clearAnswers(); searchModule.clearAnswers();
ajaxState.isRunning = true; ajaxState.isRunning = true;
$answers.addClass('loading'); $answers.addClass('loading');
}, },
@@ -307,7 +307,7 @@ var publicationModule = (function () {
container: $answers container: $answers
}); });
afterSearch(); searchModule.afterSearch();
if (page > 0) { if (page > 0) {
$answers.stop().animate({ $answers.stop().animate({
scrollTop: $answers.scrollTop() + $answers.height() scrollTop: $answers.scrollTop() + $answers.height()

View File

@@ -0,0 +1,319 @@
var p4 = p4 || {};
var searchModule = (function (p4) {
function toggleCollection(deployer, todeploy_selector)
{
if($(deployer).hasClass("deployer_opened")) {
$(deployer).removeClass("deployer_opened").addClass("deployer_closed");
$(todeploy_selector).hide();
}
else {
$(deployer).removeClass("deployer_closed").addClass("deployer_opened");
$(todeploy_selector).show();
}
}
function selectDatabase(el, sbas_id) {
console.log('ok select')
var bool = $(el).prop('checked');
$.each($('.sbascont_' + sbas_id + ' :checkbox'), function () {
this.checked = bool;
});
checkFilters(true);
}
function clearAnswers() {
$('#formAnswerPage').val('');
$('#searchForm input[name="nba"]').val('');
$('#answers, #dyn_tool').empty();
}
function newSearch(query) {
p4.Results.Selection.empty();
searchModule.clearAnswers();
$('#SENT_query').val(query);
var histo = $('#history-queries ul');
histo.prepend('<li onclick="doSpecialSearch(\'' + query.replace(/\'/g, "\\'") + '\')">' + query + '</li>');
var lis = $('li', histo);
if (lis.length > 25) {
$('li:last', histo).remove();
}
$('#idFrameC li.proposals_WZ').removeClass('active');
$('#searchForm').submit();
return false;
}
function beforeSearch() {
if (answAjaxrunning)
return;
answAjaxrunning = true;
searchModule.clearAnswers();
$('#tooltip').css({
'display': 'none'
});
$('#answers').addClass('loading').empty();
$('#answercontextwrap').remove();
}
function afterSearch() {
if ($('#answercontextwrap').length === 0)
$('body').append('<div id="answercontextwrap"></div>');
$.each($('#answers .contextMenuTrigger'), function () {
var id = $(this).closest('.IMGT').attr('id').split('_').slice(1, 3).join('_');
$(this).contextMenu('#IMGT_' + id + ' .answercontextmenu', {
appendTo: '#answercontextwrap',
openEvt: 'click',
dropDown: true,
theme: 'vista',
showTransition: 'slideDown',
hideTransition: 'hide',
shadow: false
});
});
answAjaxrunning = false;
$('#answers').removeClass('loading');
$('.captionTips, .captionRolloverTips').tooltip({
delay: 0,
isBrowsable: false,
extraClass: 'caption-tooltip-container'
});
$('.infoTips').tooltip({
delay: 0
});
$('.previewTips').tooltip({
fixable: true
});
$('.thumb .rollovable').hover(
function () {
$('.rollover-gif-hover', this).show();
$('.rollover-gif-out', this).hide();
},
function () {
$('.rollover-gif-hover', this).hide();
$('.rollover-gif-out', this).show();
}
);
viewNbSelect();
$('#answers div.IMGT').draggable({
helper: function () {
$('body').append('<div id="dragDropCursor" style="position:absolute;z-index:9999;background:red;-moz-border-radius:8px;-webkit-border-radius:8px;"><div style="padding:2px 5px;font-weight:bold;">' + p4.Results.Selection.length() + '</div></div>');
return $('#dragDropCursor');
},
scope: "objects",
distance: 20,
scroll: false,
cursorAt: {
top: -10,
left: -20
},
start: function (event, ui) {
if (!$(this).hasClass('selected'))
return false;
}
});
linearize();
}
function checkFilters(save) {
var danger = false;
var search = {
bases: {},
fields: [],
dates: {},
status: [],
elasticSort: {}
};
var adv_box = $('form.phrasea_query .adv_options');
var container = $("#ADVSRCH_OPTIONS_ZONE");
var fieldsSort = $('#ADVSRCH_SORT_ZONE select[name=sort]', container);
var fieldsSortOrd = $('#ADVSRCH_SORT_ZONE select[name=ord]', container);
var fieldsSelect = $('#ADVSRCH_FIELDS_ZONE select', container);
var dateFilterSelect = $('#ADVSRCH_DATE_ZONE select', container);
var scroll = fieldsSelect.scrollTop();
// hide all the fields in the "sort by" select, so only the relevant ones will be shown again
$("option.dbx", fieldsSort).hide().prop("disabled", true); // dbx is for "field of databases"
// hide all the fields in the "fields" select, so only the relevant ones will be shown again
$("option.dbx", fieldsSelect).hide().prop("disabled", true); // option[0] is "all fields"
// hide all the fields in the "date field" select, so only the relevant ones will be shown again
$("option.dbx", dateFilterSelect).hide().prop("disabled", true); // dbx = all "field" entries in the select = all except the firstt
var nbTotalSelectedColls = 0;
$.each($('.sbascont', adv_box), function () {
var $this = $(this);
var sbas_id = $this.parent().find('input[name="reference"]').val();
search.bases[sbas_id] = [];
var nbCols = 0;
var nbSelectedColls = 0;
$this.find('.checkbas').each(function (idx, el) {
nbCols++;
if($(this).prop('checked')) {
nbSelectedColls++;
nbTotalSelectedColls++;
search.bases[sbas_id].push($(this).val());
}
});
// display the number of selected colls for the databox
$('.infos_sbas_' + sbas_id).empty().append(nbSelectedColls + '/' + nbCols);
// if one coll is not checked, show danger
if(nbSelectedColls != nbCols) {
$("#ADVSRCH_SBAS_LABEL_" + sbas_id).addClass("danger");
danger = true;
}
else {
$("#ADVSRCH_SBAS_LABEL_" + sbas_id).removeClass("danger");
}
if(nbSelectedColls == 0) {
// no collections checked for this databox
// hide the status bits
$("#ADVSRCH_SB_ZONE_"+sbas_id, container).hide();
// uncheck
$("#ADVSRCH_SB_ZONE_"+sbas_id+" input:checkbox", container).prop("checked", false);
}
else {
// at least one coll checked for this databox
// show again the relevant fields in "sort by" select
$(".db_"+sbas_id, fieldsSort).show().prop("disabled", false);
// show again the relevant fields in "from fields" select
$(".db_"+sbas_id, fieldsSelect).show().prop("disabled", false);
// show the sb
$("#ADVSRCH_SB_ZONE_"+sbas_id, container).show();
// show again the relevant fields in "date field" select
$(".db_"+sbas_id, dateFilterSelect).show().prop("disabled", false);
}
});
if (nbTotalSelectedColls == 0) {
// no collections checked at all
// hide irrelevant filters
$("#ADVSRCH_OPTIONS_ZONE").hide();
}
else {
// at least one collection checked
// show relevant filters
$("#ADVSRCH_OPTIONS_ZONE").show();
}
// --------- sort --------
// if no field is selected for sort, select the default option
if($("option:selected:enabled", fieldsSort).length == 0) {
$("option.default-selection", fieldsSort).prop("selected", true);
$("option.default-selection", fieldsSortOrd).prop("selected", true);
}
search.elasticSort.by = $("option:selected:enabled", fieldsSort).val();
search.elasticSort.order = $("option:selected:enabled", fieldsSortOrd).val();
//--------- from fields filter ---------
// unselect the unavailable fields (or all fields if "all" is selected)
var optAllSelected = false;
$("option", fieldsSelect).each(
function(idx, opt) {
if(idx == 0) {
// nb: unselect the "all" field, so it acts as a button
optAllSelected = $(opt).is(":selected");
}
if(idx == 0 || optAllSelected || $(opt).is(":disabled") || !$(opt).is(":visible") ) {
$(opt).prop("selected", false);
}
}
);
// here only the relevant fields are selected
search.fields = fieldsSelect.val();
if(search.fields == null || search.fields.length == 0) {
$('#ADVSRCH_FIELDS_ZONE', container).removeClass('danger');
search.fields = [];
}
else {
$('#ADVSRCH_FIELDS_ZONE', container).addClass('danger');
danger = true;
}
//--------- status bits filter ---------
// here only the relevant sb are checked
for(sbas_id in search.bases) {
var nchecked = 0;
$("#ADVSRCH_SB_ZONE_"+sbas_id+" :checkbox[checked]", container).each(function () {
var n = $(this).attr('n');
search.status[n] = $(this).val().split('_');
nchecked++;
});
if(nchecked == 0) {
$("#ADVSRCH_SB_ZONE_"+sbas_id, container).removeClass('danger');
}
else {
$("#ADVSRCH_SB_ZONE_"+sbas_id, container).addClass('danger');
danger = true;
}
}
//--------- dates filter ---------
// if no date field is selected for filter, select the first option
$('#ADVSRCH_DATE_ZONE', adv_box).removeClass('danger');
if($("option.dbx:selected:enabled", dateFilterSelect).length == 0) {
$("option:eq(0)", dateFilterSelect).prop("selected", true);
$("#ADVSRCH_DATE_SELECTORS", container).hide();
}
else {
$("#ADVSRCH_DATE_SELECTORS", container).show();
search.dates.minbound = $('#ADVSRCH_DATE_ZONE input[name=date_min]', adv_box).val();
search.dates.maxbound = $('#ADVSRCH_DATE_ZONE input[name=date_max]', adv_box).val();
search.dates.field = $('#ADVSRCH_DATE_ZONE select[name=date_field]', adv_box).val();
console.log(search.dates.minbound, search.dates.maxbound, search.dates.field)
if ($.trim(search.dates.minbound) || $.trim(search.dates.maxbound)) {
danger = true;
$('#ADVSRCH_DATE_ZONE', adv_box).addClass('danger');
}
}
fieldsSelect.scrollTop(scroll);
// if one filter shows danger, show it on the query
if (danger) {
$('#EDIT_query').addClass('danger');
}
else {
$('#EDIT_query').removeClass('danger');
}
if (save === true) {
userModule.setPref('search', JSON.stringify(search));
}
}
return {
checkFilters: checkFilters,
toggleCollection: toggleCollection,
selectDatabase: selectDatabase,
beforeSearch: beforeSearch,
afterSearch: afterSearch,
clearAnswers: clearAnswers,
newSearch: newSearch
};
}(p4));

View File

@@ -0,0 +1,65 @@
var p4 = p4 || {};
var utilsModule = (function (p4) {
function RGBtoHex(R, G, B) {
return toHex(R) + toHex(G) + toHex(B);
}
function toHex(N) {
if (N === null) return "00";
N = parseInt(N);
if (N === 0 || isNaN(N)) return "00";
N = Math.max(0, N);
N = Math.min(N, 255);
N = Math.round(N);
return "0123456789ABCDEF".charAt((N - N % 16) / 16)
+ "0123456789ABCDEF".charAt(N % 16);
}
function hsl2rgb(h, s, l) {
var m1, m2, hue;
var r, g, b;
s /= 100;
l /= 100;
if (s === 0)
r = g = b = (l * 255);
else {
if (l <= 0.5)
m2 = l * (s + 1);
else
m2 = l + s - l * s;
m1 = l * 2 - m2;
hue = h / 360;
r = HueToRgb(m1, m2, hue + 1 / 3);
g = HueToRgb(m1, m2, hue);
b = HueToRgb(m1, m2, hue - 1 / 3);
}
return {
r: r,
g: g,
b: b
};
}
function HueToRgb(m1, m2, hue) {
var v;
if (hue < 0)
hue += 1;
else if (hue > 1)
hue -= 1;
if (6 * hue < 1)
v = m1 + (m2 - m1) * hue * 6;
else if (2 * hue < 1)
v = m2;
else if (3 * hue < 2)
v = m1 + (m2 - m1) * (2 / 3 - hue) * 6;
else
v = m1;
return 255 * v;
}
return {
RGBtoHex: RGBtoHex, hsl2rgb: hsl2rgb
};
}(p4));

View File

@@ -0,0 +1,102 @@
var p4 = p4 || {};
var workzoneBasketModule = (function (p4) {
function archiveBasket(basket_id) {
$.ajax({
type: "POST",
url: "../prod/baskets/" + basket_id + "/archive/?archive=1",
dataType: 'json',
beforeSend: function () {
},
success: function (data) {
if (data.success) {
var basket = $('#SSTT_' + basket_id);
var next = basket.next();
if (next.data("ui-droppable")) {
next.droppable('destroy');
}
next.slideUp().remove();
if (basket.data("ui-droppable")) {
basket.droppable('destroy');
}
basket.slideUp().remove();
if ($('#baskets .SSTT').length === 0) {
return p4.WorkZone.refresh(false);
}
}
else {
alert(data.message);
}
return;
}
});
}
function deleteBasket(item) {
if ($("#DIALOG").data("ui-dialog")) {
$("#DIALOG").dialog('destroy');
}
var k = $(item).attr('id').split('_').slice(1, 2).pop(); // id de chutier
$.ajax({
type: "POST",
url: "../prod/baskets/" + k + '/delete/',
dataType: 'json',
beforeSend: function () {
},
success: function (data) {
if (data.success) {
var basket = $('#SSTT_' + k);
var next = basket.next();
if (next.data("ui-droppable")) {
next.droppable('destroy');
}
next.slideUp().remove();
if (basket.data("ui-droppable")) {
basket.droppable('destroy');
}
basket.slideUp().remove();
if ($('#baskets .SSTT').length === 0) {
return p4.WorkZone.refresh(false);
}
}
else {
alert(data.message);
}
return;
}
});
}
function openBasketPreferences() {
$('#basket_preferences').dialog({
closeOnEscape: true,
resizable: false,
width: 450,
height: 500,
modal: true,
draggable: false,
overlay: {
backgroundColor: '#000',
opacity: 0.7
}
}).dialog('open');
}
return {archiveBasket: archiveBasket, deleteBasket: deleteBasket, openBasketPreferences: openBasketPreferences}
})(p4);

View File

@@ -0,0 +1,162 @@
var p4 = p4 || {};
var workzoneFacetsModule = (function (p4) {
var selectedFacetValues = [];
var getSelectedFacets = function() {
return selectedFacetValues;
}
var resetSelectedFacets = function() {
selectedFacetValues = [];
return selectedFacetValues;
};
var loadFacets = function(facets) {
// Convert facets data to fancytree source format
var treeSource = _.map(facets, function(facet) {
// Values
var values = _.map(facet.values, function(value) {
return {
title: value.value + ' (' + value.count + ')',
query: value.query,
label: value.value,
tooltip: value.value + ' (' + value.count + ')'
}
});
// Facet
return {
name: facet.name,
title: facet.label,
folder: true,
children: values,
expanded: _.isUndefined(selectedFacetValues[facet.name])
};
});
treeSource.sort(_sortFacets('title', true, function(a){return a.toUpperCase()}));
treeSource = _sortByPredefinedFacets(treeSource, 'name', ['Base_Name', 'Collection_Name', 'Type_Name']);
return _getFacetsTree().reload(treeSource);
};
// from stackoverflow
// http://stackoverflow.com/questions/979256/sorting-an-array-of-javascript-objects/979325#979325
function _sortFacets(field, reverse, primer) {
var key = function (x) {return primer ? primer(x[field]) : x[field]};
return function (a,b) {
var A = key(a), B = key(b);
return ( (A < B) ? -1 : ((A > B) ? 1 : 0) ) * [-1,1][+!!reverse];
}
}
function _sortByPredefinedFacets(source, field, predefinedFieldOrder) {
var filteredSource = source,
ordered = [];
_.forEach(predefinedFieldOrder, function (fieldValue, index) {
_.forEach(source, function (facet, facetIndex) {
if (facet[field] !== undefined) {
if (facet[field] === fieldValue) {
ordered.push(facet);
// remove from filtered
filteredSource.splice(facetIndex, 1);
}
}
});
});
var olen = filteredSource.length;
// fill predefined facets with non predefined facets
for (var i = 0; i < olen; i++) {
ordered.push(filteredSource[i]);
}
return ordered;
}
function _getFacetsTree() {
var $facetsTree = $('#proposals');
if (!$facetsTree.data('ui-fancytree')) {
$facetsTree.fancytree({
clickFolderMode: 3, // activate and expand
icons:false,
source: [],
activate: function(event, data){
var query = data.node.data.query;
if (query) {
var facet = data.node.parent;
selectedFacetValues[facet.title] = data.node.data;
_facetCombinedSearch();
}
},
renderNode: function(event, data){
var facetFilter = "";
if(data.node.folder && !_.isUndefined(selectedFacetValues[data.node.title])) {
facetFilter = selectedFacetValues[data.node.title].label;
var s_label = document.createElement("SPAN");
s_label.setAttribute("class", "facetFilter-label");
s_label.setAttribute("title", facetFilter);
var length = 15;
var facetFilterString = facetFilter;
if( facetFilterString.length > length) {
facetFilterString = facetFilterString.substring(0,length) + '…';
}
s_label.appendChild(document.createTextNode(facetFilterString));
var s_closer = document.createElement("A");
s_closer.setAttribute("class", "facetFilter-closer");
var s_gradient = document.createElement("SPAN");
s_gradient.setAttribute("class", "facetFilter-gradient");
s_gradient.appendChild(document.createTextNode("\u00A0"));
s_label.appendChild(s_gradient);
var s_facet = document.createElement("SPAN");
s_facet.setAttribute("class", "facetFilter");
s_facet.appendChild(s_label);
s_closer = $(s_facet.appendChild(s_closer));
s_closer.data("facetTitle", data.node.title);
s_closer.click(
function(event) {
event.stopPropagation();
var facetTitle = $(this).data("facetTitle");
delete selectedFacetValues[facetTitle];
_facetCombinedSearch();
return false;
}
);
$(".fancytree-folder", data.node.li).append(
$(s_facet)
);
}
}
});
}
return $facetsTree.fancytree('getTree');
}
function _facetCombinedSearch() {
var q = $("#EDIT_query").val();
var q_facet = "";
_.each(_.values(selectedFacetValues), function(facetValue) {
q_facet += (q_facet ? " AND " : "") + '(' + facetValue.query + ')';
});
if(q_facet) {
if(q) {
q = '(' + q + ') AND '
}
q += q_facet;
}
searchModule.checkFilters();
searchModule.newSearch(q);
}
return { loadFacets: loadFacets, getSelectedFacets: getSelectedFacets, resetSelectedFacets: resetSelectedFacets}
})(p4);

View File

@@ -1,6 +1,6 @@
var p4 = p4 || {}; var p4 = p4 || {};
(function (p4) { var workzoneModule = (function (p4) {
function refreshBaskets(baskId, sort, scrolltobottom, type) { function refreshBaskets(baskId, sort, scrolltobottom, type) {
type = typeof type === 'undefined' ? 'basket' : type; type = typeof type === 'undefined' ? 'basket' : type;

View File

@@ -1,785 +0,0 @@
/*!
* jQuery Form Plugin
* version: 2.49 (18-OCT-2010)
* @requires jQuery v1.3.2 or later
*
* Examples and documentation at: http://malsup.com/jquery/form/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
;(function($) {
/*
Usage Note:
-----------
Do not use both ajaxSubmit and ajaxForm on the same form. These
functions are intended to be exclusive. Use ajaxSubmit if you want
to bind your own submit handler to the form. For example,
$(document).ready(function() {
$('#myForm').bind('submit', function(e) {
e.preventDefault(); // <-- important
$(this).ajaxSubmit({
target: '#output'
});
});
});
Use ajaxForm when you want the plugin to manage all the event binding
for you. For example,
$(document).ready(function() {
$('#myForm').ajaxForm({
target: '#output'
});
});
When using ajaxForm, the ajaxSubmit function will be invoked for you
at the appropriate time.
*/
/**
* ajaxSubmit() provides a mechanism for immediately submitting
* an HTML form using AJAX.
*/
$.fn.ajaxSubmit = function(options) {
// fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
if (!this.length) {
log('ajaxSubmit: skipping submit process - no element selected');
return this;
}
if (typeof options == 'function') {
options = { success: options };
}
var url = $.trim(this.attr('action'));
if (url) {
// clean url (don't include hash vaue)
url = (url.match(/^([^#]+)/)||[])[1];
}
url = url || window.location.href || '';
options = $.extend(true, {
url: url,
type: this.attr('method') || 'GET',
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
}, options);
// hook for manipulating the form data before it is extracted;
// convenient for use with rich editors like tinyMCE or FCKEditor
var veto = {};
this.trigger('form-pre-serialize', [this, options, veto]);
if (veto.veto) {
log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
return this;
}
// provide opportunity to alter form data before it is serialized
if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
log('ajaxSubmit: submit aborted via beforeSerialize callback');
return this;
}
var n,v,a = this.formToArray(options.semantic);
if (options.data) {
options.extraData = options.data;
for (n in options.data) {
if(options.data[n] instanceof Array) {
for (var k in options.data[n]) {
a.push( { name: n, value: options.data[n][k] } );
}
}
else {
v = options.data[n];
v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
a.push( { name: n, value: v } );
}
}
}
// give pre-submit callback an opportunity to abort the submit
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
log('ajaxSubmit: submit aborted via beforeSubmit callback');
return this;
}
// fire vetoable 'validate' event
this.trigger('form-submit-validate', [a, this, options, veto]);
if (veto.veto) {
log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
return this;
}
var q = $.param(a);
if (options.type.toUpperCase() == 'GET') {
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
options.data = null; // data is null for 'get'
}
else {
options.data = q; // data is the query string for 'post'
}
var $form = this, callbacks = [];
if (options.resetForm) {
callbacks.push(function() { $form.resetForm(); });
}
if (options.clearForm) {
callbacks.push(function() { $form.clearForm(); });
}
// perform a load on the target only if dataType is not provided
if (!options.dataType && options.target) {
var oldSuccess = options.success || function(){};
callbacks.push(function(data) {
var fn = options.replaceTarget ? 'replaceWith' : 'html';
$(options.target)[fn](data).each(oldSuccess, arguments);
});
}
else if (options.success) {
callbacks.push(options.success);
}
options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
var context = options.context || options; // jQuery 1.4+ supports scope context
for (var i=0, max=callbacks.length; i < max; i++) {
callbacks[i].apply(context, [data, status, xhr || $form, $form]);
}
};
// are there files to upload?
var fileInputs = $('input:file', this).length > 0;
var mp = 'multipart/form-data';
var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
// options.iframe allows user to force iframe mode
// 06-NOV-09: now defaulting to iframe mode if file input is detected
if (options.iframe !== false && (fileInputs || options.iframe || multipart)) {
// hack to fix Safari hang (thanks to Tim Molendijk for this)
// see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
if (options.closeKeepAlive) {
$.get(options.closeKeepAlive, fileUpload);
}
else {
fileUpload();
}
}
else {
$.ajax(options);
}
// fire 'notify' event
this.trigger('form-submit-notify', [this, options]);
return this;
// private function for handling file uploads (hat tip to YAHOO!)
function fileUpload() {
var form = $form[0];
if ($(':input[name=submit],:input[id=submit]', form).length) {
// if there is an input with a name or id of 'submit' then we won't be
// able to invoke the submit fn on the form (at least not x-browser)
alert('Error: Form elements must not have name or id of "submit".');
return;
}
var s = $.extend(true, {}, $.ajaxSettings, options);
s.context = s.context || s;
var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id;
window[fn] = function() {
var f = $io.data('form-plugin-onload');
if (f) {
f();
window[fn] = undefined;
try { delete window[fn]; } catch(e){}
}
}
var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ s.iframeSrc +'" onload="window[\'_\'+this.id]()" />');
var io = $io[0];
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
var xhr = { // mock object
aborted: 0,
responseText: null,
responseXML: null,
status: 0,
statusText: 'n/a',
getAllResponseHeaders: function() {},
getResponseHeader: function() {},
setRequestHeader: function() {},
abort: function() {
this.aborted = 1;
$io.attr('src', s.iframeSrc); // abort op in progress
}
};
var g = s.global;
// trigger ajax global events so that activity/block indicators work like normal
if (g && ! $.active++) {
$.event.trigger("ajaxStart");
}
if (g) {
$.event.trigger("ajaxSend", [xhr, s]);
}
if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
if (s.global) {
$.active--;
}
return;
}
if (xhr.aborted) {
return;
}
var cbInvoked = false;
var timedOut = 0;
// add submitting element to data if we know it
var sub = form.clk;
if (sub) {
var n = sub.name;
if (n && !sub.disabled) {
s.extraData = s.extraData || {};
s.extraData[n] = sub.value;
if (sub.type == "image") {
s.extraData[n+'.x'] = form.clk_x;
s.extraData[n+'.y'] = form.clk_y;
}
}
}
// take a breath so that pending repaints get some cpu time before the upload starts
function doSubmit() {
// make sure form attrs are set
var t = $form.attr('target'), a = $form.attr('action');
// update form attrs in IE friendly way
form.setAttribute('target',id);
if (form.getAttribute('method') != 'POST') {
form.setAttribute('method', 'POST');
}
if (form.getAttribute('action') != s.url) {
form.setAttribute('action', s.url);
}
// ie borks in some cases when setting encoding
if (! s.skipEncodingOverride) {
$form.attr({
encoding: 'multipart/form-data',
enctype: 'multipart/form-data'
});
}
// support timout
if (s.timeout) {
setTimeout(function() { timedOut = true; cb(); }, s.timeout);
}
// add "extra" data to form if provided in options
var extraInputs = [];
try {
if (s.extraData) {
for (var n in s.extraData) {
extraInputs.push(
$('<input type="hidden" name="'+n+'" value="'+s.extraData[n]+'" />')
.appendTo(form)[0]);
}
}
// add iframe to doc and submit the form
$io.appendTo('body');
$io.data('form-plugin-onload', cb);
form.submit();
}
finally {
// reset attrs and remove "extra" input elements
form.setAttribute('action',a);
if(t) {
form.setAttribute('target', t);
} else {
$form.removeAttr('target');
}
$(extraInputs).remove();
}
}
if (s.forceSync) {
doSubmit();
}
else {
setTimeout(doSubmit, 10); // this lets dom updates render
}
var data, doc, domCheckCount = 50;
function cb() {
if (cbInvoked) {
return;
}
$io.removeData('form-plugin-onload');
var ok = true;
try {
if (timedOut) {
throw 'timeout';
}
// extract the server response from the iframe
doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
log('isXml='+isXml);
if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) {
if (--domCheckCount) {
// in some browsers (Opera) the iframe DOM is not always traversable when
// the onload callback fires, so we loop a bit to accommodate
log('requeing onLoad callback, DOM not available');
setTimeout(cb, 250);
return;
}
// let this fall through because server response could be an empty document
//log('Could not access iframe DOM after mutiple tries.');
//throw 'DOMException: not available';
}
//log('response detected');
cbInvoked = true;
xhr.responseText = doc.documentElement ? doc.documentElement.innerHTML : null;
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
xhr.getResponseHeader = function(header){
var headers = {'content-type': s.dataType};
return headers[header];
};
var scr = /(json|script)/.test(s.dataType);
if (scr || s.textarea) {
// see if user embedded response in textarea
var ta = doc.getElementsByTagName('textarea')[0];
if (ta) {
xhr.responseText = ta.value;
}
else if (scr) {
// account for browsers injecting pre around json response
var pre = doc.getElementsByTagName('pre')[0];
var b = doc.getElementsByTagName('body')[0];
if (pre) {
xhr.responseText = pre.innerHTML;
}
else if (b) {
xhr.responseText = b.innerHTML;
}
}
}
else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
xhr.responseXML = toXml(xhr.responseText);
}
data = $.httpData(xhr, s.dataType);
}
catch(e){
log('error caught:',e);
ok = false;
xhr.error = e;
$.handleError(s, xhr, 'error', e);
}
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
if (ok) {
s.success.call(s.context, data, 'success', xhr);
if (g) {
$.event.trigger("ajaxSuccess", [xhr, s]);
}
}
if (g) {
$.event.trigger("ajaxComplete", [xhr, s]);
}
if (g && ! --$.active) {
$.event.trigger("ajaxStop");
}
if (s.complete) {
s.complete.call(s.context, xhr, ok ? 'success' : 'error');
}
// clean up
setTimeout(function() {
$io.removeData('form-plugin-onload');
$io.remove();
xhr.responseXML = null;
}, 100);
}
function toXml(s, doc) {
if (window.ActiveXObject) {
doc = new ActiveXObject('Microsoft.XMLDOM');
doc.async = 'false';
doc.loadXML(s);
}
else {
doc = (new DOMParser()).parseFromString(s, 'text/xml');
}
return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
}
}
};
/**
* ajaxForm() provides a mechanism for fully automating form submission.
*
* The advantages of using this method instead of ajaxSubmit() are:
*
* 1: This method will include coordinates for <input type="image" /> elements (if the element
* is used to submit the form).
* 2. This method will include the submit element's name/value data (for the element that was
* used to submit the form).
* 3. This method binds the submit() method to the form for you.
*
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
* passes the options argument along after properly binding events for submit elements and
* the form itself.
*/
$.fn.ajaxForm = function(options) {
// in jQuery 1.3+ we can fix mistakes with the ready state
if (this.length === 0) {
var o = { s: this.selector, c: this.context };
if (!$.isReady && o.s) {
log('DOM not ready, queuing ajaxForm');
$(function() {
$(o.s,o.c).ajaxForm(options);
});
return this;
}
// is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
return this;
}
return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
e.preventDefault();
$(this).ajaxSubmit(options);
}
}).bind('click.form-plugin', function(e) {
var target = e.target;
var $el = $(target);
if (!($el.is(":submit,input:image"))) {
// is this a child element of the submit el? (ex: a span within a button)
var t = $el.closest(':submit');
if (t.length == 0) {
return;
}
target = t[0];
}
var form = this;
form.clk = target;
if (target.type == 'image') {
if (e.offsetX != undefined) {
form.clk_x = e.offsetX;
form.clk_y = e.offsetY;
} else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
var offset = $el.offset();
form.clk_x = e.pageX - offset.left;
form.clk_y = e.pageY - offset.top;
} else {
form.clk_x = e.pageX - target.offsetLeft;
form.clk_y = e.pageY - target.offsetTop;
}
}
// clear form vars
setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
});
};
// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
$.fn.ajaxFormUnbind = function() {
return this.unbind('submit.form-plugin click.form-plugin');
};
/**
* formToArray() gathers form element data into an array of objects that can
* be passed to any of the following ajax functions: $.get, $.post, or load.
* Each object in the array has both a 'name' and 'value' property. An example of
* an array for a simple login form might be:
*
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
*
* It is this array that is passed to pre-submit callback functions provided to the
* ajaxSubmit() and ajaxForm() methods.
*/
$.fn.formToArray = function(semantic) {
var a = [];
if (this.length === 0) {
return a;
}
var form = this[0];
var els = semantic ? form.getElementsByTagName('*') : form.elements;
if (!els) {
return a;
}
var i,j,n,v,el,max,jmax;
for(i=0, max=els.length; i < max; i++) {
el = els[i];
n = el.name;
if (!n) {
continue;
}
if (semantic && form.clk && el.type == "image") {
// handle image inputs on the fly when semantic == true
if(!el.disabled && form.clk == el) {
a.push({name: n, value: $(el).val()});
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
}
continue;
}
v = $.fieldValue(el, true);
if (v && v.constructor == Array) {
for(j=0, jmax=v.length; j < jmax; j++) {
a.push({name: n, value: v[j]});
}
}
else if (v !== null && typeof v != 'undefined') {
a.push({name: n, value: v});
}
}
if (!semantic && form.clk) {
// input type=='image' are not found in elements array! handle it here
var $input = $(form.clk), input = $input[0];
n = input.name;
if (n && !input.disabled && input.type == 'image') {
a.push({name: n, value: $input.val()});
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
}
}
return a;
};
/**
* Serializes form data into a 'submittable' string. This method will return a string
* in the format: name1=value1&amp;name2=value2
*/
$.fn.formSerialize = function(semantic) {
//hand off to jQuery.param for proper encoding
return $.param(this.formToArray(semantic));
};
/**
* Serializes all field elements in the jQuery object into a query string.
* This method will return a string in the format: name1=value1&amp;name2=value2
*/
$.fn.fieldSerialize = function(successful) {
var a = [];
this.each(function() {
var n = this.name;
if (!n) {
return;
}
var v = $.fieldValue(this, successful);
if (v && v.constructor == Array) {
for (var i=0,max=v.length; i < max; i++) {
a.push({name: n, value: v[i]});
}
}
else if (v !== null && typeof v != 'undefined') {
a.push({name: this.name, value: v});
}
});
//hand off to jQuery.param for proper encoding
return $.param(a);
};
/**
* Returns the value(s) of the element in the matched set. For example, consider the following form:
*
* <form><fieldset>
* <input name="A" type="text" />
* <input name="A" type="text" />
* <input name="B" type="checkbox" value="B1" />
* <input name="B" type="checkbox" value="B2"/>
* <input name="C" type="radio" value="C1" />
* <input name="C" type="radio" value="C2" />
* </fieldset></form>
*
* var v = $(':text').fieldValue();
* // if no values are entered into the text inputs
* v == ['','']
* // if values entered into the text inputs are 'foo' and 'bar'
* v == ['foo','bar']
*
* var v = $(':checkbox').fieldValue();
* // if neither checkbox is checked
* v === undefined
* // if both checkboxes are checked
* v == ['B1', 'B2']
*
* var v = $(':radio').fieldValue();
* // if neither radio is checked
* v === undefined
* // if first radio is checked
* v == ['C1']
*
* The successful argument controls whether or not the field element must be 'successful'
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
* The default value of the successful argument is true. If this value is false the value(s)
* for each element is returned.
*
* Note: This method *always* returns an array. If no valid value can be determined the
* array will be empty, otherwise it will contain one or more values.
*/
$.fn.fieldValue = function(successful) {
for (var val=[], i=0, max=this.length; i < max; i++) {
var el = this[i];
var v = $.fieldValue(el, successful);
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
continue;
}
v.constructor == Array ? $.merge(val, v) : val.push(v);
}
return val;
};
/**
* Returns the value of the field element.
*/
$.fieldValue = function(el, successful) {
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
if (successful === undefined) {
successful = true;
}
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
(t == 'checkbox' || t == 'radio') && !el.checked ||
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
tag == 'select' && el.selectedIndex == -1)) {
return null;
}
if (tag == 'select') {
var index = el.selectedIndex;
if (index < 0) {
return null;
}
var a = [], ops = el.options;
var one = (t == 'select-one');
var max = (one ? index+1 : ops.length);
for(var i=(one ? index : 0); i < max; i++) {
var op = ops[i];
if (op.selected) {
var v = op.value;
if (!v) { // extra pain for IE...
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
}
if (one) {
return v;
}
a.push(v);
}
}
return a;
}
return $(el).val();
};
/**
* Clears the form data. Takes the following actions on the form's input fields:
* - input text fields will have their 'value' property set to the empty string
* - select elements will have their 'selectedIndex' property set to -1
* - checkbox and radio inputs will have their 'checked' property set to false
* - inputs of type submit, button, reset, and hidden will *not* be effected
* - button elements will *not* be effected
*/
$.fn.clearForm = function() {
return this.each(function() {
$('input,select,textarea', this).clearFields();
});
};
/**
* Clears the selected form elements.
*/
$.fn.clearFields = $.fn.clearInputs = function() {
return this.each(function() {
var t = this.type, tag = this.tagName.toLowerCase();
if (t == 'text' || t == 'password' || tag == 'textarea') {
this.value = '';
}
else if (t == 'checkbox' || t == 'radio') {
this.checked = false;
}
else if (tag == 'select') {
this.selectedIndex = -1;
}
});
};
/**
* Resets the form data. Causes all form elements to be reset to their original value.
*/
$.fn.resetForm = function() {
return this.each(function() {
// guard against an input with the name of 'reset'
// note that IE reports the reset function as an 'object'
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
this.reset();
}
});
};
/**
* Enables or disables any matching elements.
*/
$.fn.enable = function(b) {
if (b === undefined) {
b = true;
}
return this.each(function() {
this.disabled = !b;
});
};
/**
* Checks/unchecks any matching checkboxes or radio buttons and
* selects/deselects and matching option elements.
*/
$.fn.selected = function(select) {
if (select === undefined) {
select = true;
}
return this.each(function() {
var t = this.type;
if (t == 'checkbox' || t == 'radio') {
this.checked = select;
}
else if (this.tagName.toLowerCase() == 'option') {
var $sel = $(this).parent('select');
if (select && $sel[0] && $sel[0].type == 'select-one') {
// deselect all other options
$sel.find('option').selected(false);
}
this.selected = select;
}
});
};
// helper fn for console logging
// set $.fn.ajaxSubmit.debug to true to enable debug logging
function log() {
if ($.fn.ajaxSubmit.debug) {
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
if (window.console && window.console.log) {
window.console.log(msg);
}
else if (window.opera && window.opera.postError) {
window.opera.postError(msg);
}
}
};
})(jQuery);

View File

@@ -28,8 +28,8 @@ function getHome(cas, page) {
switch (cas) { switch (cas) {
case 'QUERY': case 'QUERY':
selectedFacetValues = []; workzoneFacetsModule.resetSelectedFacets();
newSearch($("#EDIT_query").val()); searchModule.newSearch($("#EDIT_query").val());
break; break;
case 'PUBLI': case 'PUBLI':
publicationModule.fetchPublications(page, answAjax, answAjaxrunning); publicationModule.fetchPublications(page, answAjax, answAjaxrunning);
@@ -45,7 +45,7 @@ function getHome(cas, page) {
beforeSend: function () { beforeSend: function () {
if (answAjaxrunning && answAjax.abort) if (answAjaxrunning && answAjax.abort)
answAjax.abort(); answAjax.abort();
clearAnswers(); searchModule.clearAnswers();
answAjaxrunning = true; answAjaxrunning = true;
$('#answers').addClass('loading'); $('#answers').addClass('loading');
}, },
@@ -60,7 +60,7 @@ function getHome(cas, page) {
success: function (data) { success: function (data) {
answAjaxrunning = false; answAjaxrunning = false;
$('#answers').append(data); $('#answers').append(data);
afterSearch(); searchModule.afterSearch();
return; return;
} }
@@ -123,203 +123,24 @@ function checkBases(bool) {
$(this).find(':checkbox').prop('checked', false); $(this).find(':checkbox').prop('checked', false);
}); });
checkFilters(true); searchModule.checkFilters(true);
} }
function checkFilters(save) {
var danger = false;
var search = {
bases: {},
fields: [],
dates: {},
status: [],
elasticSort: {}
};
var adv_box = $('form.phrasea_query .adv_options'); /* NOT USED function toggleFilter(filter, ele) {
var container = $("#ADVSRCH_OPTIONS_ZONE");
var fieldsSort = $('#ADVSRCH_SORT_ZONE select[name=sort]', container);
var fieldsSortOrd = $('#ADVSRCH_SORT_ZONE select[name=ord]', container);
var fieldsSelect = $('#ADVSRCH_FIELDS_ZONE select', container);
var dateFilterSelect = $('#ADVSRCH_DATE_ZONE select', container);
var scroll = fieldsSelect.scrollTop();
// hide all the fields in the "sort by" select, so only the relevant ones will be shown again
$("option.dbx", fieldsSort).hide().prop("disabled", true); // dbx is for "field of databases"
// hide all the fields in the "fields" select, so only the relevant ones will be shown again
$("option.dbx", fieldsSelect).hide().prop("disabled", true); // option[0] is "all fields"
// hide all the fields in the "date field" select, so only the relevant ones will be shown again
$("option.dbx", dateFilterSelect).hide().prop("disabled", true); // dbx = all "field" entries in the select = all except the firstt
var nbTotalSelectedColls = 0;
$.each($('.sbascont', adv_box), function () {
var $this = $(this);
var sbas_id = $this.parent().find('input[name="reference"]').val();
search.bases[sbas_id] = [];
var nbCols = 0;
var nbSelectedColls = 0;
$this.find('.checkbas').each(function (idx, el) {
nbCols++;
if($(this).prop('checked')) {
nbSelectedColls++;
nbTotalSelectedColls++;
search.bases[sbas_id].push($(this).val());
}
});
// display the number of selected colls for the databox
$('.infos_sbas_' + sbas_id).empty().append(nbSelectedColls + '/' + nbCols);
// if one coll is not checked, show danger
if(nbSelectedColls != nbCols) {
$("#ADVSRCH_SBAS_LABEL_" + sbas_id).addClass("danger");
danger = true;
}
else {
$("#ADVSRCH_SBAS_LABEL_" + sbas_id).removeClass("danger");
}
if(nbSelectedColls == 0) {
// no collections checked for this databox
// hide the status bits
$("#ADVSRCH_SB_ZONE_"+sbas_id, container).hide();
// uncheck
$("#ADVSRCH_SB_ZONE_"+sbas_id+" input:checkbox", container).prop("checked", false);
}
else {
// at least one coll checked for this databox
// show again the relevant fields in "sort by" select
$(".db_"+sbas_id, fieldsSort).show().prop("disabled", false);
// show again the relevant fields in "from fields" select
$(".db_"+sbas_id, fieldsSelect).show().prop("disabled", false);
// show the sb
$("#ADVSRCH_SB_ZONE_"+sbas_id, container).show();
// show again the relevant fields in "date field" select
$(".db_"+sbas_id, dateFilterSelect).show().prop("disabled", false);
}
});
if (nbTotalSelectedColls == 0) {
// no collections checked at all
// hide irrelevant filters
$("#ADVSRCH_OPTIONS_ZONE").hide();
}
else {
// at least one collection checked
// show relevant filters
$("#ADVSRCH_OPTIONS_ZONE").show();
}
// --------- sort --------
// if no field is selected for sort, select the default option
if($("option:selected:enabled", fieldsSort).length == 0) {
$("option.default-selection", fieldsSort).prop("selected", true);
$("option.default-selection", fieldsSortOrd).prop("selected", true);
}
search.elasticSort.by = $("option:selected:enabled", fieldsSort).val();
search.elasticSort.order = $("option:selected:enabled", fieldsSortOrd).val();
//--------- from fields filter ---------
// unselect the unavailable fields (or all fields if "all" is selected)
var optAllSelected = false;
$("option", fieldsSelect).each(
function(idx, opt) {
if(idx == 0) {
// nb: unselect the "all" field, so it acts as a button
optAllSelected = $(opt).is(":selected");
}
if(idx == 0 || optAllSelected || $(opt).is(":disabled") || !$(opt).is(":visible") ) {
$(opt).prop("selected", false);
}
}
);
// here only the relevant fields are selected
search.fields = fieldsSelect.val();
if(search.fields == null || search.fields.length == 0) {
$('#ADVSRCH_FIELDS_ZONE', container).removeClass('danger');
search.fields = [];
}
else {
$('#ADVSRCH_FIELDS_ZONE', container).addClass('danger');
danger = true;
}
//--------- status bits filter ---------
// here only the relevant sb are checked
for(sbas_id in search.bases) {
var nchecked = 0;
$("#ADVSRCH_SB_ZONE_"+sbas_id+" :checkbox[checked]", container).each(function () {
var n = $(this).attr('n');
search.status[n] = $(this).val().split('_');
nchecked++;
});
if(nchecked == 0) {
$("#ADVSRCH_SB_ZONE_"+sbas_id, container).removeClass('danger');
}
else {
$("#ADVSRCH_SB_ZONE_"+sbas_id, container).addClass('danger');
danger = true;
}
}
//--------- dates filter ---------
// if no date field is selected for filter, select the first option
$('#ADVSRCH_DATE_ZONE', adv_box).removeClass('danger');
if($("option.dbx:selected:enabled", dateFilterSelect).length == 0) {
$("option:eq(0)", dateFilterSelect).prop("selected", true);
$("#ADVSRCH_DATE_SELECTORS", container).hide();
}
else {
$("#ADVSRCH_DATE_SELECTORS", container).show();
search.dates.minbound = $('#ADVSRCH_DATE_ZONE input[name=date_min]', adv_box).val();
search.dates.maxbound = $('#ADVSRCH_DATE_ZONE input[name=date_max]', adv_box).val();
search.dates.field = $('#ADVSRCH_DATE_ZONE select[name=date_field]', adv_box).val();
console.log(search.dates.minbound, search.dates.maxbound, search.dates.field)
if ($.trim(search.dates.minbound) || $.trim(search.dates.maxbound)) {
danger = true;
$('#ADVSRCH_DATE_ZONE', adv_box).addClass('danger');
}
}
fieldsSelect.scrollTop(scroll);
// if one filter shows danger, show it on the query
if (danger) {
$('#EDIT_query').addClass('danger');
}
else {
$('#EDIT_query').removeClass('danger');
}
if (save === true) {
setPref('search', JSON.stringify(search));
}
}
function toggleFilter(filter, ele) {
var el = $('#' + filter); var el = $('#' + filter);
if (el.is(':hidden')) if (el.is(':hidden'))
$(ele).parent().addClass('open'); $(ele).parent().addClass('open');
else else
$(ele).parent().removeClass('open'); $(ele).parent().removeClass('open');
el.slideToggle('fast'); el.slideToggle('fast');
} }*/
function setVisible(el) { /* NOT USED function setVisible(el) {
el.style.visibility = 'visible'; el.style.visibility = 'visible';
} }*/
function resize() { function resize() {
var body = $('#mainContainer'); var body = $('#mainContainer');
@@ -348,11 +169,7 @@ function resize() {
} }
function clearAnswers() {
$('#formAnswerPage').val('');
$('#searchForm input[name="nba"]').val('');
$('#answers, #dyn_tool').empty();
}
function reset_adv_search() { function reset_adv_search() {
var container = $("#ADVSRCH_OPTIONS_ZONE"); var container = $("#ADVSRCH_OPTIONS_ZONE");
@@ -373,113 +190,23 @@ function reset_adv_search() {
} }
function search_doubles() { function search_doubles() {
selectedFacetValues = []; workzoneFacetsModule.resetSelectedFacets();
$('#EDIT_query').val('sha256=sha256'); $('#EDIT_query').val('sha256=sha256');
newSearch('sha256=sha256'); searchModule.newSearch('sha256=sha256');
} }
function newSearch(query) {
p4.Results.Selection.empty();
clearAnswers();
$('#SENT_query').val(query);
var histo = $('#history-queries ul');
histo.prepend('<li onclick="doSpecialSearch(\'' + query.replace(/\'/g, "\\'") + '\')">' + query + '</li>');
var lis = $('li', histo);
if (lis.length > 25) {
$('li:last', histo).remove();
}
$('#idFrameC li.proposals_WZ').removeClass('active');
$('#searchForm').submit();
return false;
}
function beforeSearch() {
if (answAjaxrunning)
return;
answAjaxrunning = true;
clearAnswers();
$('#tooltip').css({
'display': 'none'
});
$('#answers').addClass('loading').empty();
$('#answercontextwrap').remove();
}
function afterSearch() {
if ($('#answercontextwrap').length === 0)
$('body').append('<div id="answercontextwrap"></div>');
$.each($('#answers .contextMenuTrigger'), function () {
var id = $(this).closest('.IMGT').attr('id').split('_').slice(1, 3).join('_');
$(this).contextMenu('#IMGT_' + id + ' .answercontextmenu', {
appendTo: '#answercontextwrap',
openEvt: 'click',
dropDown: true,
theme: 'vista',
showTransition: 'slideDown',
hideTransition: 'hide',
shadow: false
});
});
answAjaxrunning = false;
$('#answers').removeClass('loading');
$('.captionTips, .captionRolloverTips').tooltip({
delay: 0,
isBrowsable: false,
extraClass: 'caption-tooltip-container'
});
$('.infoTips').tooltip({
delay: 0
});
$('.previewTips').tooltip({
fixable: true
});
$('.thumb .rollovable').hover(
function () {
$('.rollover-gif-hover', this).show();
$('.rollover-gif-out', this).hide();
},
function () {
$('.rollover-gif-hover', this).hide();
$('.rollover-gif-out', this).show();
}
);
viewNbSelect();
$('#answers div.IMGT').draggable({
helper: function () {
$('body').append('<div id="dragDropCursor" style="position:absolute;z-index:9999;background:red;-moz-border-radius:8px;-webkit-border-radius:8px;"><div style="padding:2px 5px;font-weight:bold;">' + p4.Results.Selection.length() + '</div></div>');
return $('#dragDropCursor');
},
scope: "objects",
distance: 20,
scroll: false,
cursorAt: {
top: -10,
left: -20
},
start: function (event, ui) {
if (!$(this).hasClass('selected'))
return false;
}
});
linearize();
}
function initAnswerForm() { function initAnswerForm() {
var searchForm = $('#searchForm'); var searchForm = $('#searchForm');
$('button[type="submit"]', searchForm).bind('click', function () { $('button[type="submit"]', searchForm).bind('click', function () {
selectedFacetValues = []; workzoneFacetsModule.resetSelectedFacets();
newSearch($("#EDIT_query").val()); searchModule.newSearch($("#EDIT_query").val());
return false; return false;
}); });
@@ -498,7 +225,7 @@ function initAnswerForm() {
beforeSend: function (formData) { beforeSend: function (formData) {
if (answAjaxrunning && answAjax.abort) if (answAjaxrunning && answAjax.abort)
answAjax.abort(); answAjax.abort();
beforeSearch(); searchModule.beforeSearch();
}, },
error: function () { error: function () {
answAjaxrunning = false; answAjaxrunning = false;
@@ -522,7 +249,7 @@ function initAnswerForm() {
container: $('#answers') container: $('#answers')
}); });
loadFacets(datas.facets); workzoneFacetsModule.loadFacets(datas.facets);
$('#answers').append('<div id="paginate"><div class="navigation"><div id="tool_navigate"></div></div></div>'); $('#answers').append('<div id="paginate"><div class="navigation"><div id="tool_navigate"></div></div></div>');
@@ -556,7 +283,7 @@ function initAnswerForm() {
$("#PREV_PAGE").unbind('click'); $("#PREV_PAGE").unbind('click');
} }
afterSearch(); searchModule.afterSearch();
} }
}); });
return false; return false;
@@ -566,155 +293,16 @@ function initAnswerForm() {
} }
} }
var selectedFacetValues = [];
function loadFacets(facets) {
// Convert facets data to fancytree source format
var treeSource = _.map(facets, function(facet) {
// Values
var values = _.map(facet.values, function(value) {
return {
title: value.value + ' (' + value.count + ')',
query: value.query,
label: value.value,
tooltip: value.value + ' (' + value.count + ')'
}
});
// Facet
return {
name: facet.name,
title: facet.label,
folder: true,
children: values,
expanded: _.isUndefined(selectedFacetValues[facet.name])
};
});
treeSource.sort(sortFacets('title', true, function(a){return a.toUpperCase()}));
treeSource = sortByPredefinedFacets(treeSource, 'name', ['Base_Name', 'Collection_Name', 'Type_Name']);
return getFacetsTree().reload(treeSource);
}
function sortByPredefinedFacets(source, field, predefinedFieldOrder) {
var filteredSource = source,
ordered = [];
_.forEach(predefinedFieldOrder, function (fieldValue, index) {
_.forEach(source, function (facet, facetIndex) {
if (facet[field] !== undefined) {
if (facet[field] === fieldValue) {
ordered.push(facet);
// remove from filtered
filteredSource.splice(facetIndex, 1);
}
}
});
});
var olen = filteredSource.length;
// fill predefined facets with non predefined facets
for (var i = 0; i < olen; i++) {
ordered.push(filteredSource[i]);
}
return ordered;
}
// from stackoverflow
// http://stackoverflow.com/questions/979256/sorting-an-array-of-javascript-objects/979325#979325
function sortFacets(field, reverse, primer) {
var key = function (x) {return primer ? primer(x[field]) : x[field]};
return function (a,b) {
var A = key(a), B = key(b);
return ( (A < B) ? -1 : ((A > B) ? 1 : 0) ) * [-1,1][+!!reverse];
}
}
function getFacetsTree() {
var $facetsTree = $('#proposals');
if (!$facetsTree.data('ui-fancytree')) {
$facetsTree.fancytree({
clickFolderMode: 3, // activate and expand
icons:false,
source: [],
activate: function(event, data){
var query = data.node.data.query;
if (query) {
var facet = data.node.parent;
selectedFacetValues[facet.title] = data.node.data;
facetCombinedSearch();
}
},
renderNode: function(event, data){
var facetFilter = "";
if(data.node.folder && !_.isUndefined(selectedFacetValues[data.node.title])) {
facetFilter = selectedFacetValues[data.node.title].label;
var s_label = document.createElement("SPAN");
s_label.setAttribute("class", "facetFilter-label");
s_label.setAttribute("title", facetFilter);
var length = 15;
var facetFilterString = facetFilter;
if( facetFilterString.length > length) {
facetFilterString = facetFilterString.substring(0,length) + '…';
}
s_label.appendChild(document.createTextNode(facetFilterString));
var s_closer = document.createElement("A");
s_closer.setAttribute("class", "facetFilter-closer");
var s_gradient = document.createElement("SPAN");
s_gradient.setAttribute("class", "facetFilter-gradient");
s_gradient.appendChild(document.createTextNode("\u00A0"));
s_label.appendChild(s_gradient);
var s_facet = document.createElement("SPAN");
s_facet.setAttribute("class", "facetFilter");
s_facet.appendChild(s_label);
s_closer = $(s_facet.appendChild(s_closer));
s_closer.data("facetTitle", data.node.title);
s_closer.click(
function(event) {
event.stopPropagation();
var facetTitle = $(this).data("facetTitle");
delete selectedFacetValues[facetTitle];
facetCombinedSearch();
return false;
}
);
$(".fancytree-folder", data.node.li).append(
$(s_facet)
);
}
}
});
}
return $facetsTree.fancytree('getTree');
}
function facetCombinedSearch() {
var q = $("#EDIT_query").val();
var q_facet = "";
_.each(_.values(selectedFacetValues), function(facetValue) {
q_facet += (q_facet ? " AND " : "") + '(' + facetValue.query + ')';
});
if(q_facet) {
if(q) {
q = '(' + q + ') AND '
}
q += q_facet;
}
checkFilters();
newSearch(q);
}
@@ -779,7 +367,7 @@ function initLook() {
$('#nperpage_value').val(ui.value); $('#nperpage_value').val(ui.value);
}, },
stop: function (event, ui) { stop: function (event, ui) {
setPref('images_per_page', $('#nperpage_value').val()); userModule.setPref('images_per_page', $('#nperpage_value').val());
} }
}); });
$('#sizeAns_slider').slider({ $('#sizeAns_slider').slider({
@@ -791,13 +379,13 @@ function initLook() {
$('#sizeAns_value').val(ui.value); $('#sizeAns_value').val(ui.value);
}, },
stop: function (event, ui) { stop: function (event, ui) {
setPref('images_size', $('#sizeAns_value').val()); userModule.setPref('images_size', $('#sizeAns_value').val());
} }
}); });
} }
function acceptCgus(name, value) { function acceptCgus(name, value) {
setPref(name, value); userModule.setPref(name, value);
} }
function cancelCgus(id) { function cancelCgus(id) {
@@ -856,7 +444,7 @@ function triggerShortcuts() {
$('#keyboard-stop').bind('click', function () { $('#keyboard-stop').bind('click', function () {
var display = $(this).get(0).checked ? '0' : '1'; var display = $(this).get(0).checked ? '0' : '1';
setPref('keyboard_infos', display); userModule.setPref('keyboard_infos', display);
}); });
@@ -910,62 +498,8 @@ function activeZoning() {
$('#rightFrame').trigger('mousedown'); $('#rightFrame').trigger('mousedown');
} }
function RGBtoHex(R, G, B) {
return toHex(R) + toHex(G) + toHex(B);
}
function toHex(N) {
if (N === null) return "00";
N = parseInt(N);
if (N === 0 || isNaN(N)) return "00";
N = Math.max(0, N);
N = Math.min(N, 255);
N = Math.round(N);
return "0123456789ABCDEF".charAt((N - N % 16) / 16)
+ "0123456789ABCDEF".charAt(N % 16);
}
function hsl2rgb(h, s, l) {
var m1, m2, hue;
var r, g, b;
s /= 100;
l /= 100;
if (s === 0)
r = g = b = (l * 255);
else {
if (l <= 0.5)
m2 = l * (s + 1);
else
m2 = l + s - l * s;
m1 = l * 2 - m2;
hue = h / 360;
r = HueToRgb(m1, m2, hue + 1 / 3);
g = HueToRgb(m1, m2, hue);
b = HueToRgb(m1, m2, hue - 1 / 3);
}
return {
r: r,
g: g,
b: b
};
}
function HueToRgb(m1, m2, hue) {
var v;
if (hue < 0)
hue += 1;
else if (hue > 1)
hue -= 1;
if (6 * hue < 1)
v = m1 + (m2 - m1) * hue * 6;
else if (2 * hue < 1)
v = m2;
else if (3 * hue < 2)
v = m1 + (m2 - m1) * (2 / 3 - hue) * 6;
else
v = m1;
return 255 * v;
}
$(document).ready(function () { $(document).ready(function () {
@@ -1087,12 +621,12 @@ $(document).ready(function () {
var sim_b = 0.1 * hsb.b; var sim_b = 0.1 * hsb.b;
var sim_rgb = hsl2rgb(hsb.h, hsb.s, sim_b); var sim_rgb = utilsModule.hsl2rgb(hsb.h, hsb.s, sim_b);
var sim_hex = RGBtoHex(sim_rgb.r, sim_rgb.g, sim_rgb.b); var sim_hex = utilsModule.RGBtoHex(sim_rgb.r, sim_rgb.g, sim_rgb.b);
setPref('background-selection', hex); userModule.setPref('background-selection', hex);
setPref('background-selection-disabled', sim_hex); userModule.setPref('background-selection-disabled', sim_hex);
setPref('fontcolor-selection', back_hex); userModule.setPref('fontcolor-selection', back_hex);
$('style[title=color_selection]').empty(); $('style[title=color_selection]').empty();
@@ -1119,7 +653,7 @@ $(document).ready(function () {
}); });
startThesaurus(); startThesaurus();
checkFilters(); searchModule.checkFilters();
activeZoning(); activeZoning();
@@ -1648,7 +1182,7 @@ function editThis(type, value) {
function toggleRemoveReg(el) { function toggleRemoveReg(el) {
var state = !el.checked; var state = !el.checked;
setPref('reg_delete', (state ? '1' : '0')); userModule.setPref('reg_delete', (state ? '1' : '0'));
p4.reg_delete = state; p4.reg_delete = state;
} }
@@ -1727,7 +1261,7 @@ function checkDeleteThis(type, el) {
var buttons = {}; var buttons = {};
buttons[language.valider] = function (e) { buttons[language.valider] = function (e) {
deleteBasket(el); workzoneBasketModule.deleteBasket(el);
}; };
$('#DIALOG').empty().append(language.confirmDel).attr('title', language.attention).dialog({ $('#DIALOG').empty().append(language.confirmDel).attr('title', language.attention).dialog({
@@ -1861,9 +1395,9 @@ function doSpecialSearch(qry, allbase) {
if (allbase) { if (allbase) {
checkBases(true); checkBases(true);
} }
selectedFacetValues = []; workzoneFacetsModule.resetSelectedFacets();
$('#EDIT_query').val(decodeURIComponent(qry).replace(/\+/g, " ")); $('#EDIT_query').val(decodeURIComponent(qry).replace(/\+/g, " "));
newSearch(qry); searchModule.newSearch(qry);
} }
function clktri(id) { function clktri(id) {
@@ -1876,7 +1410,7 @@ function clktri(id) {
// ---------------------- fcts du thesaurus // ---------------------- fcts du thesaurus
function chgProp(path, v, k) { /* NOT USED function chgProp(path, v, k) {
var q2; var q2;
if (!k) if (!k)
k = "*"; k = "*";
@@ -1893,14 +1427,14 @@ function chgProp(path, v, k) {
for (i = 0; i < q.length; i++) for (i = 0; i < q.length; i++)
q2 += q.charCodeAt(i) == 160 ? " " : q.charAt(i); q2 += q.charCodeAt(i) == 160 ? " " : q.charAt(i);
selectedFacetValues = []; workzoneFacetsModule.resetSelectedFacets();
$('#EDIT_query').val(q); $('#EDIT_query').val(q);
newSearch(q); newSearch(q);
return(false); return(false);
} }*/
function doDelete(lst) { /* NOT USED function doDelete(lst) {
var children = '0'; var children = '0';
if (document.getElementById('del_children') && document.getElementById('del_children').checked) if (document.getElementById('del_children') && document.getElementById('del_children').checked)
children = '1'; children = '1';
@@ -1945,116 +1479,22 @@ function doDelete(lst) {
viewNbSelect(); viewNbSelect();
} }
}); });
} }*/
function archiveBasket(basket_id) {
$.ajax({
type: "POST",
url: "../prod/baskets/" + basket_id + "/archive/?archive=1",
dataType: 'json',
beforeSend: function () {
},
success: function (data) {
if (data.success) {
var basket = $('#SSTT_' + basket_id);
var next = basket.next();
if (next.data("ui-droppable")) {
next.droppable('destroy');
}
next.slideUp().remove();
if (basket.data("ui-droppable")) {
basket.droppable('destroy');
}
basket.slideUp().remove();
if ($('#baskets .SSTT').length === 0) {
return p4.WorkZone.refresh(false);
}
}
else {
alert(data.message);
}
return;
}
});
}
function deleteBasket(item) {
if ($("#DIALOG").data("ui-dialog")) {
$("#DIALOG").dialog('destroy');
}
var k = $(item).attr('id').split('_').slice(1, 2).pop(); // id de chutier
$.ajax({
type: "POST",
url: "../prod/baskets/" + k + '/delete/',
dataType: 'json',
beforeSend: function () {
},
success: function (data) {
if (data.success) {
var basket = $('#SSTT_' + k);
var next = basket.next();
if (next.data("ui-droppable")) {
next.droppable('destroy');
}
next.slideUp().remove();
if (basket.data("ui-droppable")) {
basket.droppable('destroy');
}
basket.slideUp().remove();
if ($('#baskets .SSTT').length === 0) {
return p4.WorkZone.refresh(false);
}
}
else {
alert(data.message);
}
return;
}
});
}
function deploy(deployer, todeploy_selector)
{
if($(deployer).hasClass("deployer_opened")) {
$(deployer).removeClass("deployer_opened").addClass("deployer_closed");
$(todeploy_selector).hide();
}
else {
$(deployer).removeClass("deployer_closed").addClass("deployer_opened");
$(todeploy_selector).show();
}
}
function clksbas(el, sbas_id) {
var bool = $(el).prop('checked');
$.each($('.sbascont_' + sbas_id + ' :checkbox'), function () {
this.checked = bool;
});
checkFilters(true);
}
function advSearch(event) {
/* NOT USED function advSearch(event) {
event.cancelBubble = true; event.cancelBubble = true;
// alternateSearch(false); // alternateSearch(false);
$('#idFrameC .tabs a.adv_search').trigger('click'); $('#idFrameC .tabs a.adv_search').trigger('click');
} }*/
// look_box
function start_page_selector() { function start_page_selector() {
var el = $('#look_box_settings select[name=start_page]'); var el = $('#look_box_settings select[name=start_page]');
@@ -2069,7 +1509,7 @@ function start_page_selector() {
break; break;
} }
} }
// look_box
function set_start_page() { function set_start_page() {
var el = $('#look_box_settings select[name=start_page]'); var el = $('#look_box_settings select[name=start_page]');
var val = el.val(); var val = el.val();
@@ -2078,28 +1518,15 @@ function set_start_page() {
var start_page_query = $('#look_box_settings input[name=start_page_value]').val(); var start_page_query = $('#look_box_settings input[name=start_page_value]').val();
if (val === 'QUERY') { if (val === 'QUERY') {
setPref('start_page_query', start_page_query); userModule.setPref('start_page_query', start_page_query);
} }
setPref('start_page', val); userModule.setPref('start_page', val);
} }
function basketPrefs() {
$('#basket_preferences').dialog({
closeOnEscape: true,
resizable: false,
width: 450,
height: 500,
modal: true,
draggable: false,
overlay: {
backgroundColor: '#000',
opacity: 0.7
}
}).dialog('open');
}
// preferences modal
function lookBox(el, event) { function lookBox(el, event) {
$("#look_box").dialog({ $("#look_box").dialog({
closeOnEscape: true, closeOnEscape: true,
@@ -2162,7 +1589,7 @@ function saveeditPbar(idesc, ndesc) {
document.getElementById("saveeditPbarN").innerHTML = ndesc; document.getElementById("saveeditPbarN").innerHTML = ndesc;
} }
function getSelText() { /* NOT USED function getSelText() {
var txt = ''; var txt = '';
if (window.getSelection) { if (window.getSelection) {
txt = window.getSelection(); txt = window.getSelection();
@@ -2176,9 +1603,9 @@ function getSelText() {
else else
return; return;
return txt; return txt;
} }*/
function getWinPosAsXML() { /* NOT USED function getWinPosAsXML() {
var ret = '<win id="search" ratio="' + ($('#idFrameC').outerWidth() / bodySize.x) + '"/>'; var ret = '<win id="search" ratio="' + ($('#idFrameC').outerWidth() / bodySize.x) + '"/>';
if ($('#idFrameE').is(':visible') && $('#EDITWINDOW').is(':visible')) if ($('#idFrameE').is(':visible') && $('#EDITWINDOW').is(':visible'))
@@ -2186,7 +1613,7 @@ function getWinPosAsXML() {
return ret; return ret;
} }*/
function saveWindows() { function saveWindows() {
var key = ''; var key = '';
@@ -2201,7 +1628,7 @@ function saveWindows() {
key = 'search_window'; key = 'search_window';
value = $('#idFrameC').outerWidth() / bodySize.x; value = $('#idFrameC').outerWidth() / bodySize.x;
} }
setPref(key, value); userModule.setPref(key, value);
} }
function gotopage(pag) { function gotopage(pag) {
@@ -2210,7 +1637,7 @@ function gotopage(pag) {
$('#searchForm').submit(); $('#searchForm').submit();
} }
function addFilterMulti(filter, link, sbasid) { /* NOT USED function addFilterMulti(filter, link, sbasid) {
var clone = $('#filter_multi_' + sbasid + '_' + filter); var clone = $('#filter_multi_' + sbasid + '_' + filter);
var orig = clone; var orig = clone;
if (!$('#filter_multi_' + sbasid + '_' + filter).is(':visible')) { if (!$('#filter_multi_' + sbasid + '_' + filter).is(':visible')) {
@@ -2228,9 +1655,9 @@ function addFilterMulti(filter, link, sbasid) {
$(link).removeClass('filterActive'); $(link).removeClass('filterActive');
} }
return false; return false;
} }*/
function autoorder() { /* NOT USED function autoorder() {
var val = $.trim($('#auto_order').val()); var val = $.trim($('#auto_order').val());
if (val === '') if (val === '')
@@ -2278,7 +1705,7 @@ function autoorder() {
last_moved = elem; last_moved = elem;
} }
} }*/

View File

@@ -1701,7 +1701,7 @@ function startThisEditing(sbas_id, what, regbasprid, ssel) {
}, },
stop: function () { stop: function () {
hsplit1(); hsplit1();
setPref('editing_top_box', Math.floor($('#EDIT_TOP').height() * 100 / $('#EDIT_ALL').height())); userModule.setPref('editing_top_box', Math.floor($('#EDIT_TOP').height() * 100 / $('#EDIT_ALL').height()));
setSizeLimits(); setSizeLimits();
} }
}); });
@@ -1714,7 +1714,7 @@ function startThisEditing(sbas_id, what, regbasprid, ssel) {
setPreviewEdit(); setPreviewEdit();
}, },
stop: function () { stop: function () {
setPref('editing_right_box', Math.floor($('#divS').width() * 100 / $('#EDIT_MID_L').width())); userModule.setPref('editing_right_box', Math.floor($('#divS').width() * 100 / $('#EDIT_MID_L').width()));
vsplit1(); vsplit1();
setSizeLimits(); setSizeLimits();
} }
@@ -1730,7 +1730,7 @@ function startThisEditing(sbas_id, what, regbasprid, ssel) {
setPreviewEdit(); setPreviewEdit();
}, },
stop: function () { stop: function () {
setPref('editing_left_box', Math.floor($('#EDIT_MID_R').width() * 100 / $('#EDIT_MID').width())); userModule.setPref('editing_left_box', Math.floor($('#EDIT_MID_R').width() * 100 / $('#EDIT_MID').width()));
vsplit2(); vsplit2();
setSizeLimits(); setSizeLimits();
} }
@@ -1746,7 +1746,7 @@ function startThisEditing(sbas_id, what, regbasprid, ssel) {
}, },
change: function (event, ui) { change: function (event, ui) {
p4.edit.diapoSize = $(ui.value)[0]; p4.edit.diapoSize = $(ui.value)[0];
setPref("editing_images_size", p4.edit.diapoSize); userModule.setPref("editing_images_size", p4.edit.diapoSize);
} }
}); });

View File

@@ -18,6 +18,15 @@
<![endif]--> <![endif]-->
<script type="text/javascript" src="/assets/vendors/modernizr/modernizr{% if not app.debug %}.min{% endif %}.js"></script> <script type="text/javascript" src="/assets/vendors/modernizr/modernizr{% if not app.debug %}.min{% endif %}.js"></script>
{% if app.debug %}
<script type="text/javascript" src="/assets/vendors/better/better.js"></script>
<script>
// instanciate the object
var globalDetector = new Better.GlobalDetector();
// start monitoring globals
globalDetector.start();
</script>
{% endif %}
<script type="text/javascript" src="/assets/vendors/jquery/jquery{% if not app.debug %}.min{% endif %}.js"></script> <script type="text/javascript" src="/assets/vendors/jquery/jquery{% if not app.debug %}.min{% endif %}.js"></script>
{#<script src="//code.jquery.com/jquery-migrate-1.2.1.js"></script>#} {#<script src="//code.jquery.com/jquery-migrate-1.2.1.js"></script>#}
<script type="text/javascript" src="/assets/vendors/jquery-ui/jquery-ui{% if not app.debug %}.min{% endif %}.js"></script> <script type="text/javascript" src="/assets/vendors/jquery-ui/jquery-ui{% if not app.debug %}.min{% endif %}.js"></script>

View File

@@ -167,7 +167,7 @@
<div title="" class="context-menu-item"> <div title="" class="context-menu-item">
<div class="context-menu-item-inner" <div class="context-menu-item-inner"
onclick="archiveBasket({{ basket.getId() }});return false;"> onclick="workzoneBasketModule.archiveBasket({{ basket.getId() }});return false;">
{{ 'Archive' | trans }} {{ 'Archive' | trans }}
</div> </div>
</div> </div>

View File

@@ -5,9 +5,9 @@
<div class="sbas_list sbas_{{sbas_id}}" style="margin-bottom: 10px;"> <div class="sbas_list sbas_{{sbas_id}}" style="margin-bottom: 10px;">
<input type="hidden" name="reference" value="{{sbas_id}}"/> <input type="hidden" name="reference" value="{{sbas_id}}"/>
<div class="clksbas"> <div class="clksbas">
<span onclick="deploy(this, '.sbascont_{{sbas_id}}' );" class="deployer_closed" ></span> <span onclick="searchModule.toggleCollection(this, '.sbascont_{{sbas_id}}' );" class="deployer_closed" ></span>
<input type="checkbox" checked style="display: none;" id="sbasChkr_{{sbas_id}}_{{unique_id}}" class="sbasChkr_{{sbas_id}}" <input type="checkbox" checked style="display: none;" id="sbasChkr_{{sbas_id}}_{{unique_id}}" class="sbasChkr_{{sbas_id}}"
onchange="clksbas(this, {{sbas_id}});" /> onchange="searchModule.selectDatabase(this, {{sbas_id}});" />
<label id="ADVSRCH_SBAS_LABEL_{{sbas_id}}" style="display: inline" class="checkbox danger_indicator" for="sbasChkr_{{sbas_id}}_{{unique_id}}"> <label id="ADVSRCH_SBAS_LABEL_{{sbas_id}}" style="display: inline" class="checkbox danger_indicator" for="sbasChkr_{{sbas_id}}_{{unique_id}}">
<span>{{sbas_id|sbas_labels(app)}}</span> <span>{{sbas_id|sbas_labels(app)}}</span>
<span class="infos_sbas_{{sbas_id}}"> <span class="infos_sbas_{{sbas_id}}">
@@ -24,7 +24,7 @@
<tr> <tr>
<td> <td>
<input class="ck_{{collection["base_id"]}} checkbas" style="*margin-top:-18px;" <input class="ck_{{collection["base_id"]}} checkbas" style="*margin-top:-18px;"
onchange="checkFilters(true);" onchange="searchModule.checkFilters(true);"
id="ck_{{collection["base_id"]}}_{{unique_id}}" type="checkbox" id="ck_{{collection["base_id"]}}_{{unique_id}}" type="checkbox"
name="bases[]" value="{{collection["base_id"]}}" {% if collection["selected"] %}checked="checked"{% endif %} /> name="bases[]" value="{{collection["base_id"]}}" {% if collection["selected"] %}checked="checked"{% endif %} />
</td> </td>
@@ -167,7 +167,7 @@
</div> </div>
</li> </li>
<li class="context-menu-item"> <li class="context-menu-item">
<div class="context-menu-item-inner" onclick="basketPrefs();"> <div class="context-menu-item-inner" onclick="workzoneBasketModule.openBasketPreferences();">
{{ 'Preferences' | trans }} {{ 'Preferences' | trans }}
</div> </div>
</li> </li>
@@ -250,7 +250,7 @@
{% set sortOrderPreference = search_datas.elasticSort.order %} {% set sortOrderPreference = search_datas.elasticSort.order %}
{% endif %} {% endif %}
<span>{{ 'Trier par' | trans }}</span> <span>{{ 'Trier par' | trans }}</span>
<select name="sort" class="input-medium" onchange="checkFilters(true);"> <select name="sort" class="input-medium" onchange="searchModule.checkFilters(true);">
{% set isSelected = (sortByPreference == constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_CREATED_ON')) %} {% set isSelected = (sortByPreference == constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_CREATED_ON')) %}
{% set isDefault = (sortByDefault == constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_CREATED_ON')) %} {% set isDefault = (sortByDefault == constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_CREATED_ON')) %}
<option value="{{ constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_CREATED_ON') }}" {% if isSelected %}selected="selected"{% endif %}{% if isDefault %} class="default-selection"{% endif %}>{{ "Date Added"|trans }}</option> <option value="{{ constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_CREATED_ON') }}" {% if isSelected %}selected="selected"{% endif %}{% if isDefault %} class="default-selection"{% endif %}>{{ "Date Added"|trans }}</option>
@@ -267,7 +267,7 @@
{% endfor %} {% endfor %}
</optgroup> </optgroup>
</select> </select>
<select name="ord" class="input-medium" onchange="checkFilters(true);"> <select name="ord" class="input-medium" onchange="searchModule.checkFilters(true);">
{% for ord, ord_name in app['phraseanet.SE'].getAvailableOrder() %} {% for ord, ord_name in app['phraseanet.SE'].getAvailableOrder() %}
{% set isSelected = (sortOrderPreference == ord) %} {% set isSelected = (sortOrderPreference == ord) %}
{% set isDefault = (sortOrderDefault == ord) %} {% set isDefault = (sortOrderDefault == ord) %}
@@ -278,7 +278,7 @@
<div id="ADVSRCH_FIELDS_ZONE" class="danger_indicator"> <div id="ADVSRCH_FIELDS_ZONE" class="danger_indicator">
<span>{{ 'Les termes apparaissent dans le(s) champs' | trans }}</span> <span>{{ 'Les termes apparaissent dans le(s) champs' | trans }}</span>
<select size="8" multiple onchange="checkFilters(true);" name="fields[]" style="vertical-align:middle; width:99%;"> <select size="8" multiple onchange="searchModule.checkFilters(true);" name="fields[]" style="vertical-align:middle; width:99%;">
<option value="phraseanet--all--fields">{{ 'rechercher dans tous les champs' | trans }}</option> <option value="phraseanet--all--fields">{{ 'rechercher dans tous les champs' | trans }}</option>
{% for field_id, field in search_datas['fields'] %} {% for field_id, field in search_datas['fields'] %}
{% if field['type'] != 'date' %} {% if field['type'] != 'date' %}
@@ -298,7 +298,7 @@
<thead> <thead>
<tr> <tr>
<td colspan="2"> <td colspan="2">
<span onclick="deploy(this, '#ADVSRCH_SB_{{databox_id}}' );return false;" class="deployer_closed" ></span> <span onclick="searchModule.toggleCollection(this, '#ADVSRCH_SB_{{databox_id}}' );return false;" class="deployer_closed" ></span>
<span class="danger_indicator">{{ databox['name'] }}</span> <span class="danger_indicator">{{ databox['name'] }}</span>
</td> </td>
</tr> </tr>
@@ -311,7 +311,7 @@
{% if status['img_off'] %} {% if status['img_off'] %}
<img src="{{status['img_off']}}" title="{{status['labels_off_i18n'][app['locale']]}}" /> <img src="{{status['img_off']}}" title="{{status['labels_off_i18n'][app['locale']]}}" />
{% endif %} {% endif %}
<input onchange="checkFilters(true);" class="field_switch field_{{databox_id}}" <input onchange="searchModule.checkFilters(true);" class="field_switch field_{{databox_id}}"
type="checkbox" value="0" type="checkbox" value="0"
n="{{status_bit}}" name="status[{{databox_id}}][{{status_bit}}]" /> n="{{status_bit}}" name="status[{{databox_id}}][{{status_bit}}]" />
{{status['labels_off_i18n'][app['locale']]}} {{status['labels_off_i18n'][app['locale']]}}
@@ -322,7 +322,7 @@
{% if status['img_on'] %} {% if status['img_on'] %}
<img src="{{status['img_on']}}" title="{{status['labels_on_i18n'][app['locale']]}}" /> <img src="{{status['img_on']}}" title="{{status['labels_on_i18n'][app['locale']]}}" />
{% endif %} {% endif %}
<input onchange="checkFilters(true);" class="field_switch field_{{databox_id}}" <input onchange="searchModule.checkFilters(true);" class="field_switch field_{{databox_id}}"
type="checkbox" value="1" type="checkbox" value="1"
n="{{status_bit}}" name="status[{{databox_id}}][{{status_bit}}]"/> n="{{status_bit}}" name="status[{{databox_id}}][{{status_bit}}]"/>
{{status['labels_on_i18n'][app['locale']]}} {{status['labels_on_i18n'][app['locale']]}}
@@ -341,7 +341,7 @@
{% if app['phraseanet.SE'].getAvailableDateFields() | length > 0 %} {% if app['phraseanet.SE'].getAvailableDateFields() | length > 0 %}
<hr /> <hr />
<span> <span>
<select name="date_field" class="input-medium" onchange="checkFilters(true);"> <select name="date_field" class="input-medium" onchange="searchModule.checkFilters(true);">
<option selected="selected" <option selected="selected"
value="">{{ 'Rechercher dans un champ date' | trans }}</option> value="">{{ 'Rechercher dans un champ date' | trans }}</option>
{% for fieldname, date in search_datas['dates'] %} {% for fieldname, date in search_datas['dates'] %}
@@ -354,12 +354,12 @@
{{ 'phraseanet::time:: de' | trans }} {{ 'phraseanet::time:: de' | trans }}
<div class="input-prepend"> <div class="input-prepend">
<span class="add-on"><i class="icon-calendar"></i></span> <span class="add-on"><i class="icon-calendar"></i></span>
<input onchange="checkFilters(true);" class="datepicker input-small" type="text" name="date_min" placeholder="{% trans %}YYYY/MM/DD{% endtrans %}" style="margin: 0;position: relative; z-index: 10001;" /> <input onchange="searchModule.checkFilters(true);" class="datepicker input-small" type="text" name="date_min" placeholder="{% trans %}YYYY/MM/DD{% endtrans %}" style="margin: 0;position: relative; z-index: 10001;" />
</div> </div>
{{ 'phraseanet::time:: a' | trans }} {{ 'phraseanet::time:: a' | trans }}
<div class="input-prepend"> <div class="input-prepend">
<span class="add-on"><i class="icon-calendar"></i></span> <span class="add-on"><i class="icon-calendar"></i></span>
<input onchange="checkFilters(true);" class="datepicker input-small" type="text" name="date_max" placeholder="{% trans %}YYYY/MM/DD{% endtrans %}" style="margin: 0;position: relative; z-index: 10001;" /> <input onchange="searchModule.checkFilters(true);" class="datepicker input-small" type="text" name="date_max" placeholder="{% trans %}YYYY/MM/DD{% endtrans %}" style="margin: 0;position: relative; z-index: 10001;" />
</div> </div>
</span> </span>
{% endif %} {% endif %}
@@ -531,7 +531,7 @@
<div class="" style="float:left; width:100%;margin-top:20px;"> <div class="" style="float:left; width:100%;margin-top:20px;">
{% set mod = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'advanced_search_reload') %} {% set mod = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'advanced_search_reload') %}
<label class="checkbox inline" for="user_settings_advanced_search_reload"> <label class="checkbox inline" for="user_settings_advanced_search_reload">
<input onchange="setPref('advanced_search_reload',$(this).prop('checked')?'1' : '0');" name="advanced_search_reload" type="checkbox" style="margin: 3px 0 0 -18px;" class="checkbox" value="1" id="user_settings_advanced_search_reload" {% if mod == '1' %}checked="checked"{% endif %}/> <input onchange="userModule.setPref('advanced_search_reload',$(this).prop('checked')?'1' : '0');" name="advanced_search_reload" type="checkbox" style="margin: 3px 0 0 -18px;" class="checkbox" value="1" id="user_settings_advanced_search_reload" {% if mod == '1' %}checked="checked"{% endif %}/>
{{ 'Use latest search settings on Production loading' | trans }} {{ 'Use latest search settings on Production loading' | trans }}
</label> </label>
</div> </div>
@@ -541,11 +541,11 @@
<h1>{{ 'Mode de presentation' | trans }}</h1> <h1>{{ 'Mode de presentation' | trans }}</h1>
{% set mod = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'view') %} {% set mod = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'view') %}
<label class="radio inline" for="thumbs_view"> <label class="radio inline" for="thumbs_view">
<input onchange="setPref('view',$(this).val());" name="view_type" type="radio" style="margin: 3px 0 0 -18px;" class="radio" value="thumbs" id="thumbs_view" {% if mod == 'thumbs' %}checked="checked"{% endif %}/> <input onchange="userModule.setPref('view',$(this).val());" name="view_type" type="radio" style="margin: 3px 0 0 -18px;" class="radio" value="thumbs" id="thumbs_view" {% if mod == 'thumbs' %}checked="checked"{% endif %}/>
{{ 'reponses:: mode vignettes' | trans }} {{ 'reponses:: mode vignettes' | trans }}
</label> </label>
<label class="radio inline" for="list_view"> <label class="radio inline" for="list_view">
<input onchange="setPref('view',$(this).val());" name="view_type" type="radio" style="margin: 3px 0 0 -18px;" class="radio" value="list" id="list_view" {% if mod == 'list' %}checked="checked"{% endif %}/> <input onchange="userModule.setPref('view',$(this).val());" name="view_type" type="radio" style="margin: 3px 0 0 -18px;" class="radio" value="list" id="list_view" {% if mod == 'list' %}checked="checked"{% endif %}/>
{{ 'reponses:: mode liste' | trans }} {{ 'reponses:: mode liste' | trans }}
</label> </label>
</div> </div>
@@ -561,11 +561,11 @@
{% set rollover_thumbnail = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'rollover_thumbnail') %} {% set rollover_thumbnail = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'rollover_thumbnail') %}
<h1>{{ 'Presentation de vignettes' | trans }}</h1> <h1>{{ 'Presentation de vignettes' | trans }}</h1>
<label class="radio" for="rollover_caption"> <label class="radio" for="rollover_caption">
<input onchange="setPref('rollover_thumbnail',$(this).val());" name="rollover_thumbnail" type="radio" class="radio" value="caption" id="rollover_caption" {% if rollover_thumbnail == 'caption' %}checked="checked" {% endif %}/> <input onchange="userModule.setPref('rollover_thumbnail',$(this).val());" name="rollover_thumbnail" type="radio" class="radio" value="caption" id="rollover_caption" {% if rollover_thumbnail == 'caption' %}checked="checked" {% endif %}/>
{{ 'Iconographe (description au rollover)' | trans }} {{ 'Iconographe (description au rollover)' | trans }}
</label> </label>
<label class="radio" for="rollover_preview"> <label class="radio" for="rollover_preview">
<input onchange="setPref('rollover_thumbnail',$(this).val());" name="rollover_thumbnail" type="radio" class="radio" value="preview" id="rollover_preview" {% if rollover_thumbnail == 'preview' %}checked="checked" {% endif %}/> <input onchange="userModule.setPref('rollover_thumbnail',$(this).val());" name="rollover_thumbnail" type="radio" class="radio" value="preview" id="rollover_preview" {% if rollover_thumbnail == 'preview' %}checked="checked" {% endif %}/>
{{ 'Graphiste (preview au rollover)' | trans }} {{ 'Graphiste (preview au rollover)' | trans }}
</label> </label>
</div> </div>
@@ -573,15 +573,15 @@
{% set technical_display = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'technical_display') %} {% set technical_display = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'technical_display') %}
<h1>{{'Display technical data' | trans }}</h1> <h1>{{'Display technical data' | trans }}</h1>
<label class="radio" for="technical_show"> <label class="radio" for="technical_show">
<input onchange="setPref('technical_display',$(this).val());" name="technical_display" type="radio" class="radio" value="1" id="technical_show" {% if technical_display == '1' %}checked="checked"{% endif %}/> <input onchange="userModule.setPref('technical_display',$(this).val());" name="technical_display" type="radio" class="radio" value="1" id="technical_show" {% if technical_display == '1' %}checked="checked"{% endif %}/>
{{ 'In the answer grid' | trans }} {{ 'In the answer grid' | trans }}
</label> </label>
<label class="radio" for="technical_group"> <label class="radio" for="technical_group">
<input onchange="setPref('technical_display',$(this).val());" name="technical_display" type="radio" class="radio" value="group" id="technical_group" {% if technical_display == 'group' %}checked="checked"{% endif %}/> <input onchange="userModule.setPref('technical_display',$(this).val());" name="technical_display" type="radio" class="radio" value="group" id="technical_group" {% if technical_display == 'group' %}checked="checked"{% endif %}/>
{{ 'After metadata' | trans }} {{ 'After metadata' | trans }}
</label> </label>
<label class="radio" for="technical_hide"> <label class="radio" for="technical_hide">
<input onchange="setPref('technical_display',$(this).val());" name="technical_display" type="radio" class="radio" value="0" id="technical_hide" {% if technical_display == '0' %}checked="checked"{% endif %}/> <input onchange="userModule.setPref('technical_display',$(this).val());" name="technical_display" type="radio" class="radio" value="0" id="technical_hide" {% if technical_display == '0' %}checked="checked"{% endif %}/>
{{ 'Do not display' | trans }} {{ 'Do not display' | trans }}
</label> </label>
</div> </div>
@@ -589,7 +589,7 @@
{% set doctype_display = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'doctype_display') %} {% set doctype_display = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'doctype_display') %}
<h1>{{'Type de documents' | trans }}</h1> <h1>{{'Type de documents' | trans }}</h1>
<label class="checkbox" for="doctype_display_show"> <label class="checkbox" for="doctype_display_show">
<input onchange="setPref('doctype_display',($(this).prop('checked') ? '1' :'0'));" name="doctype_display" type="checkbox" class="checkbox" value="1" id="doctype_display_show" {% if doctype_display != '0' %}checked="checked"{% endif %}/> <input onchange="userModule.setPref('doctype_display',($(this).prop('checked') ? '1' :'0'));" name="doctype_display" type="checkbox" class="checkbox" value="1" id="doctype_display_show" {% if doctype_display != '0' %}checked="checked"{% endif %}/>
{{ 'Afficher une icone' | trans }} {{ 'Afficher une icone' | trans }}
</label> </label>
@@ -716,7 +716,7 @@
<div> <div>
{% set basket_status_display = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'basket_status_display') %} {% set basket_status_display = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'basket_status_display') %}
<label for="basket_status_display" class="checkbox"> <label for="basket_status_display" class="checkbox">
<input onchange="setPref('basket_status_display',($(this).prop('checked') ? '1' :'0'));" <input onchange="userModule.setPref('basket_status_display',($(this).prop('checked') ? '1' :'0'));"
name="basket_status_display" type="checkbox" class="checkbox" value="1" name="basket_status_display" type="checkbox" class="checkbox" value="1"
id="basket_status_display" {% if basket_status_display == '1' %}checked="checked"{% endif %} /> id="basket_status_display" {% if basket_status_display == '1' %}checked="checked"{% endif %} />
{{ 'Afficher les status' | trans }} {{ 'Afficher les status' | trans }}
@@ -725,7 +725,7 @@
<div> <div>
{% set basket_caption_display = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'basket_caption_display') %} {% set basket_caption_display = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'basket_caption_display') %}
<label for="basket_caption_display" class="checkbox"> <label for="basket_caption_display" class="checkbox">
<input onchange="setPref('basket_caption_display',($(this).prop('checked') ? '1' :'0'));" <input onchange="userModule.setPref('basket_caption_display',($(this).prop('checked') ? '1' :'0'));"
name="basket_caption_display" type="checkbox" class="checkbox" value="1" name="basket_caption_display" type="checkbox" class="checkbox" value="1"
id="basket_caption_display" {% if basket_caption_display == '1' %}checked="checked"{% endif %} /> id="basket_caption_display" {% if basket_caption_display == '1' %}checked="checked"{% endif %} />
{{ 'Afficher la fiche descriptive' | trans }} {{ 'Afficher la fiche descriptive' | trans }}
@@ -734,7 +734,7 @@
<div> <div>
{% set basket_title_display = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'basket_title_display') %} {% set basket_title_display = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'basket_title_display') %}
<label for="basket_title_display" class="checkbox"> <label for="basket_title_display" class="checkbox">
<input onchange="setPref('basket_title_display',($(this).prop('checked') ? '1' :'0'));" <input onchange="userModule.setPref('basket_title_display',($(this).prop('checked') ? '1' :'0'));"
name="basket_title_display" type="checkbox" class="checkbox" value="1" name="basket_title_display" type="checkbox" class="checkbox" value="1"
id="basket_title_display" {% if basket_title_display == '1' %}checked="checked"{% endif %} /> id="basket_title_display" {% if basket_title_display == '1' %}checked="checked"{% endif %} />
{{ 'Afficher le titre' | trans }} {{ 'Afficher le titre' | trans }}

View File

@@ -776,10 +776,10 @@ function doThesSearch(type, sbid, term, field)
v = '[' + term + ']'; v = '[' + term + ']';
else else
v = field + '="' + term + '"'; v = field + '="' + term + '"';
selectedFacetValues = []; workzoneFacetsModule.resetSelectedFacets();
$('#EDIT_query').val(v); $('#EDIT_query').val(v);
checkFilters(); searchModule.checkFilters();
newSearch(v); searchModule.newSearch(v);
} }