diff --git a/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php b/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php
index 839fa0f2dc..ee8e61c421 100644
--- a/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php
+++ b/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php
@@ -97,41 +97,41 @@ class QueryController extends Controller
}
for ($i = 1; ($i <= 4 && (($i <= $npages) === true)); $i++) {
if ($i == $page)
- $string .= ' ';
+ $string .= ' ';
else
- $string .= "" . $i . " ";
+ $string .= "" . $i . " ";
}
if ($npages > 4)
$string .= " ";
- $string .= " ";
+ $string .= " ";
} else {
$start = $npages - 4;
if (($start) > 0){
- $string .= " ";
+ $string .= " ";
$string .= " ";
}else
$start = 1;
for ($i = ($start); $i <= $npages; $i++) {
if ($i == $page)
- $string .= ' ';
+ $string .= ' ';
else
- $string .= "" . $i . " ";
+ $string .= "" . $i . " ";
}
if($page < $npages){
$string .= " ";
}
}
} else {
- $string .= " ";
+ $string .= " ";
for ($i = ($page - 2); $i <= ($page + 2); $i++) {
if ($i == $page)
- $string .= ' ';
+ $string .= ' ';
else
- $string .= "" . $i . " ";
+ $string .= "" . $i . " ";
}
- $string .= " ";
+ $string .= " ";
}
}
$string .= '
';
diff --git a/lib/classes/eventsmanager/notify/push.php b/lib/classes/eventsmanager/notify/push.php
index 39c4b765e5..488d51431e 100644
--- a/lib/classes/eventsmanager/notify/push.php
+++ b/lib/classes/eventsmanager/notify/push.php
@@ -39,7 +39,7 @@ class eventsmanager_notify_push extends eventsmanager_notifyAbstract
$sender = $user->getDisplayName();
$ret = [
- 'text' => $this->app->trans('%user% vous a envoye un %before_link% panier %after_link%', ['%user%' => $sender, '%before_link%' => '', '%after_link%' => ' '])
, 'class' => ($unread == 1 ? 'reload_baskets' : '')
];
diff --git a/lib/classes/eventsmanager/notify/validationreminder.php b/lib/classes/eventsmanager/notify/validationreminder.php
index 66058c38b8..16ff582a4f 100644
--- a/lib/classes/eventsmanager/notify/validationreminder.php
+++ b/lib/classes/eventsmanager/notify/validationreminder.php
@@ -53,7 +53,7 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra
$basket_name = $this->app->trans('Une selection');
}
- $bask_link = ''
. $basket_name . ' ';
diff --git a/lib/classes/queries.php b/lib/classes/queries.php
index bec526933c..66ef36abfd 100644
--- a/lib/classes/queries.php
+++ b/lib/classes/queries.php
@@ -112,7 +112,7 @@ class queries
if(qry=="")
qry = "all";
- doSpecialSearch(qry,true);
+ prodModule.doSpecialSearch(qry,true);
return;
}
@@ -191,7 +191,7 @@ class queries
$queries = $app['repo.user-queries']->findBy(['user' => $usrId], ['created' => 'ASC'], 25, 0);
foreach ($queries as $query) {
- $history .= 'getQuery()) . '\')">' . $query->getQuery() . ' ';
+ $history .= 'getQuery()) . '\')">' . $query->getQuery() . ' ';
}
$history .= '';
@@ -246,7 +246,7 @@ class queries
$l = '' . $l . ' ';
if ($subtopic->query) {
$q = str_replace(["\\", "\"", "'", "\r", "\n"], ["\\\\", """, "\\'", "\\r", "\\n"], $subtopic->query);
- $q = '' . $l . ' ';
+ $q = '' . $l . ' ';
} else {
$q = $l;
}
@@ -256,13 +256,13 @@ class queries
$view = $defaultview;
switch ($view) {
case 'opened':
- $out .= ( ' ' . $q . ' ' . "\n");
+ $out .= ( ' ' . $q . ' ' . "\n");
$out .= ( "\n");
$out .= self::drawTopics($subtopic->topics, $depth + 1, $tid, $defaultview);
$out .= ( " \n
\n");
break;
case 'closed':
- $out .= ( ' ' . $q . ' ' . "\n");
+ $out .= ( ' ' . $q . ' ' . "\n");
$out .= ( "\n");
$out .= self::drawTopics($subtopic->topics, $depth + 1, $tid, $defaultview);
$out .= ( " \n
\n");
diff --git a/resources/gulp/components/prod.js b/resources/gulp/components/prod.js
index 2ddf297072..d436fea27d 100644
--- a/resources/gulp/components/prod.js
+++ b/resources/gulp/components/prod.js
@@ -83,19 +83,18 @@ gulp.task('build-prod-js', function(){
config.paths.src + 'prod/js/components/workzone/workzone.js',
config.paths.src + 'prod/js/components/workzone/workzone-basket.js',
config.paths.src + 'prod/js/components/workzone/workzone-facets.js',
+ config.paths.src + 'prod/js/components/workzone/workzone-thesaurus.js',
config.paths.src + 'prod/js/components/utils.js',
config.paths.src + 'prod/js/components/cgu.js',
config.paths.src + 'prod/js/components/preferences.js',
// config.paths.src + 'prod/js/jquery.form.2.49.js',
config.paths.src + 'prod/js/components/record/editable-record.js',
- // config.paths.src + 'prod/js/jquery.Prod.js',
- config.paths.src + 'prod/js/jquery.Feedback.js',
- config.paths.src + 'prod/js/jquery.main-prod.js',
+ config.paths.src + 'prod/js/components/push/push.js',
+ config.paths.src + 'prod/js/prod.js',
config.paths.src + 'prod/js/components/upload/upload.js',
config.paths.src + 'prod/js/components/video-editor.js',
- config.paths.src + 'prod/js/publicator.js',
config.paths.src + 'vendors/jquery-sprintf/js/jquery.sprintf.1.0.3.js',
- config.paths.src + 'prod/js/jquery.p4.preview.js',
+ config.paths.src + 'prod/js/components/preview/preview.js',
config.paths.src + 'prod/js/components/editor/record-editor.js',
config.paths.src + 'prod/js/jquery.color.animation.js',
config.paths.src + 'vendors/jquery-image-enhancer/js/jquery.image_enhancer.js',
diff --git a/resources/www/prod/js/components/editor/record-editor.js b/resources/www/prod/js/components/editor/record-editor.js
index 916545ad5b..5f7ffdfc67 100644
--- a/resources/www/prod/js/components/editor/record-editor.js
+++ b/resources/www/prod/js/components/editor/record-editor.js
@@ -791,7 +791,7 @@ var recordEditorModule = (function (p4) {
edit_addmval($('#EditTextMultiValued', p4.edit.editBox).val(), null);
}
else {
- if (is_ctrl_key(e)) {
+ if (utilsModule.is_ctrl_key(e)) {
var t = $("#idEditZTextArea", p4.edit.editBox).val();
$("#idEditZTextArea", p4.edit.editBox).val(t + (t ? " ; " : "") + label);
}
@@ -1105,7 +1105,7 @@ var recordEditorModule = (function (p4) {
if (evt && evt.type == "mousedown" && p4.edit.T_records[i]._selected)
return;
- if (evt && is_shift_key(evt) && p4.edit.lastClickId != null) {
+ if (evt && utilsModule.is_shift_key(evt) && p4.edit.lastClickId != null) {
// shift donc on sel du p4.edit.lastClickId a ici
var pos_from = p4.edit.T_pos[p4.edit.lastClickId];
var pos_to = p4.edit.T_pos[i];
@@ -1126,7 +1126,7 @@ var recordEditorModule = (function (p4) {
}
}
else {
- if (!evt || !is_ctrl_key(evt)) {
+ if (!evt || !utilsModule.is_ctrl_key(evt)) {
// on deselectionne tout avant
var id;
for (id in p4.edit.T_records) {
@@ -1252,7 +1252,7 @@ var recordEditorModule = (function (p4) {
$('#EDITWINDOW').hide();
hideOverlay(2);
if (p4.preview.open)
- reloadPreview();
+ recordPreviewModule.reloadPreview();
return;
}
});
diff --git a/resources/www/prod/js/components/preview/preview.js b/resources/www/prod/js/components/preview/preview.js
new file mode 100644
index 0000000000..bd3f1a9c2e
--- /dev/null
+++ b/resources/www/prod/js/components/preview/preview.js
@@ -0,0 +1,455 @@
+// var p4 = p4 || {};
+
+var recordPreviewModule = (function (p4) {
+ var prevAjax, prevAjaxrunning;
+ prevAjaxrunning = false;
+ p4.slideShow = false;
+
+ $(document).ready(function () {
+ $('#PREVIEWIMGDESC').tabs();
+ });
+
+ /**
+ *
+ * @param env
+ * @param pos - relative position in current page
+ * @param contId
+ * @param reload
+ */
+ function openPreview(env, pos, contId, reload) {
+
+ if (contId == undefined)
+ contId = '';
+ var roll = 0;
+ var justOpen = false;
+
+ if (!p4.preview.open) {
+ showOverlay();
+
+ $('#PREVIEWIMGCONT').disableSelection();
+
+ justOpen = true;
+
+ if (!( navigator.userAgent.match(/msie/i))) {
+ $('#PREVIEWBOX').css({
+ 'display': 'block',
+ 'opacity': 0
+ }).fadeTo(500, 1);
+ } else {
+ $('#PREVIEWBOX').css({
+ 'display': 'block',
+ 'opacity': 1
+ });
+ }
+ p4.preview.open = true;
+ p4.preview.nCurrent = 5;
+ $('#PREVIEWCURRENT, #PREVIEWOTHERSINNER, #SPANTITLE').empty();
+ resizePreview();
+ if (env == 'BASK')
+ roll = 1;
+
+ }
+
+ if (reload === true)
+ roll = 1;
+
+
+ $('#tooltip').css({
+ 'display': 'none'
+ });
+
+ $('#PREVIEWIMGCONT').empty();
+
+ var options_serial = p4.tot_options;
+ var query = p4.tot_query;
+ var navigation = p4.navigation;
+
+ // keep relative position for answer train:
+ var relativePos = pos;
+ // update real absolute position with pagination:
+ var absolutePos = parseInt(navigation.perPage,10) * (parseInt(navigation.page, 10) - 1) + parseInt(pos,10);
+
+ prevAjax = $.ajax({
+ type: "POST",
+ url: "../prod/records/",
+ dataType: 'json',
+ data: {
+ env: env,
+ pos: absolutePos,
+ cont: contId,
+ roll: roll,
+ options_serial: options_serial,
+ query: query
+ },
+ beforeSend: function () {
+ if (prevAjaxrunning)
+ prevAjax.abort();
+ if (env == 'RESULT')
+ $('#current_result_n').empty().append(parseInt(pos) + 1);
+ prevAjaxrunning = true;
+ $('#PREVIEWIMGDESC, #PREVIEWOTHERS').addClass('loading');
+ },
+ error: function (data) {
+ prevAjaxrunning = false;
+ $('#PREVIEWIMGDESC, #PREVIEWOTHERS').removeClass('loading');
+ posAsk = null;
+ },
+ timeout: function () {
+ prevAjaxrunning = false;
+ $('#PREVIEWIMGDESC, #PREVIEWOTHERS').removeClass('loading');
+ posAsk = null;
+ },
+ success: function (data) {
+ _cancelPreview();
+ prevAjaxrunning = false;
+ posAsk = null;
+
+ if (data.error) {
+ $('#PREVIEWIMGDESC, #PREVIEWOTHERS').removeClass('loading');
+ alert(data.error);
+ if (justOpen)
+ closePreview();
+ return;
+ }
+ posAsk = data.pos - 1;
+
+ $('#PREVIEWIMGCONT').empty().append(data.html_preview);
+ $('#PREVIEWIMGCONT .thumb_wrapper')
+ .width('100%').height('100%').image_enhance({zoomable: true});
+
+ $('#PREVIEWIMGDESCINNER').empty().append(data.desc);
+ $('#HISTORICOPS').empty().append(data.history);
+ $('#popularity').empty().append(data.popularity);
+
+ if ($('#popularity .bitly_link').length > 0) {
+
+ BitlyCB.statsResponse = function (data) {
+ var result = data.results;
+ if ($('#popularity .bitly_link_' + result.userHash).length > 0) {
+ $('#popularity .bitly_link_' + result.userHash).append(' (' + result.clicks + ' clicks)');
+ }
+ };
+ BitlyClient.stats($('#popularity .bitly_link').html(), 'BitlyCB.statsResponse');
+ }
+
+ p4.preview.current = {};
+ p4.preview.current.width = parseInt($('#PREVIEWIMGCONT input[name=width]').val());
+ p4.preview.current.height = parseInt($('#PREVIEWIMGCONT input[name=height]').val());
+ p4.preview.current.tot = data.tot;
+ p4.preview.current.pos = relativePos;
+
+ if ($('#PREVIEWBOX img.record.zoomable').length > 0) {
+ $('#PREVIEWBOX img.record.zoomable').draggable();
+ }
+
+ $('#SPANTITLE').empty().append(data.title);
+ $("#PREVIEWTITLE_COLLLOGO").empty().append(data.collection_logo);
+ $("#PREVIEWTITLE_COLLNAME").empty().append(data.collection_name);
+
+ _setPreview();
+
+ if (env != 'RESULT') {
+ if (justOpen || reload) {
+ _setCurrent(data.current);
+ }
+ _viewCurrent($('#PREVIEWCURRENT li.selected'));
+ }
+ else {
+ if (!justOpen) {
+ $('#PREVIEWCURRENT li.selected').removeClass('selected');
+ $('#PREVIEWCURRENTCONT li.current' + absolutePos).addClass('selected');
+ }
+ if (justOpen || ($('#PREVIEWCURRENTCONT li.current' + absolutePos).length === 0) || ($('#PREVIEWCURRENTCONT li:last')[0] == $('#PREVIEWCURRENTCONT li.selected')[0]) || ($('#PREVIEWCURRENTCONT li:first')[0] == $('#PREVIEWCURRENTCONT li.selected')[0])) {
+ _getAnswerTrain(pos, data.tools, query, options_serial);
+ }
+
+ _viewCurrent($('#PREVIEWCURRENT li.selected'));
+ }
+ if (env == 'REG' && $('#PREVIEWCURRENT').html() === '') {
+ _getRegTrain(contId, pos, data.tools);
+ }
+ _setOthers(data.others);
+ _setTools(data.tools);
+ $('#tooltip').css({
+ 'display': 'none'
+ });
+ $('#PREVIEWIMGDESC, #PREVIEWOTHERS').removeClass('loading');
+ if (!justOpen || (p4.preview.mode != env))
+ resizePreview();
+
+ p4.preview.mode = env;
+ $('#EDIT_query').focus();
+
+ $('#PREVIEWOTHERSINNER .otherBaskToolTip').tooltip();
+
+ return;
+ }
+
+ });
+
+ }
+
+ function closePreview() {
+ p4.preview.open = false;
+ hideOverlay();
+
+ $('#PREVIEWBOX').fadeTo(500, 0);
+ $('#PREVIEWBOX').queue(function () {
+ $(this).css({
+ 'display': 'none'
+ });
+ _cancelPreview();
+ $(this).dequeue();
+ });
+
+ }
+
+ function startSlide() {
+ if (!p4.slideShow) {
+ p4.slideShow = true;
+ }
+ if (p4.slideShowCancel) {
+ p4.slideShowCancel = false;
+ p4.slideShow = false;
+ $('#start_slide').show();
+ $('#stop_slide').hide();
+ }
+ if (!p4.preview.open) {
+ p4.slideShowCancel = false;
+ p4.slideShow = false;
+ $('#start_slide').show();
+ $('#stop_slide').hide();
+ }
+ if (p4.slideShow) {
+ $('#start_slide').hide();
+ $('#stop_slide').show();
+ getNext();
+ setTimeout("startSlide()", 3000);
+ }
+ }
+
+ function stopSlide() {
+ p4.slideShowCancel = true;
+ $('#start_slide').show();
+ $('#stop_slide').hide();
+ }
+
+ function getNext() {
+ if (p4.preview.mode == 'REG' && parseInt(p4.preview.current.pos) === 0)
+ $('#PREVIEWCURRENTCONT li img:first').trigger("click");
+ else {
+ if (p4.preview.mode == 'RESULT') {
+ posAsk = parseInt(p4.preview.current.pos) + 1;
+ posAsk = (posAsk >= parseInt(p4.tot) || isNaN(posAsk)) ? 0 : posAsk;
+ recordPreviewModule.openPreview('RESULT', posAsk, '', false);
+ }
+ else {
+ if (!$('#PREVIEWCURRENT li.selected').is(':last-child'))
+ $('#PREVIEWCURRENT li.selected').next().children('img').trigger("click");
+ else
+ $('#PREVIEWCURRENT li:first-child').children('img').trigger("click");
+ }
+
+ }
+ }
+
+ function getPrevious() {
+ if (p4.preview.mode == 'RESULT') {
+ posAsk = parseInt(p4.preview.current.pos) - 1;
+ posAsk = (posAsk < 0) ? ((parseInt(p4.tot) - 1)) : posAsk;
+ recordPreviewModule.openPreview('RESULT', posAsk, '', false);
+ }
+ else {
+ if (!$('#PREVIEWCURRENT li.selected').is(':first-child'))
+ $('#PREVIEWCURRENT li.selected').prev().children('img').trigger("click");
+ else
+ $('#PREVIEWCURRENT li:last-child').children('img').trigger("click");
+ }
+ }
+
+ function _setPreview() {
+ if (!p4.preview.current)
+ return;
+
+ var zoomable = $('img.record.zoomable');
+ if (zoomable.length > 0 && zoomable.hasClass('zoomed'))
+ return;
+
+ var h = parseInt(p4.preview.current.height);
+ var w = parseInt(p4.preview.current.width);
+// if(p4.preview.current.type == 'video')
+// {
+// var h = parseInt(p4.preview.current.flashcontent.height);
+// var w = parseInt(p4.preview.current.flashcontent.width);
+// }
+ var t = 20;
+ var de = 0;
+
+ var margX = 0;
+ var margY = 0;
+
+ if ($('#PREVIEWIMGCONT .record_audio').length > 0) {
+ margY = 100;
+ de = 60;
+ }
+
+
+// if(p4.preview.current.type != 'flash')
+// {
+ var ratioP = w / h;
+ var ratioD = parseInt(p4.preview.width) / parseInt(p4.preview.height);
+
+ if (ratioD > ratioP) {
+ //je regle la hauteur d'abord
+ if ((parseInt(h) + margY) > parseInt(p4.preview.height)) {
+ h = Math.round(parseInt(p4.preview.height) - margY);
+ w = Math.round(h * ratioP);
+ }
+ }
+ else {
+ if ((parseInt(w) + margX) > parseInt(p4.preview.width)) {
+ w = Math.round(parseInt(p4.preview.width) - margX);
+ h = Math.round(w / ratioP);
+ }
+ }
+// }
+// else
+// {
+
+// h = Math.round(parseInt(p4.preview.height) - margY);
+// w = Math.round(parseInt(p4.preview.width) - margX);
+// }
+ t = Math.round((parseInt(p4.preview.height) - h - de) / 2);
+ var l = Math.round((parseInt(p4.preview.width) - w) / 2);
+ $('#PREVIEWIMGCONT .record').css({
+ width: w,
+ height: h,
+ top: t,
+ left: l
+ }).attr('width', w).attr('height', h);
+ }
+
+ function _setCurrent(current) {
+ if (current !== '') {
+ var el = $('#PREVIEWCURRENT');
+ el.removeClass('loading').empty().append(current);
+
+ $('ul', el).width($('li', el).length * 80);
+ $('img.prevRegToolTip', el).tooltip();
+ $.each($('img.openPreview'), function (i, el) {
+ var jsopt = $(el).attr('jsargs').split('|');
+ $(el).removeAttr('jsargs');
+ $(el).removeClass('openPreview');
+ $(el).bind('click', function () {
+ _viewCurrent($(this).parent());
+ // convert abssolute to relative position
+ var absolutePos = jsopt[1];
+ var relativePos = parseInt(absolutePos, 10) - parseInt(p4.navigation.perPage, 10) * (parseInt(p4.navigation.page, 10) - 1);
+ // keep relative position for answer train:
+ recordPreviewModule.openPreview(jsopt[0], relativePos, jsopt[2],false);
+ });
+ });
+ }
+ }
+
+ function _viewCurrent(el) {
+ if (el.length === 0) {
+ return;
+ }
+ $('#PREVIEWCURRENT li.selected').removeClass('selected');
+ el.addClass('selected');
+ $('#PREVIEWCURRENTCONT').animate({'scrollLeft': ($('#PREVIEWCURRENT li.selected').position().left + $('#PREVIEWCURRENT li.selected').width() / 2 - ($('#PREVIEWCURRENTCONT').width() / 2 ))});
+ return;
+ }
+
+ function reloadPreview() {
+ $('#PREVIEWCURRENT li.selected img').trigger("click");
+ }
+
+ function _getAnswerTrain(pos, tools, query, options_serial) {
+ // keep relative position for answer train:
+ var relativePos = pos;
+ // update real absolute position with pagination:
+ var absolutePos = parseInt(p4.navigation.perPage,10) * (parseInt(p4.navigation.page, 10) - 1) + parseInt(pos,10);
+
+ $('#PREVIEWCURRENTCONT').fadeOut('fast');
+ $.ajax({
+ type: "POST",
+ url: "/prod/query/answer-train/",
+ dataType: 'json',
+ data: {
+ pos: absolutePos,
+ options_serial: options_serial,
+ query: query
+ },
+ success: function (data) {
+ _setCurrent(data.current);
+ _viewCurrent($('#PREVIEWCURRENT li.selected'));
+ _setTools(tools);
+ return;
+ }
+ });
+ }
+
+ function _getRegTrain(contId, pos, tools) {
+ $.ajax({
+ type: "POST",
+ url: "/prod/query/reg-train/",
+ dataType: 'json',
+ data: {
+ cont: contId,
+ pos: pos
+ },
+ success: function (data) {
+ _setCurrent(data.current);
+ _viewCurrent($('#PREVIEWCURRENT li.selected'));
+ if (typeof(tools) != 'undefined')
+ _setTools(tools);
+ return;
+ }
+ });
+ }
+
+ function _cancelPreview() {
+ $('#PREVIEWIMGDESCINNER').empty();
+ $('#PREVIEWIMGCONT').empty();
+ p4.preview.current = false;
+ }
+
+ function _setOthers(others) {
+
+ $('#PREVIEWOTHERSINNER').empty();
+ if (others !== '') {
+ $('#PREVIEWOTHERSINNER').append(others);
+
+ $('#PREVIEWOTHERS table.otherRegToolTip').tooltip();
+ }
+ }
+
+ function _setTools(tools) {
+ $('#PREVIEWTOOL').empty().append(tools);
+ if (!p4.slideShowCancel && p4.slideShow) {
+ $('#start_slide').hide();
+ $('#stop_slide').show();
+ } else {
+ $('#start_slide').show();
+ $('#stop_slide').hide();
+ }
+ }
+
+ function resizePreview() {
+ p4.preview.height = $('#PREVIEWIMGCONT').height();
+ p4.preview.width = $('#PREVIEWIMGCONT').width();
+ _setPreview();
+ }
+ return {
+ openPreview: openPreview,
+ closePreview: closePreview,
+ startSlide: startSlide,
+ stopSlide: stopSlide,
+ getNext: getNext,
+ getPrevious: getPrevious,
+ reloadPreview: reloadPreview,
+ resizePreview: resizePreview
+ }
+})(p4);
diff --git a/resources/www/prod/js/jquery.Feedback.js b/resources/www/prod/js/components/push/push.js
similarity index 98%
rename from resources/www/prod/js/jquery.Feedback.js
rename to resources/www/prod/js/components/push/push.js
index f57aa58a36..a655493de6 100644
--- a/resources/www/prod/js/jquery.Feedback.js
+++ b/resources/www/prod/js/components/push/push.js
@@ -1,5 +1,5 @@
-;
-(function (window) {
+
+var pushModule = (function (window, p4) {
var Feedback = function ($container, context) {
this.container = $($container);
@@ -690,7 +690,19 @@
};
- window.Feedback = Feedback;
- window.ListManager = ListManager;
+ function reloadBridge(url) {
+ var options = $('#dialog_publicator form[name="current_datas"]').serializeArray();
+ var dialog = p4.Dialog.get(1);
+ dialog.load(url, 'POST', options);
+ }
-}(window));
+
+
+ // instance wil be stored in p4.Feedback
+ return {
+ Feedback: Feedback,
+ ListManager: ListManager,
+ reloadBridge: reloadBridge
+ }
+
+}(window, p4));
diff --git a/resources/www/prod/js/components/search/search-result.js b/resources/www/prod/js/components/search/search-result.js
index dbbb063b41..f9cc184d7a 100644
--- a/resources/www/prod/js/components/search/search-result.js
+++ b/resources/www/prod/js/components/search/search-result.js
@@ -1,6 +1,6 @@
var p4 = p4 || {};
-(function (p4, window) {
+var searchResultModule = (function (p4, window) {
p4.Results = {
'Selection': new Selectable($('#answers'), {
@@ -10,7 +10,7 @@ var p4 = p4 || {};
$('#answercontextwrap table:visible').hide();
},
selectStop: function (event, selection) {
- viewNbSelect();
+ searchModule.viewNbSelect();
},
callbackSelection: function (element) {
var elements = $(element).attr('id').split('_');
@@ -20,5 +20,13 @@ var p4 = p4 || {};
})
};
- return;
+ function gotopage(pag) {
+ $('#searchForm input[name="sel"]').val(p4.Results.Selection.serialize());
+ $('#formAnswerPage').val(pag);
+ $('#searchForm').submit();
+ }
+
+ return {
+ gotopage: gotopage
+ };
}(p4, window));
diff --git a/resources/www/prod/js/components/search/search.js b/resources/www/prod/js/components/search/search.js
index 0833f749f5..2407875986 100644
--- a/resources/www/prod/js/components/search/search.js
+++ b/resources/www/prod/js/components/search/search.js
@@ -71,7 +71,7 @@ var searchModule = (function (p4) {
$('#SENT_query').val(query);
var histo = $('#history-queries ul');
- histo.prepend('' + query + ' ');
+ histo.prepend('' + query + ' ');
var lis = $('li', histo);
if (lis.length > 25) {
@@ -157,7 +157,7 @@ var searchModule = (function (p4) {
return false;
}
});
- linearize();
+ prodModule.linearizeUi();
}
function checkFilters(save) {
@@ -341,6 +341,10 @@ var searchModule = (function (p4) {
}
}
+ function viewNbSelect() {
+ $("#nbrecsel").empty().append(p4.Results.Selection.length());
+ }
+
return {
checkFilters: checkFilters,
@@ -351,6 +355,7 @@ var searchModule = (function (p4) {
afterSearch: afterSearch,
clearAnswers: clearAnswers,
newSearch: newSearch,
- resetSearch: resetSearch
+ resetSearch: resetSearch,
+ viewNbSelect: viewNbSelect
};
}(p4));
diff --git a/resources/www/prod/js/components/utils.js b/resources/www/prod/js/components/utils.js
index 63b7fd7a69..05f6658fa3 100644
--- a/resources/www/prod/js/components/utils.js
+++ b/resources/www/prod/js/components/utils.js
@@ -4,9 +4,9 @@ var utilsModule = (function (p4) {
function RGBtoHex(R, G, B) {
- return toHex(R) + toHex(G) + toHex(B);
+ return _toHex(R) + _toHex(G) + _toHex(B);
}
- function toHex(N) {
+ function _toHex(N) {
if (N === null) return "00";
N = parseInt(N);
if (N === 0 || isNaN(N)) return "00";
@@ -30,9 +30,9 @@ var utilsModule = (function (p4) {
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);
+ r = _HueToRgb(m1, m2, hue + 1 / 3);
+ g = _HueToRgb(m1, m2, hue);
+ b = _HueToRgb(m1, m2, hue - 1 / 3);
}
return {
r: r,
@@ -41,7 +41,7 @@ var utilsModule = (function (p4) {
};
}
- function HueToRgb(m1, m2, hue) {
+ function _HueToRgb(m1, m2, hue) {
var v;
if (hue < 0)
hue += 1;
@@ -59,7 +59,34 @@ var utilsModule = (function (p4) {
return 255 * v;
}
+
+ function is_ctrl_key(event) {
+ if (event.altKey)
+ return true;
+ if (event.ctrlKey)
+ return true;
+ if (event.metaKey) // apple key opera
+ return true;
+ if (event.keyCode === 17) // apple key opera
+ return true;
+ if (event.keyCode === 224) // apple key mozilla
+ return true;
+ if (event.keyCode === 91) // apple key safari
+ return true;
+
+ return false;
+ }
+
+ function is_shift_key(event) {
+ if (event.shiftKey)
+ return true;
+ return false;
+ }
+
return {
- RGBtoHex: RGBtoHex, hsl2rgb: hsl2rgb
+ RGBtoHex: RGBtoHex,
+ hsl2rgb: hsl2rgb,
+ is_ctrl_key: is_ctrl_key,
+ is_shift_key: is_shift_key
};
}(p4));
diff --git a/resources/www/prod/js/components/workzone/workzone-basket.js b/resources/www/prod/js/components/workzone/workzone-basket.js
index b92a6686f3..f61cf1331f 100644
--- a/resources/www/prod/js/components/workzone/workzone-basket.js
+++ b/resources/www/prod/js/components/workzone/workzone-basket.js
@@ -98,5 +98,10 @@ var workzoneBasketModule = (function (p4) {
- return {archiveBasket: archiveBasket, deleteBasket: deleteBasket, openBasketPreferences: openBasketPreferences}
+ return {
+ archiveBasket: archiveBasket,
+ deleteBasket: deleteBasket,
+ openBasketPreferences: openBasketPreferences
+
+ }
})(p4);
\ No newline at end of file
diff --git a/resources/www/prod/js/components/workzone/workzone-thesaurus.js b/resources/www/prod/js/components/workzone/workzone-thesaurus.js
new file mode 100644
index 0000000000..01631b2f58
--- /dev/null
+++ b/resources/www/prod/js/components/workzone/workzone-thesaurus.js
@@ -0,0 +1,33 @@
+var p4 = p4 || {};
+
+var workzoneThesaurusModule = (function (p4) {
+ $(document).ready(function () {
+
+ $('#thesaurus_tab .input-medium').on('keyup', function(){
+ if($('#thesaurus_tab .input-medium').val() != ''){
+ $('#thesaurus_tab .th_clear').show();
+ }else{
+ $('#thesaurus_tab .th_clear').hide();
+ }
+ });
+
+ $('.th_clear').on('click', function(){
+ $('#thesaurus_tab .input-medium').val('');
+ $('#thesaurus_tab .gform').submit();
+ $('#thesaurus_tab .th_clear').hide();
+ });
+
+ $('.treeview>li.expandable>.hitarea').on('click', function(){
+ if($(this).css('background-position') == '99% 22px'){
+ $(this).css('background-position', '99% -28px');
+ $(this).addClass('active');
+ }else{
+ $(this).css('background-position', '99% 22px');
+ $(this).removeClass('active');
+ }
+ });
+
+ });
+
+ return {};
+})(p4);
diff --git a/resources/www/prod/js/components/workzone/workzone.js b/resources/www/prod/js/components/workzone/workzone.js
index f4b353366b..ac5ae1105d 100644
--- a/resources/www/prod/js/components/workzone/workzone.js
+++ b/resources/www/prod/js/components/workzone/workzone.js
@@ -1,6 +1,77 @@
var p4 = p4 || {};
var workzoneModule = (function (p4) {
+ var warnOnRemove = true;
+ $(document).ready(function () {
+ activeBaskets();
+
+ $('a.story_unfix').on('click', function () {
+ unfix($(this).attr('href'));
+
+ return false;
+ });
+
+ p4.WorkZone = {
+ 'Selection': new Selectable($('#baskets'), {selector: '.CHIM'}),
+ 'refresh': refreshBaskets,
+ 'addElementToBasket': function (sbas_id, record_id, event, singleSelection) {
+ singleSelection = !!singleSelection || false;
+
+ if ($('#baskets .SSTT.active').length === 1) {
+ return dropOnBask(event, $('#IMGT_' + sbas_id + '_' + record_id), $('#baskets .SSTT.active'), singleSelection);
+ } else {
+ humane.info(language.noActiveBasket);
+ }
+ },
+ "removeElementFromBasket": WorkZoneElementRemover,
+ 'reloadCurrent': function () {
+ var sstt = $('#baskets .content:visible');
+ if (sstt.length === 0)
+ return;
+ getContent(sstt.prev());
+ },
+ 'close': function () {
+ var frame = $('#idFrameC'), that = this;
+
+ if (!frame.hasClass('closed')) {
+ // hide tabs content
+ $('#idFrameC .tabs > .ui-tabs-panel').hide();
+
+ frame.data('openwidth', frame.width());
+ frame.animate({width: 100},
+ 300,
+ 'linear',
+ function () {
+ prodModule.answerSizer();
+ prodModule.linearizeUi();
+ $('#answers').trigger('resize');
+ });
+ frame.addClass('closed');
+ $('.escamote', frame).hide();
+ frame.unbind('click.escamote').bind('click.escamote', function () {
+ that.open();
+ });
+ }
+ },
+ 'open': function () {
+ var frame = $('#idFrameC');
+
+ if (frame.hasClass('closed')) {
+ var width = frame.data('openwidth') ? frame.data('openwidth') : 300;
+ frame.css({width: width});
+ prodModule.answerSizer();
+ prodModule.linearizeUi();
+ frame.removeClass('closed');
+ $('.escamote', frame).show();
+ frame.unbind('click.escamote');
+ // show tabs content
+ var activeTabIdx = $('#idFrameC .tabs').tabs("option", "active");
+ $('#idFrameC .tabs > div:eq(' + activeTabIdx + ')').show();
+ }
+ }
+ };
+ });
+
function refreshBaskets(baskId, sort, scrolltobottom, type) {
type = typeof type === 'undefined' ? 'basket' : type;
@@ -80,7 +151,7 @@ var workzoneModule = (function (p4) {
function WorkZoneElementRemover(el, confirm) {
var context = el.data('context');
- if (confirm !== true && $(el).hasClass('groupings') && p4.reg_delete) {
+ if (confirm !== true && $(el).hasClass('groupings') && warnOnRemove) {
var buttons = {};
buttons[language.valider] = function () {
@@ -92,7 +163,7 @@ var workzoneModule = (function (p4) {
$("#DIALOG-baskets").dialog('close').remove();
};
- var texte = '' + language.confirmRemoveReg + '
' + language.hideMessage + '
';
+ var texte = '' + language.confirmRemoveReg + '
' + language.hideMessage + '
';
$('body').append('
');
$("#DIALOG-baskets").attr('title', language.removeTitle)
.empty()
@@ -151,7 +222,7 @@ var workzoneModule = (function (p4) {
// click next item
selectedItem.next().find("img").trigger("click");
} else {
- closePreview();
+ recordPreviewModule.closePreview();
}
selectedItem.remove();
@@ -368,14 +439,14 @@ var workzoneModule = (function (p4) {
.remove();
},
drag: function (event, ui) {
- if (is_ctrl_key(event) || $(this).closest('.content').hasClass('grouping'))
+ if (utilsModule.is_ctrl_key(event) || $(this).closest('.content').hasClass('grouping'))
$('#dragDropCursor div').empty().append('+ ' + p4.WorkZone.Selection.length());
else
$('#dragDropCursor div').empty().append(p4.WorkZone.Selection.length());
}
});
- answerSizer();
+ prodModule.answerSizer();
return;
}
});
@@ -427,7 +498,7 @@ var workzoneModule = (function (p4) {
switch (action) {
case "CHU2CHU" :
- if (!is_ctrl_key(event)) act = "MOV";
+ if (!utilsModule.is_ctrl_key(event)) act = "MOV";
break;
case "IMGT2REG":
case "CHU2REG" :
@@ -528,75 +599,18 @@ var workzoneModule = (function (p4) {
});
}
- $(document).ready(function () {
- activeBaskets();
+ function setRemoveWarning(state) {
+ warnOnRemove = state;
+ }
+ // remove record from basket/story preferences
+ function toggleRemoveWarning(el) {
+ var state = !el.checked;
+ userModule.setPref('reg_delete', (state ? '1' : '0'));
+ warnOnRemove = state;
+ }
- $('a.story_unfix').on('click', function () {
- unfix($(this).attr('href'));
-
- return false;
- });
-
- p4.WorkZone = {
- 'Selection': new Selectable($('#baskets'), {selector: '.CHIM'}),
- 'refresh': refreshBaskets,
- 'addElementToBasket': function (sbas_id, record_id, event, singleSelection) {
- singleSelection = !!singleSelection || false;
-
- if ($('#baskets .SSTT.active').length === 1) {
- return dropOnBask(event, $('#IMGT_' + sbas_id + '_' + record_id), $('#baskets .SSTT.active'), singleSelection);
- } else {
- humane.info(language.noActiveBasket);
- }
- },
- "removeElementFromBasket": WorkZoneElementRemover,
- 'reloadCurrent': function () {
- var sstt = $('#baskets .content:visible');
- if (sstt.length === 0)
- return;
- getContent(sstt.prev());
- },
- 'close': function () {
- var frame = $('#idFrameC'), that = this;
-
- if (!frame.hasClass('closed')) {
- // hide tabs content
- $('#idFrameC .tabs > .ui-tabs-panel').hide();
-
- frame.data('openwidth', frame.width());
- frame.animate({width: 100},
- 300,
- 'linear',
- function () {
- answerSizer();
- linearize();
- $('#answers').trigger('resize');
- });
- frame.addClass('closed');
- $('.escamote', frame).hide();
- frame.unbind('click.escamote').bind('click.escamote', function () {
- that.open();
- });
- }
- },
- 'open': function () {
- var frame = $('#idFrameC');
-
- if (frame.hasClass('closed')) {
- var width = frame.data('openwidth') ? frame.data('openwidth') : 300;
- frame.css({width: width});
- answerSizer();
- linearize();
- frame.removeClass('closed');
- $('.escamote', frame).show();
- frame.unbind('click.escamote');
- // show tabs content
- var activeTabIdx = $('#idFrameC .tabs').tabs("option", "active");
- $('#idFrameC .tabs > div:eq(' + activeTabIdx + ')').show();
- }
- }
- };
- });
-
- return;
+ return {
+ setRemoveWarning: setRemoveWarning,
+ toggleRemoveWarning: toggleRemoveWarning
+ }
}(p4));
diff --git a/resources/www/prod/js/core/selectable.js b/resources/www/prod/js/core/selectable.js
index 42cca51f75..24f9c4080f 100644
--- a/resources/www/prod/js/core/selectable.js
+++ b/resources/www/prod/js/core/selectable.js
@@ -46,7 +46,7 @@
var k = get_value($that, $this);
- if (is_shift_key(event) && jQuery('.last_selected', this.$container).filter($this.options.selector).length != 0) {
+ if (utilsModule.is_shift_key(event) && jQuery('.last_selected', this.$container).filter($this.options.selector).length != 0) {
var lst = jQuery($this.options.selector, this.$container);
var index1 = jQuery.inArray(jQuery('.last_selected', this.$container).filter($this.options.selector)[0], lst);
@@ -89,7 +89,7 @@
}
}
else {
- if (!is_ctrl_key(event)) {
+ if (!utilsModule.is_ctrl_key(event)) {
$this.empty().push(k);
jQuery('.selected', this.$container).filter($this.options.selector).removeClass('selected');
$that.addClass('selected');
@@ -133,7 +133,7 @@
}
}
- function is_ctrl_key(event) {
+ function utilsModule.is_ctrl_key(event) {
if (event.altKey)
return true;
if (event.ctrlKey)
@@ -150,7 +150,7 @@
return false;
}
- function is_shift_key(event) {
+ function utilsModule.is_shift_key(event) {
if (event.shiftKey)
return true;
return false;
diff --git a/resources/www/prod/js/jquery.main-prod.js b/resources/www/prod/js/jquery.main-prod.js
deleted file mode 100644
index cc73744cd6..0000000000
--- a/resources/www/prod/js/jquery.main-prod.js
+++ /dev/null
@@ -1,1330 +0,0 @@
-document.getElementById('loader_bar').style.width = '30%';
-
-var p4 = p4 || {};
-
-var baskAjax, baskAjaxrunning;
-baskAjaxrunning = false;
-var answAjax, answAjaxrunning;
-answAjaxrunning = false;
-var searchAjax, searchAjaxRunning;
-searchAjaxRunning = false;
-
-$(document).ready(function () {
- humane.info = humane.spawn({addnCls: 'humane-libnotify-info', timeout: 1000});
- humane.error = humane.spawn({addnCls: 'humane-libnotify-error', timeout: 1000});
-
- $('body').on('click', 'a.dialog', function (event) {
- var $this = $(this), size = 'Medium';
-
- if ($this.hasClass('small-dialog')) {
- size = 'Small';
- } else if ($this.hasClass('full-dialog')) {
- size = 'Full';
- }
-
- var options = {
- size: size,
- loading: true,
- title: $this.attr('title'),
- closeOnEscape: true
- };
-
- $dialog = p4.Dialog.Create(options);
-
- $.ajax({
- type: "GET",
- url: $this.attr('href'),
- dataType: 'html',
- success: function (data) {
- $dialog.setContent(data);
- return;
- }
- });
-
- return false;
- });
-});
-
-//var language = {}; // handled with external prodution module
-var bodySize = {
- x: 0,
- y: 0
-};
-
-function resizePreview() {
- p4.preview.height = $('#PREVIEWIMGCONT').height();
- p4.preview.width = $('#PREVIEWIMGCONT').width();
- setPreview();
-}
-
-
-// @TODO keyboard methods should be moved in an external component
-function is_ctrl_key(event) {
- if (event.altKey)
- return true;
- if (event.ctrlKey)
- return true;
- if (event.metaKey) // apple key opera
- return true;
- if (event.keyCode === 17) // apple key opera
- return true;
- if (event.keyCode === 224) // apple key mozilla
- return true;
- if (event.keyCode === 91) // apple key safari
- return true;
-
- return false;
-}
-
-// @TODO keyboard methods should be moved in an external component
-function is_shift_key(event) {
- if (event.shiftKey)
- return true;
- return false;
-}
-
-
-function resize() {
- var body = $('#mainContainer');
- bodySize.y = body.height();
- bodySize.x = body.width();
-
- $('.overlay').height(bodySize.y).width(bodySize.x);
-
- var headBlockH = $('#headBlock').outerHeight();
- var bodyY = bodySize.y - headBlockH - 2;
- var bodyW = bodySize.x - 2;
- //$('#desktop').height(bodyY).width(bodyW);
-
- if (p4.preview.open)
- resizePreview();
-
- if ($('#idFrameC').data('ui-resizable')) {
- $('#idFrameC').resizable('option', 'maxWidth', (480));
- $('#idFrameC').resizable('option', 'minWidth', 300);
- }
-
- answerSizer();
- linearize();
-
-
-}
-
-
-
-
-
-function initAnswerForm() {
- var searchForm = $('#searchForm');
- $('button[type="submit"]', searchForm).bind('click', function () {
- workzoneFacetsModule.resetSelectedFacets();
- searchModule.newSearch($("#EDIT_query").val());
- return false;
- });
-
- searchForm.unbind('submit').bind('submit', function () {
-
- var $this = $(this),
- method = $this.attr('method') ? $this.attr('method') : 'POST';
-
- var data = $this.serializeArray();
-
- answAjax = $.ajax({
- type: method,
- url: $this.attr('action'),
- data: data,
- dataType: 'json',
- beforeSend: function (formData) {
- if (answAjaxrunning && answAjax.abort)
- answAjax.abort();
- searchModule.beforeSearch();
- },
- error: function () {
- answAjaxrunning = false;
- $('#answers').removeClass('loading');
- },
- timeout: function () {
- answAjaxrunning = false;
- $('#answers').removeClass('loading');
- },
- success: function (datas) {
-
- // DEBUG QUERY PARSER
- try {
- console.info(JSON.parse(datas.parsed_query));
- }
- catch(e) {}
-
- $('#answers').empty().append(datas.results).removeClass('loading');
-
- $("#answers img.lazyload").lazyload({
- container: $('#answers')
- });
-
- workzoneFacetsModule.loadFacets(datas.facets);
-
- $('#answers').append('');
-
- $('#tool_results').empty().append(datas.infos);
- $('#tool_navigate').empty().append(datas.navigationTpl);
-
- $.each(p4.Results.Selection.get(), function (i, el) {
- $('#IMGT_' + el).addClass('selected');
- });
-
- p4.tot = datas.total_answers;
- p4.tot_options = datas.form;
- p4.tot_query = datas.query;
- p4.navigation = datas.navigation;
-
- if (datas.next_page) {
- $("#NEXT_PAGE, #answersNext").bind('click', function () {
- gotopage(datas.next_page);
- });
- }
- else {
- $("#NEXT_PAGE").unbind('click');
- }
-
- if (datas.prev_page) {
- $("#PREV_PAGE").bind('click', function () {
- gotopage(datas.prev_page);
- });
- }
- else {
- $("#PREV_PAGE").unbind('click');
- }
-
- searchModule.afterSearch();
- }
- });
- return false;
- });
-}
-
-
-function answerSizer() {
- var el = $('#idFrameC').outerWidth();
- if (!$.support.cssFloat) {
- // $('#idFrameC .insidebloc').width(el - 56);
- }
- var widthA = Math.round(bodySize.x - el - 10);
- $('#rightFrame').width(widthA);
- $('#rightFrame').css('left', $('#idFrameC').width());
-
-}
-
-function linearize() {
- var list = $('#answers .list');
- if (list.length > 0) {
- var fllWidth = $('#answers').innerWidth();
- fllWidth -= 16;
-
- var stdWidth = 460;
- var diff = 28;
- var n = Math.round(fllWidth / (stdWidth));
- var w = Math.floor(fllWidth / n) - diff;
- if (w < 360 && n > 1)
- w = Math.floor(fllWidth / (n - 1)) - diff;
- $('#answers .list').width(w);
- }
- else {
- var minMargin = 5;
- var margin = 0;
- var el = $('#answers .diapo:first');
- var diapoWidth = el.outerWidth() + (minMargin * 2);
- var fllWidth = $('#answers').innerWidth();
- fllWidth -= 26;
-
- var n = Math.floor(fllWidth / (diapoWidth));
-
- margin = Math.floor((fllWidth % diapoWidth) / (2 * n));
- margin = margin + minMargin;
-
- $('#answers .diapo').css('margin', '5px ' + (margin) + 'px');
- }
-
-}
-
-
-
-
-
-$(document).ready(function () {
- humane.forceNew = true;
- cguModule.activateCgus();
-});
-
-
-function triggerShortcuts() {
-
- $('#keyboard-stop').bind('click', function () {
- var display = $(this).get(0).checked ? '0' : '1';
-
- userModule.setPref('keyboard_infos', display);
-
- });
-
- var buttons = {};
-
- buttons[language.fermer] = function () {
- $("#keyboard-dialog").dialog('close');
- };
-
- $('#keyboard-dialog').dialog({
- closeOnEscape: false,
- resizable: false,
- draggable: false,
- modal: true,
- width: 600,
- height: 400,
- overlay: {
- backgroundColor: '#000',
- opacity: 0.7
- },
- open: function (event, ui) {
- $(this).dialog("widget").css("z-index", "1400");
- },
- close: function () {
- $(this).dialog("widget").css("z-index", "auto");
- if ($('#keyboard-stop').get(0).checked) {
- var dialog = $('#keyboard-dialog');
- if (dialog.data("ui-dialog")) {
- dialog.dialog('destroy');
- }
- dialog.remove();
- }
- }
- }).dialog('option', 'buttons', buttons).dialog('open');
-
- $('#keyboard-dialog').scrollTop(0);
-
- return false;
-}
-
-function activeZoning() {
- $('#idFrameC, #rightFrame').bind('mousedown', function (event) {
- var old_zone = p4.active_zone;
- p4.active_zone = $(this).attr('id');
- if (p4.active_zone !== old_zone && p4.active_zone !== 'headBlock') {
- $('.effectiveZone.activeZone').removeClass('activeZone');
- $('.effectiveZone', this).addClass('activeZone');//.flash('#555555');
- }
- $('#EDIT_query').blur();
- });
- $('#rightFrame').trigger('mousedown');
-}
-
-
-
-
-$(document).ready(function () {
-
- $('input[name=search_type]').bind('click', function () {
- console.log('search bind')
- var $this = $(this);
- var $record_types = $('#recordtype_sel');
-
- console.log($this.hasClass('mode_type_reg'), $record_types)
- if ($this.hasClass('mode_type_reg')) {
- $record_types.css("visibility", "hidden"); // better than hide because does not change layout
- $record_types.prop("selectedIndex", 0);
- } else {
- $record_types.css("visibility", "visible");
- }
- });
-
- $('.adv_search_button').on('click', function () {
- var searchForm = $('#searchForm');
- var parent = searchForm.parent();
-
- var options = {
- size: (bodySize.x - 120)+'x'+(bodySize.y - 120),
- loading: false,
- closeCallback: function (dialog) {
-
- var datas = dialog.find('form.phrasea_query').appendTo(parent);//.clone();
-
- $('.adv_trigger', searchForm).show();
- $('.adv_options', searchForm).hide();
- }
- };
-
- $dialog = p4.Dialog.Create(options);
-
- searchForm.appendTo($dialog.getDomElement());
-
- $dialog.getDomElement().find('.adv_options').show();
- $dialog.getDomElement().find('.adv_trigger').hide();
-
- $dialog.getDomElement().find('form').bind('submit.conbo', function () {
- $(this).unbind('submit.conbo');
- $dialog.Close();
- return false;
- });
-
-
- return false;
- });
-
- $(document).bind('contextmenu', function (event) {
- var targ;
- if (event.target)
- targ = event.target;
- else if (event.srcElement)
- targ = event.srcElement;
- if (targ.nodeType === 3)// safari bug
- targ = targ.parentNode;
-
- var gogo = true;
- var targ_name = targ.nodeName ? targ.nodeName.toLowerCase() : false;
-
- if (targ_name !== 'input' && targ_name.toLowerCase() !== 'textarea') {
- gogo = false;
- }
- if (targ_name === 'input') {
- if ($(targ).is(':checkbox'))
- gogo = false;
- }
-
- return gogo;
- });
-
- $('.basket_refresher').on('click', function () {
- return p4.WorkZone.refresh('current');
- return false;
- });
-
- $('#loader_bar').stop().animate({
- width: '70%'
- }, 450);
- p4.preview = {
- open: false,
- current: false
- };
- p4.currentViewMode = 'classic';
- p4.nbNoview = 0;
- p4.reg_delete = true;
- p4.sel = [];
- p4.baskSel = [];
- p4.edit = {};
- p4.thesau = {
- tabs: null
- };
- p4.active_zone = false;
- p4.next_bask_scroll = false;
-
-
- $('#backcolorpickerHolder').ColorPicker({
- flat: true,
- color: '404040',
- livePreview: false,
- eventName: 'mouseover',
- onSubmit: function (hsb, hex, rgb, el) {
- var back_hex = '';
- var unactive = '';
-
-
- if (hsb.b >= 50) {
- back_hex = '000000';
-
- var sim_b = 0.1 * hsb.b;
- }
- else {
- back_hex = 'FFFFFF';
-
- var sim_b = 100 - 0.1 * (100 - hsb.b);
- }
-
- var sim_b = 0.1 * hsb.b;
-
- var sim_rgb = utilsModule.hsl2rgb(hsb.h, hsb.s, sim_b);
- var sim_hex = utilsModule.RGBtoHex(sim_rgb.r, sim_rgb.g, sim_rgb.b);
-
- userModule.setPref('background-selection', hex);
- userModule.setPref('background-selection-disabled', sim_hex);
- userModule.setPref('fontcolor-selection', back_hex);
-
- $('style[title=color_selection]').empty();
-
- var datas = '.diapo.selected,#reorder_box .diapo.selected, #EDIT_ALL .diapo.selected, .list.selected, .list.selected .diapo' +
- '{' +
- ' COLOR: #' + back_hex + ';' +
- ' BACKGROUND-COLOR: #' + hex + ';' +
- '}';
- $('style[title=color_selection]').empty().text(datas);
- }
- });
- $('#backcolorpickerHolder').find('.colorpicker_submit').append($('#backcolorpickerHolder .submiter')).bind('click', function () {
- $(this).highlight('#CCCCCC');
- });
-
- $('#search_submit').on('mousedown', function (event) {
- return false;
- });
-
- $('#history-queries ul li').on('mouseover',function () {
- $(this).addClass('hover');
- }).on('mouseout', function () {
- $(this).removeClass('hover');
- });
-
- startThesaurus();
- searchModule.checkFilters();
-
- activeZoning();
-
- $('.shortcuts-trigger').bind('click', function () {
- triggerShortcuts();
- });
-
- $('#idFrameC').resizable({
- handles: 'e',
- resize: function () {
- answerSizer();
- linearize();
- },
- stop: function () {
-
- var el = $('.SSTT.active').next().find('div:first');
- var w = el.find('div.chim-wrapper:first').outerWidth();
- var iw = el.innerWidth();
- var diff = $('#idFrameC').width() - el.outerWidth();
- var n = Math.floor(iw / w);
-
- $('#idFrameC').height('auto');
-
- var nwidth = (n) * w + diff + n;
- if (isNaN(nwidth)) {
- saveWindows();
- return;
- }
- if (nwidth < 265)
- nwidth = 265;
- if (el.find('div.chim-wrapper:first').hasClass('valid') && nwidth < 410)
- nwidth = 410;
-
-
- $('#idFrameC').stop().animate({
- width: nwidth
- },
- 300,
- 'linear',
- function () {
- answerSizer();
- linearize();
- saveWindows();
- });
- }
- });
-
- $('#idFrameC .ui-tabs-nav li').on('click', function (event) {
- if($('#idFrameC').attr('data-status') == 'closed'){
- $('#idFrameC').width(300);
- $('#rightFrame').css('left', 300);
- $('#rightFrame').width($(window).width()-300);
- $('#baskets, #proposals, #thesaurus_tab').hide();
- $('.ui-resizable-handle, #basket_menu_trigger').show();
- var IDname = $(this).attr('aria-controls');
- $('#'+IDname).show();
- }
-
- $('#idFrameC').attr('data-status', 'open');
- $('.WZbasketTab').css('background-position', '9px 21px');
- $('#idFrameC').removeClass('closed');
- });
-
- var previousTab = "";
-
- $('#idFrameC #retractableButton').bind('click', function (event) {
-
- if($('#idFrameC').attr('data-status') != 'closed'){
- $(this).find('i').removeClass('icon-double-angle-left').addClass('icon-double-angle-right')
- $('#idFrameC').width(80);
- $('#rightFrame').css('left', 80);
- $('#rightFrame').width($(window).width()-80);
- $('#idFrameC').attr('data-status', 'closed');
- $('#baskets, #proposals, #thesaurus_tab, .ui-resizable-handle, #basket_menu_trigger').hide();
- $('#idFrameC .ui-tabs-nav li').removeClass('ui-state-active');
- $('.WZbasketTab').css('background-position', '15px 16px');
- $('#idFrameC').addClass('closed');
- previousTab = $('#idFrameC .icon-menu').find('li.ui-tabs-active');
- }else{
- $(this).find('i').removeClass('icon-double-angle-right').addClass('icon-double-angle-left')
- $('#idFrameC').width(300);
- $('#rightFrame').css('left', 300);
- $('#rightFrame').width($(window).width()-300);
- $('#idFrameC').attr('data-status', 'open');
- $('.ui-resizable-handle, #basket_menu_trigger').show();
- $('.WZbasketTab').css('background-position', '9px 16px');
- $('#idFrameC').removeClass('closed');
- $('#idFrameC .icon-menu li').last().find('a').trigger('click');
- $('#idFrameC .icon-menu li').first().find('a').trigger('click');
- $(previousTab).find('a').trigger('click');
- }
-
- event.stopImmediatePropagation();
- //p4.WorkZone.close();
- return false;
- });
-
- $('#look_box .tabs').tabs();
-
- resize();
-
- $(window).bind('resize', function () {
- resize();
- });
- $('body').append('');
-
- $('body').append('');
-
- $('#basket_menu_trigger').contextMenu('#basket_menu', {
- openEvt: 'click',
- dropDown: true,
- theme: 'vista',
- showTransition: 'slideDown',
- hideTransition: 'hide',
- shadow: false
- });
-
- $('#basket_menu_trigger').trigger("click");
- $('#basket_menu_trigger').trigger("click");
-
- $('.datepicker').datepicker({
- changeYear: true,
- changeMonth: true,
- dateFormat: 'yy/mm/dd'
- });
-
- /*$.ajaxSetup({
-
- error: function (jqXHR, textStatus, errorThrown) {
- //Request is aborted
- if (errorThrown === 'abort') {
- return false;
- } else {
- showModal('error', {
- title: language.errorAjaxRequest + ' ' + jqXHR.responseText
- });
- }
- },
- timeout: function () {
- showModal('timeout', {
- title: 'Server not responding'
- });
- }
- });*/
-
- $('.tools .answer_selector').bind('click',function () {
- selector($(this));
- }).bind('mouseover',function (event) {
- if (is_ctrl_key(event)) {
- $(this).addClass('add_selector');
- }
- else {
- $(this).removeClass('add_selector');
- }
- }).bind('mouseout', function () {
- $(this).removeClass('add_selector');
- });
-
- // getLanguage();
-
- initAnswerForm();
-
- preferencesModule.initLook();
-
- // setTimeout("pollNotifications();", 10000);
-
- $(this).bind('keydown', function (event) {
- var cancelKey = false;
- var shortCut = false;
-
- if ($('#MODALDL').is(':visible')) {
- switch (event.keyCode) {
- case 27:
- hideDwnl();
- break;
- }
- }
- else {
- if ($('#EDITWINDOW').is(':visible')) {
-
- switch (event.keyCode) {
- case 9: // tab ou shift-tab
- recordEditorModule.edit_chgFld(event, is_shift_key(event) ? -1 : 1);
- cancelKey = shortCut = true;
- break;
- case 27:
- recordEditorModule.edit_cancelMultiDesc(event);
- shortCut = true;
- break;
-
- case 33: // pg up
- if (!p4.edit.textareaIsDirty || recordEditorModule.edit_validField(event, "ask_ok"))
- recordEditorModule.skipImage(event, 1);
- cancelKey = true;
- break;
- case 34: // pg dn
- if (!p4.edit.textareaIsDirty || recordEditorModule.edit_validField(event, "ask_ok"))
- recordEditorModule.skipImage(event, -1);
- cancelKey = true;
- break;
- }
-
- }
- else {
- if (p4.preview.open) {
- if (($('#dialog_dwnl:visible').length === 0 && $('#DIALOG1').length === 0 && $('#DIALOG2').length === 0)) {
- switch (event.keyCode) {
- case 39:
- getNext();
- cancelKey = shortCut = true;
- break;
- case 37:
- getPrevious();
- cancelKey = shortCut = true;
- break;
- case 27://escape
- closePreview();
- break;
- case 32:
- if (p4.slideShow)
- stopSlide();
- else
- startSlide();
- cancelKey = shortCut = true;
- break;
- }
- }
- }
- else {
- if ($('#EDIT_query').hasClass('focused'))
- return true;
-
- if ($('.overlay').is(':visible'))
- return true;
-
- if ($('.ui-widget-overlay').is(':visible'))
- return true;
-
- switch (p4.active_zone) {
- case 'rightFrame':
- switch (event.keyCode) {
- case 65: // a
- if (is_ctrl_key(event)) {
- $('.tools .answer_selector.all_selector').trigger('click');
- cancelKey = shortCut = true;
- }
- break;
- case 80://P
- if (is_ctrl_key(event)) {
- printThis("lst=" + p4.Results.Selection.serialize());
- cancelKey = shortCut = true;
- }
- break;
- case 69://e
- if (is_ctrl_key(event)) {
- editThis('IMGT', p4.Results.Selection.serialize());
- cancelKey = shortCut = true;
- }
- break;
- case 40: // down arrow
- $('#answers').scrollTop($('#answers').scrollTop() + 30);
- cancelKey = shortCut = true;
- break;
- case 38: // down arrow
- $('#answers').scrollTop($('#answers').scrollTop() - 30);
- cancelKey = shortCut = true;
- break;
- case 37://previous page
- $('#PREV_PAGE').trigger('click');
- shortCut = true;
- break;
- case 39://previous page
- $('#NEXT_PAGE').trigger('click');
- shortCut = true;
- break;
- case 9://tab
- if (!is_ctrl_key(event) && !$('.ui-widget-overlay').is(':visible') && !$('.overlay_box').is(':visible')) {
- document.getElementById('EDIT_query').focus();
- cancelKey = shortCut = true;
- }
- break;
- }
- break;
-
-
- case 'idFrameC':
- switch (event.keyCode) {
- case 65: // a
- if (is_ctrl_key(event)) {
- p4.WorkZone.Selection.selectAll();
- cancelKey = shortCut = true;
- }
- break;
- case 80://P
- if (is_ctrl_key(event)) {
- printThis("lst=" + p4.WorkZone.Selection.serialize());
- cancelKey = shortCut = true;
- }
- break;
- case 69://e
- if (is_ctrl_key(event)) {
- editThis('IMGT', p4.WorkZone.Selection.serialize());
- cancelKey = shortCut = true;
- }
- break;
- // case 46://del
- // deleteThis(p4.Results.Selection.serialize());
- // cancelKey = true;
- // break;
- case 40: // down arrow
- $('#baskets div.bloc').scrollTop($('#baskets div.bloc').scrollTop() + 30);
- cancelKey = shortCut = true;
- break;
- case 38: // down arrow
- $('#baskets div.bloc').scrollTop($('#baskets div.bloc').scrollTop() - 30);
- cancelKey = shortCut = true;
- break;
- // case 37://previous page
- // $('#PREV_PAGE').trigger('click');
- // break;
- // case 39://previous page
- // $('#NEXT_PAGE').trigger('click');
- // break;
- case 9://tab
- if (!is_ctrl_key(event) && !$('.ui-widget-overlay').is(':visible') && !$('.overlay_box').is(':visible')) {
- document.getElementById('EDIT_query').focus();
- cancelKey = shortCut = true;
- }
- break;
- }
- break;
-
-
- case 'mainMenu':
- break;
-
-
- case 'headBlock':
- break;
-
- default:
- break;
-
- }
- }
- }
- }
-
- if (!$('#EDIT_query').hasClass('focused') && event.keyCode !== 17) {
-
- if ($('#keyboard-dialog.auto').length > 0 && shortCut) {
- triggerShortcuts();
- }
- }
- if (cancelKey) {
- event.cancelBubble = true;
- if (event.stopPropagation)
- event.stopPropagation();
- return(false);
- }
- return(true);
- });
-
-
- $('#EDIT_query').bind('focus',function () {
- $(this).addClass('focused');
- }).bind('blur', function () {
- $(this).removeClass('focused');
- });
-
- $('.basketTips').tooltip({
- delay: 200
- });
-
- $('#idFrameC .tabs').tabs({
- activate: function (event, ui) {
- if (ui.newTab.context.hash == "#thesaurus_tab") {
- thesau_show();
- }
- p4.WorkZone.open();
- }
- });
-
- $('#PREVIEWBOX .gui_vsplitter', p4.edit.editBox).draggable({
- axis: 'x',
- containment: 'parent',
- drag: function (event, ui) {
- var x = $(ui.position.left)[0];
- if (x < 330 || x > (bodySize.x - 400)) {
- return false;
- }
- var v = $(ui.position.left)[0];
- $("#PREVIEWLEFT").width(v);
- $("#PREVIEWRIGHT").css("left", $(ui.position.left)[0]);
- resizePreview();
- }
- });
-
- $('input.input_select_copy').on('focus', function () {
- $(this).select();
- });
- $('input.input_select_copy').on('blur', function () {
- $(this).deselect();
- });
- $('input.input_select_copy').on('click', function () {
- $(this).select();
- });
-
- $('#loader_bar').stop().animate({
- width: '100%'
- }, 450, function () {
- $('#loader').parent().fadeOut('slow', function () {
- $(this).remove();
- });
- });
-
-});
-
-// edit modal - multiusage @todo refactor
-function editThis(type, value) {
-
- $('#idFrameE').empty().addClass('loading');
- showOverlay(2);
-
- $('#EDITWINDOW').show();
-
- var options = {
- lst: '',
- ssel: '',
- act: ''
- };
-
- switch (type) {
- case "IMGT":
- options.lst = value;
- break;
-
- case "SSTT":
- options.ssel = value;
- break;
-
- case "STORY":
- options.story = value;
- break;
- }
-
- $.ajax({
- url: "../prod/records/edit/",
- type: "POST",
- dataType: "html",
- data: options,
- success: function (data) {
- recordEditorModule.initialize();
- $('#idFrameE').removeClass('loading').empty().html(data);
- $('#tooltip').hide();
- return;
- },
- error: function (XHR, textStatus, errorThrown) {
- if (XHR.status === 0) {
- return false;
- }
- }
- });
-
- return;
-}
-
-(function ($) {
- $.fn.extend({
- highlight: function (color) {
- if ($(this).hasClass('animating')) {
- return;
- }
- color = typeof color !== 'undefined' ? color : 'red';
- var oldColor = $(this).css('backgroundColor');
- return $(this).addClass('animating').stop().animate({
- backgroundColor: color
- }, 50, 'linear', function () {
- $(this).stop().animate({
- backgroundColor: oldColor
- }, 450, 'linear', function () {
- $(this).removeClass('animating');
- });
- });
- }
- });
-})(jQuery);
-
-/*(function ($) {
- $.fn.extend({
- flash: function (color) {
- if ($(this).hasClass('animating')) {
- return true;
- }
- color = typeof color !== 'undefined' ? color : 'red';
-
- var pos = $(this).offset();
-
- if (!pos) {
- pos = {
- top: 0,
- left: 0
- };
- }
-
- var h = $(this).height();
- var w = $(this).width();
- $('body').append('
');
- $(this).addClass('animating');
- var el = $(this);
-
- $('#flashing').stop().animate({
- top: (pos.top + (h / 4)),
- left: (pos.left + (w / 4)),
- opacity: 0,
- width: ($(this).width() / 2),
- height: ($(this).height() / 2)
- }, 700, function () {
- $('#flashing').remove();
- $(el).removeClass('animating');
- });
- }
- });
-})(jQuery);*/
-
-
-function toggleRemoveReg(el) {
- var state = !el.checked;
- userModule.setPref('reg_delete', (state ? '1' : '0'));
- p4.reg_delete = state;
-}
-
-
-function deleteThis(lst) {
- if (lst.split(';').length === 0) {
- alert(language.nodocselected);
- return false;
- }
-
- var $dialog = p4.Dialog.Create({
- size: 'Small',
- title: language.deleteRecords
- });
-
- $.ajax({
- type: "POST",
- url: "../prod/records/delete/what/",
- dataType: 'html',
- data: {lst: lst},
- success: function (data) {
- $dialog.setContent(data);
- }
- });
-
- return false;
-}
-
-// trigger tools modal - multiusage @todo refactor
-function toolREFACTOR(datas, activeTab) {
-
- var dialog = p4.Dialog.Create({
- size: 'Medium',
- title: language.toolbox,
- loading: true
- });
-
- $.get("../prod/tools/"
- , datas
- , function (data) {
- dialog.setContent(data);
- dialog.setOption('contextArgs', datas);
- var tabs = $('.tabs', dialog.getDomElement()).tabs();
-
- // activate tab if exists:
- if( activeTab !== undefined ) {
- tabs.tabs('option', 'active', activeTab);
- }
- return;
- }
- );
-}
-
-function checkDeleteThis(type, el) {
- el = $(el);
- switch (type) {
-
-
- case "IMGT":
- case "CHIM":
-
- var lst = '';
-
- if (type === 'IMGT')
- lst = p4.Results.Selection.serialize();
- if (type === 'CHIM')
- lst = p4.WorkZone.Selection.serialize();
-
- deleteThis(lst);
-
- return;
- break;
-
-
- case "SSTT":
-
- var buttons = {};
- buttons[language.valider] = function (e) {
- workzoneBasketModule.deleteBasket(el);
- };
-
- $('#DIALOG').empty().append(language.confirmDel).attr('title', language.attention).dialog({
- autoOpen: false,
- resizable: false,
- modal: true,
- draggable: false
- }).dialog('open').dialog('option', 'buttons', buttons);
- $('#tooltip').hide();
- return;
- break;
- case "STORY":
- lst = el.val();
- deleteThis(lst);
- break;
-
- }
-}
-
-function shareThis(bas, rec) {
- var dialog = p4.Dialog.Create({
- title: language['share']
- });
-
- dialog.load("../prod/share/record/" + bas + "/" + rec + "/", "GET");
-}
-
-function printThis(value) {
- if ($("#DIALOG").data("ui-dialog")) {
- $("#DIALOG").dialog('destroy');
- }
- $('#DIALOG').attr('title', language.print)
- .empty().addClass('loading')
- .dialog({
- resizable: false,
- closeOnEscape: true,
- modal: true,
- width: '800',
- height: '500',
- open: function (event, ui) {
- $(this).dialog("widget").css("z-index", "1999");
- },
- close: function (event, ui) {
- $(this).dialog("widget").css("z-index", "auto");
- }
- })
- .dialog('open');
-
- $.ajax({
- type: "POST",
- url: '../prod/printer/?' + value,
- dataType: 'html',
- beforeSend: function () {
-
- },
- success: function (data) {
- $('#DIALOG').removeClass('loading').empty()
- .append(data);
- return;
- }
- });
-}
-
-
-
-
-function viewNbSelect() {
- $("#nbrecsel").empty().append(p4.Results.Selection.length());
-}
-
-function selector(el) {
- if (el.hasClass('all_selector')) {
- p4.Results.Selection.selectAll();
- }
- else {
- if (el.hasClass('none_selector')) {
- p4.Results.Selection.empty();
- }
- else {
- if (el.hasClass('starred_selector')) {
-
- }
- else {
- if (el.hasClass('video_selector')) {
- p4.Results.Selection.empty();
- p4.Results.Selection.select('.type-video');
- }
- else {
- if (el.hasClass('image_selector')) {
- p4.Results.Selection.empty();
- p4.Results.Selection.select('.type-image');
- }
- else {
- if (el.hasClass('document_selector')) {
- p4.Results.Selection.empty();
- p4.Results.Selection.select('.type-document');
- }
- else {
- if (el.hasClass('audio_selector')) {
- p4.Results.Selection.empty();
- p4.Results.Selection.select('.type-audio');
- }
- }
- }
- }
- }
- }
- }
-}
-
-function evt_dwnl(value) {
- downloadThis("lst=" + value);
-}
-
-function evt_print(value) {
- printThis("lst=" + value);
-}
-
-function evt_add_in_chutier(sbas_id, record_id, event, singleSelection) {
- var singleSelection = singleSelection || false;
- p4.WorkZone.addElementToBasket(sbas_id, record_id, event, singleSelection);
-}
-
-function remove_from_basket(el, confirm) {
- var confirm = confirm || false;
- p4.WorkZone.removeElementFromBasket(el, confirm);
-}
-
-
-function doSpecialSearch(qry, allbase) {
- if (allbase) {
- searchModule.toggleDatabase(true);
- }
- workzoneFacetsModule.resetSelectedFacets();
- $('#EDIT_query').val(decodeURIComponent(qry).replace(/\+/g, " "));
- searchModule.newSearch(qry);
-}
-
-function clktri(id) {
- var o = $('#TOPIC_UL' + id);
- if ($('#TOPIC_UL' + id).hasClass('closed'))
- $('#TOPIC_TRI' + id + ' ,#TOPIC_UL' + id).removeClass('closed').addClass('opened');
- else
- $('#TOPIC_TRI' + id + ' ,#TOPIC_UL' + id).removeClass('opened').addClass('closed');
-}
-
-
-
-
-
-/* NOT USED function showAnswer(p) {
- var o;
- if (p === 'Results') {
- // on montre les results
- if (o = document.getElementById("AnswerExplain"))
- o.style.visibility = "hidden";
- if (o = document.getElementById("AnswerResults")) {
- o.style.visibility = "";
- o.style.display = "block";
- }
- // on montre explain
- if (document.getElementById("divpage"))
- document.getElementById("divpage").style.visibility = visibilityDivPage;
-
- if (document.getElementById("explainResults"))
- document.getElementById("explainResults").style.display = "none";
- }
- else {
- // on montre explain
- if (document.getElementById("divpage")) {
- visibilityDivPage = "visible";
- document.getElementById("divpage").style.visibility = "hidden";
- }
- if (document.getElementById("explainResults"))
- document.getElementById("explainResults").style.display = "block";
-
- if (o = document.getElementById("AnswerResults")) {
- o.style.visibility = "hidden";
- o.style.display = "none";
-
- }
- if (o = document.getElementById("AnswerExplain"))
- o.style.visibility = "";
- if (o = document.getElementById("AnswerExplain")) {
- o.style.display = "none";
- setTimeout('document.getElementById("AnswerExplain").style.display = "block";', 200);
- }
- }
-}*/
-
-
-/** FROM INDEX.php **/
-function saveeditPbar(idesc, ndesc) {
- document.getElementById("saveeditPbarI").innerHTML = idesc;
- document.getElementById("saveeditPbarN").innerHTML = ndesc;
-}
-
-
-function saveWindows() {
- var key = '';
- var value = '';
-
-
- if ($('#idFrameE').is(':visible') && $('#EDITWINDOW').is(':visible')) {
- key = 'edit_window';
- value = $('#idFrameE').outerWidth() / $('#EDITWINDOW').innerWidth();
- }
- else {
- key = 'search_window';
- value = $('#idFrameC').outerWidth() / bodySize.x;
- }
- userModule.setPref(key, value);
-}
-
-function gotopage(pag) {
- $('#searchForm input[name="sel"]').val(p4.Results.Selection.serialize());
- $('#formAnswerPage').val(pag);
- $('#searchForm').submit();
-}
-
-
-//clear search
-$(document).ready(function () {
-
- $('#thesaurus_tab .input-medium').on('keyup', function(){
- if($('#thesaurus_tab .input-medium').val() != ''){
- $('#thesaurus_tab .th_clear').show();
- }else{
- $('#thesaurus_tab .th_clear').hide();
- }
- });
-
- $('.th_clear').on('click', function(){
- $('#thesaurus_tab .input-medium').val('');
- $('#thesaurus_tab .gform').submit();
- $('#thesaurus_tab .th_clear').hide();
- });
-
- $('.treeview>li.expandable>.hitarea').on('click', function(){
- if($(this).css('background-position') == '99% 22px'){
- $(this).css('background-position', '99% -28px');
- $(this).addClass('active');
- }else{
- $(this).css('background-position', '99% 22px');
- $(this).removeClass('active');
- }
- });
-
-});
diff --git a/resources/www/prod/js/jquery.p4.preview.js b/resources/www/prod/js/jquery.p4.preview.js
deleted file mode 100644
index d09db584a1..0000000000
--- a/resources/www/prod/js/jquery.p4.preview.js
+++ /dev/null
@@ -1,527 +0,0 @@
-var prevAjax, prevAjaxrunning;
-prevAjaxrunning = false;
-p4.slideShow = false;
-
-$(document).ready(function () {
- $('#PREVIEWIMGDESC').tabs();
-});
-
-
-function getNewVideoToken(lst, obj) {
- $.ajax({
- type: "POST",
- url: "../prod/records/renew-url/",
- dataType: 'json',
- data: {
- lst: lst
- },
- success: function (data) {
- if (!data[lst])
- return;
- obj.unload();
- obj.setClip({url: data[lst]});
- obj.play();
- return;
- }
-
- });
-}
-
-/**
- *
- * @param env
- * @param pos - relative position in current page
- * @param contId
- * @param reload
- */
-function openPreview(env, pos, contId, reload) {
-
- if (contId == undefined)
- contId = '';
- var roll = 0;
- var justOpen = false;
-
- if (!p4.preview.open) {
- showOverlay();
-
- $('#PREVIEWIMGCONT').disableSelection();
-
- justOpen = true;
-
- if (!( navigator.userAgent.match(/msie/i))) {
- $('#PREVIEWBOX').css({
- 'display': 'block',
- 'opacity': 0
- }).fadeTo(500, 1);
- } else {
- $('#PREVIEWBOX').css({
- 'display': 'block',
- 'opacity': 1
- });
- }
- p4.preview.open = true;
- p4.preview.nCurrent = 5;
- $('#PREVIEWCURRENT, #PREVIEWOTHERSINNER, #SPANTITLE').empty();
- resizePreview();
- if (env == 'BASK')
- roll = 1;
-
- }
-
- if (reload === true)
- roll = 1;
-
-
- $('#tooltip').css({
- 'display': 'none'
- });
-
- $('#PREVIEWIMGCONT').empty();
-
- var options_serial = p4.tot_options;
- var query = p4.tot_query;
- var navigation = p4.navigation;
-
- // keep relative position for answer train:
- var relativePos = pos;
- // update real absolute position with pagination:
- var absolutePos = parseInt(navigation.perPage,10) * (parseInt(navigation.page, 10) - 1) + parseInt(pos,10);
-
- // if comes from story, work with relative positionning
- if (env == 'REG') {
- // @TODO - if event comes from workzone (basket|story),
- // we can use the relative position in order to display the doubleclicked records
- // except we can't know the original event in this implementation
- absolutePos = 0;
- }
-
- prevAjax = $.ajax({
- type: "POST",
- url: "../prod/records/",
- dataType: 'json',
- data: {
- env: env,
- pos: absolutePos,
- cont: contId,
- roll: roll,
- options_serial: options_serial,
- query: query
- },
- beforeSend: function () {
- if (prevAjaxrunning)
- prevAjax.abort();
- if (env == 'RESULT')
- $('#current_result_n').empty().append(parseInt(pos) + 1);
- prevAjaxrunning = true;
- $('#PREVIEWIMGDESC, #PREVIEWOTHERS').addClass('loading');
- },
- error: function (data) {
- prevAjaxrunning = false;
- $('#PREVIEWIMGDESC, #PREVIEWOTHERS').removeClass('loading');
- posAsk = null;
- },
- timeout: function () {
- prevAjaxrunning = false;
- $('#PREVIEWIMGDESC, #PREVIEWOTHERS').removeClass('loading');
- posAsk = null;
- },
- success: function (data) {
- cancelPreview();
- prevAjaxrunning = false;
- posAsk = null;
-
- if (data.error) {
- $('#PREVIEWIMGDESC, #PREVIEWOTHERS').removeClass('loading');
- alert(data.error);
- if (justOpen)
- closePreview();
- return;
- }
- posAsk = data.pos - 1;
-
- $('#PREVIEWIMGCONT').empty().append(data.html_preview);
- $('#PREVIEWIMGCONT .thumb_wrapper')
- .width('100%').height('100%').image_enhance({zoomable: true});
-
- $('#PREVIEWIMGDESCINNER').empty().append(data.desc);
- $('#HISTORICOPS').empty().append(data.history);
- $('#popularity').empty().append(data.popularity);
-
- if ($('#popularity .bitly_link').length > 0) {
-
- BitlyCB.statsResponse = function (data) {
- var result = data.results;
- if ($('#popularity .bitly_link_' + result.userHash).length > 0) {
- $('#popularity .bitly_link_' + result.userHash).append(' (' + result.clicks + ' clicks)');
- }
- };
- BitlyClient.stats($('#popularity .bitly_link').html(), 'BitlyCB.statsResponse');
- }
-
- p4.preview.current = {};
- p4.preview.current.width = parseInt($('#PREVIEWIMGCONT input[name=width]').val());
- p4.preview.current.height = parseInt($('#PREVIEWIMGCONT input[name=height]').val());
- p4.preview.current.tot = data.tot;
- p4.preview.current.pos = relativePos;
-
- if ($('#PREVIEWBOX img.record.zoomable').length > 0) {
- $('#PREVIEWBOX img.record.zoomable').draggable();
- }
-
- $('#SPANTITLE').empty().append(data.title);
- $("#PREVIEWTITLE_COLLLOGO").empty().append(data.collection_logo);
- $("#PREVIEWTITLE_COLLNAME").empty().append(data.collection_name);
-
- setPreview();
-
- if (env != 'RESULT') {
- if (justOpen || reload) {
- setCurrent(data.current);
- }
- viewCurrent($('#PREVIEWCURRENT li.selected'));
- }
- else {
- if (!justOpen) {
- $('#PREVIEWCURRENT li.selected').removeClass('selected');
- $('#PREVIEWCURRENTCONT li.current' + absolutePos).addClass('selected');
- }
- if (justOpen || ($('#PREVIEWCURRENTCONT li.current' + absolutePos).length === 0) || ($('#PREVIEWCURRENTCONT li:last')[0] == $('#PREVIEWCURRENTCONT li.selected')[0]) || ($('#PREVIEWCURRENTCONT li:first')[0] == $('#PREVIEWCURRENTCONT li.selected')[0])) {
- getAnswerTrain(pos, data.tools, query, options_serial);
- }
-
- viewCurrent($('#PREVIEWCURRENT li.selected'));
- }
- if (env == 'REG' && $('#PREVIEWCURRENT').html() === '') {
- getRegTrain(contId, pos, data.tools);
- }
- setOthers(data.others);
- setTools(data.tools);
- $('#tooltip').css({
- 'display': 'none'
- });
- $('#PREVIEWIMGDESC, #PREVIEWOTHERS').removeClass('loading');
- if (!justOpen || (p4.preview.mode != env))
- resizePreview();
-
- p4.preview.mode = env;
- $('#EDIT_query').focus();
-
- $('#PREVIEWOTHERSINNER .otherBaskToolTip').tooltip();
-
- return;
- }
-
- });
-
-}
-
-function zoomPreview(bool) {
-
- var el = $('#PREVIEWIMGCONT img.record');
-
- if (el.length === 0)
- return;
-
- var t1 = parseInt(el.css('top'));
- var l1 = parseInt(el.css('left'));
- var w1 = el.width();
- var h1 = el.height();
-
- var w2, t2;
-
- if (bool) {
- if (w1 * 1.08 < 32767)
- w2 = w1 * 1.08;
- else
- w2 = w1;
- }
- else {
- if (w1 / 1.08 > 20)
- w2 = w1 / 1.08;
- else
- w2 = w1;
- }
-
- var ratio = p4.preview.current.width / p4.preview.current.height;
- h2 = Math.round(w2 / ratio);
- w2 = Math.round(w2);
-
- t2 = Math.round(t1 - (h2 - h1) / 2) + 'px';
- var l2 = Math.round(l1 - (w2 - w1) / 2) + 'px';
-
- var wPreview = $('#PREVIEWIMGCONT').width() / 2;
- var hPreview = $('#PREVIEWIMGCONT').height() / 2;
-
- var nt = Math.round((h2 / h1) * (t1 - hPreview) + hPreview);
- var nl = Math.round(((w2 / w1) * (l1 - wPreview)) + wPreview);
-
- el.css({
- left: nl,
- top: nt
- }).width(w2).height(h2);
-}
-
-function getAnswerTrain(pos, tools, query, options_serial) {
- // keep relative position for answer train:
- var relativePos = pos;
- // update real absolute position with pagination:
- var absolutePos = parseInt(p4.navigation.perPage,10) * (parseInt(p4.navigation.page, 10) - 1) + parseInt(pos,10);
-
- $('#PREVIEWCURRENTCONT').fadeOut('fast');
- $.ajax({
- type: "POST",
- url: "/prod/query/answer-train/",
- dataType: 'json',
- data: {
- pos: absolutePos,
- options_serial: options_serial,
- query: query
- },
- success: function (data) {
- setCurrent(data.current);
- viewCurrent($('#PREVIEWCURRENT li.selected'));
- setTools(tools);
- return;
- }
- });
-}
-
-
-function getRegTrain(contId, pos, tools) {
- $.ajax({
- type: "POST",
- url: "/prod/query/reg-train/",
- dataType: 'json',
- data: {
- cont: contId,
- pos: pos
- },
- success: function (data) {
- setCurrent(data.current);
- viewCurrent($('#PREVIEWCURRENT li.selected'));
- if (typeof(tools) != 'undefined')
- setTools(tools);
- return;
- }
- });
-}
-
-function bounce(sbid, term, field) {
- doThesSearch('T', sbid, term, field);
- closePreview();
-}
-
-function setTitle(title) {
- $('#SPANTITLE').empty().append(title);
-}
-
-function cancelPreview() {
- $('#PREVIEWIMGDESCINNER').empty();
- $('#PREVIEWIMGCONT').empty();
- p4.preview.current = false;
-}
-
-
-function startSlide() {
- if (!p4.slideShow) {
- p4.slideShow = true;
- }
- if (p4.slideShowCancel) {
- p4.slideShowCancel = false;
- p4.slideShow = false;
- $('#start_slide').show();
- $('#stop_slide').hide();
- }
- if (!p4.preview.open) {
- p4.slideShowCancel = false;
- p4.slideShow = false;
- $('#start_slide').show();
- $('#stop_slide').hide();
- }
- if (p4.slideShow) {
- $('#start_slide').hide();
- $('#stop_slide').show();
- getNext();
- setTimeout("startSlide()", 3000);
- }
-}
-
-function stopSlide() {
- p4.slideShowCancel = true;
- $('#start_slide').show();
- $('#stop_slide').hide();
-}
-
-//var posAsk = null;
-
-function getNext() {
- if (p4.preview.mode == 'REG' && parseInt(p4.preview.current.pos) === 0)
- $('#PREVIEWCURRENTCONT li img:first').trigger("click");
- else {
- if (p4.preview.mode == 'RESULT') {
- posAsk = parseInt(p4.preview.current.pos) + 1;
- posAsk = (posAsk >= parseInt(p4.tot) || isNaN(posAsk)) ? 0 : posAsk;
- openPreview('RESULT', posAsk, '', false);
- }
- else {
- if (!$('#PREVIEWCURRENT li.selected').is(':last-child'))
- $('#PREVIEWCURRENT li.selected').next().children('img').trigger("click");
- else
- $('#PREVIEWCURRENT li:first-child').children('img').trigger("click");
- }
-
- }
-}
-function reloadPreview() {
- $('#PREVIEWCURRENT li.selected img').trigger("click");
-}
-
-function getPrevious() {
- if (p4.preview.mode == 'RESULT') {
- posAsk = parseInt(p4.preview.current.pos) - 1;
- posAsk = (posAsk < 0) ? ((parseInt(p4.tot) - 1)) : posAsk;
- openPreview('RESULT', posAsk, '', false);
- }
- else {
- if (!$('#PREVIEWCURRENT li.selected').is(':first-child'))
- $('#PREVIEWCURRENT li.selected').prev().children('img').trigger("click");
- else
- $('#PREVIEWCURRENT li:last-child').children('img').trigger("click");
- }
-}
-
-function setOthers(others) {
-
- $('#PREVIEWOTHERSINNER').empty();
- if (others !== '') {
- $('#PREVIEWOTHERSINNER').append(others);
-
- $('#PREVIEWOTHERS table.otherRegToolTip').tooltip();
- }
-}
-
-function setTools(tools) {
- $('#PREVIEWTOOL').empty().append(tools);
- if (!p4.slideShowCancel && p4.slideShow) {
- $('#start_slide').hide();
- $('#stop_slide').show();
- } else {
- $('#start_slide').show();
- $('#stop_slide').hide();
- }
-}
-
-function setCurrent(current) {
- if (current !== '') {
- var el = $('#PREVIEWCURRENT');
- el.removeClass('loading').empty().append(current);
-
- $('ul', el).width($('li', el).length * 80);
- $('img.prevRegToolTip', el).tooltip();
- $.each($('img.openPreview'), function (i, el) {
- var jsopt = $(el).attr('jsargs').split('|');
- $(el).removeAttr('jsargs');
- $(el).removeClass('openPreview');
- $(el).bind('click', function () {
- viewCurrent($(this).parent());
- // convert abssolute to relative position
- var absolutePos = jsopt[1];
- var relativePos = parseInt(absolutePos, 10) - parseInt(p4.navigation.perPage, 10) * (parseInt(p4.navigation.page, 10) - 1);
- // keep relative position for answer train:
- openPreview(jsopt[0], relativePos, jsopt[2],false);
- });
- });
- }
-}
-
-function viewCurrent(el) {
- if (el.length === 0) {
- return;
- }
- $('#PREVIEWCURRENT li.selected').removeClass('selected');
- el.addClass('selected');
- $('#PREVIEWCURRENTCONT').animate({'scrollLeft': ($('#PREVIEWCURRENT li.selected').position().left + $('#PREVIEWCURRENT li.selected').width() / 2 - ($('#PREVIEWCURRENTCONT').width() / 2 ))});
- return;
-}
-
-function setPreview() {
- if (!p4.preview.current)
- return;
-
- var zoomable = $('img.record.zoomable');
- if (zoomable.length > 0 && zoomable.hasClass('zoomed'))
- return;
-
- var h = parseInt(p4.preview.current.height);
- var w = parseInt(p4.preview.current.width);
-// if(p4.preview.current.type == 'video')
-// {
-// var h = parseInt(p4.preview.current.flashcontent.height);
-// var w = parseInt(p4.preview.current.flashcontent.width);
-// }
- var t = 20;
- var de = 0;
-
- var margX = 0;
- var margY = 0;
-
- if ($('#PREVIEWIMGCONT .record_audio').length > 0) {
- margY = 100;
- de = 60;
- }
-
-
-// if(p4.preview.current.type != 'flash')
-// {
- var ratioP = w / h;
- var ratioD = parseInt(p4.preview.width) / parseInt(p4.preview.height);
-
- if (ratioD > ratioP) {
- //je regle la hauteur d'abord
- if ((parseInt(h) + margY) > parseInt(p4.preview.height)) {
- h = Math.round(parseInt(p4.preview.height) - margY);
- w = Math.round(h * ratioP);
- }
- }
- else {
- if ((parseInt(w) + margX) > parseInt(p4.preview.width)) {
- w = Math.round(parseInt(p4.preview.width) - margX);
- h = Math.round(w / ratioP);
- }
- }
-// }
-// else
-// {
-
-// h = Math.round(parseInt(p4.preview.height) - margY);
-// w = Math.round(parseInt(p4.preview.width) - margX);
-// }
- t = Math.round((parseInt(p4.preview.height) - h - de) / 2);
- var l = Math.round((parseInt(p4.preview.width) - w) / 2);
- $('#PREVIEWIMGCONT .record').css({
- width: w,
- height: h,
- top: t,
- left: l
- }).attr('width', w).attr('height', h);
-}
-
-function classicMode() {
- $('#PREVIEWCURRENTCONT').animate({'scrollLeft': ($('#PREVIEWCURRENT li.selected').position().left - 160)});
- p4.currentViewMode = 'classic';
-}
-
-function closePreview() {
- p4.preview.open = false;
- hideOverlay();
-
- $('#PREVIEWBOX').fadeTo(500, 0);
- $('#PREVIEWBOX').queue(function () {
- $(this).css({
- 'display': 'none'
- });
- cancelPreview();
- $(this).dequeue();
- });
-
-}
diff --git a/resources/www/prod/js/prod.js b/resources/www/prod/js/prod.js
new file mode 100644
index 0000000000..df5a507e13
--- /dev/null
+++ b/resources/www/prod/js/prod.js
@@ -0,0 +1,1168 @@
+var p4 = p4 || {};
+var baskAjax, baskAjaxrunning;
+baskAjaxrunning = false;
+var answAjax, answAjaxrunning;
+answAjaxrunning = false;
+var searchAjax, searchAjaxRunning;
+searchAjaxRunning = false;
+var bodySize = {
+ x: 0,
+ y: 0
+};
+
+var prodModule = (function (p4, humane) {
+
+ document.getElementById('loader_bar').style.width = '30%';
+ $(document).ready(function () {
+ humane.info = humane.spawn({addnCls: 'humane-libnotify-info', timeout: 1000});
+ humane.error = humane.spawn({addnCls: 'humane-libnotify-error', timeout: 1000});
+ humane.forceNew = true;
+ cguModule.activateCgus();
+ $('body').on('click', 'a.dialog', function (event) {
+ var $this = $(this), size = 'Medium';
+
+ if ($this.hasClass('small-dialog')) {
+ size = 'Small';
+ } else if ($this.hasClass('full-dialog')) {
+ size = 'Full';
+ }
+
+ var options = {
+ size: size,
+ loading: true,
+ title: $this.attr('title'),
+ closeOnEscape: true
+ };
+
+ $dialog = p4.Dialog.Create(options);
+
+ $.ajax({
+ type: "GET",
+ url: $this.attr('href'),
+ dataType: 'html',
+ success: function (data) {
+ $dialog.setContent(data);
+ return;
+ }
+ });
+
+ return false;
+ });
+
+ $('input[name=search_type]').bind('click', function () {
+ console.log('search bind')
+ var $this = $(this);
+ var $record_types = $('#recordtype_sel');
+
+ console.log($this.hasClass('mode_type_reg'), $record_types)
+ if ($this.hasClass('mode_type_reg')) {
+ $record_types.css("visibility", "hidden"); // better than hide because does not change layout
+ $record_types.prop("selectedIndex", 0);
+ } else {
+ $record_types.css("visibility", "visible");
+ }
+ });
+
+ $('.adv_search_button').on('click', function () {
+ var searchForm = $('#searchForm');
+ var parent = searchForm.parent();
+
+ var options = {
+ size: (bodySize.x - 120)+'x'+(bodySize.y - 120),
+ loading: false,
+ closeCallback: function (dialog) {
+
+ var datas = dialog.find('form.phrasea_query').appendTo(parent);//.clone();
+
+ $('.adv_trigger', searchForm).show();
+ $('.adv_options', searchForm).hide();
+ }
+ };
+
+ $dialog = p4.Dialog.Create(options);
+
+ searchForm.appendTo($dialog.getDomElement());
+
+ $dialog.getDomElement().find('.adv_options').show();
+ $dialog.getDomElement().find('.adv_trigger').hide();
+
+ $dialog.getDomElement().find('form').bind('submit.conbo', function () {
+ $(this).unbind('submit.conbo');
+ $dialog.Close();
+ return false;
+ });
+
+
+ return false;
+ });
+
+ $(document).bind('contextmenu', function (event) {
+ var targ;
+ if (event.target)
+ targ = event.target;
+ else if (event.srcElement)
+ targ = event.srcElement;
+ if (targ.nodeType === 3)// safari bug
+ targ = targ.parentNode;
+
+ var gogo = true;
+ var targ_name = targ.nodeName ? targ.nodeName.toLowerCase() : false;
+
+ if (targ_name !== 'input' && targ_name.toLowerCase() !== 'textarea') {
+ gogo = false;
+ }
+ if (targ_name === 'input') {
+ if ($(targ).is(':checkbox'))
+ gogo = false;
+ }
+
+ return gogo;
+ });
+
+ $('.basket_refresher').on('click', function () {
+ return p4.WorkZone.refresh('current');
+ return false;
+ });
+
+ $('#loader_bar').stop().animate({
+ width: '70%'
+ }, 450);
+ p4.preview = {
+ open: false,
+ current: false
+ };
+ p4.currentViewMode = 'classic';
+ p4.nbNoview = 0;
+ p4.sel = [];
+ p4.baskSel = [];
+ p4.edit = {};
+ p4.thesau = {
+ tabs: null
+ };
+ p4.active_zone = false;
+ p4.next_bask_scroll = false;
+
+
+ $('#backcolorpickerHolder').ColorPicker({
+ flat: true,
+ color: '404040',
+ livePreview: false,
+ eventName: 'mouseover',
+ onSubmit: function (hsb, hex, rgb, el) {
+ var back_hex = '';
+ var unactive = '';
+
+
+ if (hsb.b >= 50) {
+ back_hex = '000000';
+
+ var sim_b = 0.1 * hsb.b;
+ }
+ else {
+ back_hex = 'FFFFFF';
+
+ var sim_b = 100 - 0.1 * (100 - hsb.b);
+ }
+
+ var sim_b = 0.1 * hsb.b;
+
+ var sim_rgb = utilsModule.hsl2rgb(hsb.h, hsb.s, sim_b);
+ var sim_hex = utilsModule.RGBtoHex(sim_rgb.r, sim_rgb.g, sim_rgb.b);
+
+ userModule.setPref('background-selection', hex);
+ userModule.setPref('background-selection-disabled', sim_hex);
+ userModule.setPref('fontcolor-selection', back_hex);
+
+ $('style[title=color_selection]').empty();
+
+ var datas = '.diapo.selected,#reorder_box .diapo.selected, #EDIT_ALL .diapo.selected, .list.selected, .list.selected .diapo' +
+ '{' +
+ ' COLOR: #' + back_hex + ';' +
+ ' BACKGROUND-COLOR: #' + hex + ';' +
+ '}';
+ $('style[title=color_selection]').empty().text(datas);
+ }
+ });
+ $('#backcolorpickerHolder').find('.colorpicker_submit').append($('#backcolorpickerHolder .submiter')).bind('click', function () {
+ $(this).highlight('#CCCCCC');
+ });
+
+ $('#search_submit').on('mousedown', function (event) {
+ return false;
+ });
+
+ $('#history-queries ul li').on('mouseover',function () {
+ $(this).addClass('hover');
+ }).on('mouseout', function () {
+ $(this).removeClass('hover');
+ });
+
+ startThesaurus();
+ searchModule.checkFilters();
+
+ _activeZoning();
+
+ $('.shortcuts-trigger').bind('click', function () {
+ _triggerShortcuts();
+ });
+
+ $('#idFrameC').resizable({
+ handles: 'e',
+ resize: function () {
+ answerSizer();
+ linearizeUi();
+ },
+ stop: function () {
+
+ var el = $('.SSTT.active').next().find('div:first');
+ var w = el.find('div.chim-wrapper:first').outerWidth();
+ var iw = el.innerWidth();
+ var diff = $('#idFrameC').width() - el.outerWidth();
+ var n = Math.floor(iw / w);
+
+ $('#idFrameC').height('auto');
+
+ var nwidth = (n) * w + diff + n;
+ if (isNaN(nwidth)) {
+ _saveWindows();
+ return;
+ }
+ if (nwidth < 265)
+ nwidth = 265;
+ if (el.find('div.chim-wrapper:first').hasClass('valid') && nwidth < 410)
+ nwidth = 410;
+
+
+ $('#idFrameC').stop().animate({
+ width: nwidth
+ },
+ 300,
+ 'linear',
+ function () {
+ answerSizer();
+ linearizeUi();
+ _saveWindows();
+ });
+ }
+ });
+
+ $('#idFrameC .ui-tabs-nav li').on('click', function (event) {
+ if($('#idFrameC').attr('data-status') == 'closed'){
+ $('#idFrameC').width(300);
+ $('#rightFrame').css('left', 300);
+ $('#rightFrame').width($(window).width()-300);
+ $('#baskets, #proposals, #thesaurus_tab').hide();
+ $('.ui-resizable-handle, #basket_menu_trigger').show();
+ var IDname = $(this).attr('aria-controls');
+ $('#'+IDname).show();
+ }
+
+ $('#idFrameC').attr('data-status', 'open');
+ $('.WZbasketTab').css('background-position', '9px 21px');
+ $('#idFrameC').removeClass('closed');
+ });
+
+ var previousTab = "";
+
+ $('#idFrameC #retractableButton').bind('click', function (event) {
+
+ if($('#idFrameC').attr('data-status') != 'closed'){
+ $(this).find('i').removeClass('icon-double-angle-left').addClass('icon-double-angle-right')
+ $('#idFrameC').width(80);
+ $('#rightFrame').css('left', 80);
+ $('#rightFrame').width($(window).width()-80);
+ $('#idFrameC').attr('data-status', 'closed');
+ $('#baskets, #proposals, #thesaurus_tab, .ui-resizable-handle, #basket_menu_trigger').hide();
+ $('#idFrameC .ui-tabs-nav li').removeClass('ui-state-active');
+ $('.WZbasketTab').css('background-position', '15px 16px');
+ $('#idFrameC').addClass('closed');
+ previousTab = $('#idFrameC .icon-menu').find('li.ui-tabs-active');
+ }else{
+ $(this).find('i').removeClass('icon-double-angle-right').addClass('icon-double-angle-left')
+ $('#idFrameC').width(300);
+ $('#rightFrame').css('left', 300);
+ $('#rightFrame').width($(window).width()-300);
+ $('#idFrameC').attr('data-status', 'open');
+ $('.ui-resizable-handle, #basket_menu_trigger').show();
+ $('.WZbasketTab').css('background-position', '9px 16px');
+ $('#idFrameC').removeClass('closed');
+ $('#idFrameC .icon-menu li').last().find('a').trigger('click');
+ $('#idFrameC .icon-menu li').first().find('a').trigger('click');
+ $(previousTab).find('a').trigger('click');
+ }
+
+ event.stopImmediatePropagation();
+ //p4.WorkZone.close();
+ return false;
+ });
+
+ $('#look_box .tabs').tabs();
+
+ _resizeAll();
+
+ $(window).bind('resize', function () {
+ _resizeAll();
+ });
+ $('body').append('');
+
+ $('body').append('');
+
+ $('#basket_menu_trigger').contextMenu('#basket_menu', {
+ openEvt: 'click',
+ dropDown: true,
+ theme: 'vista',
+ showTransition: 'slideDown',
+ hideTransition: 'hide',
+ shadow: false
+ });
+
+ $('#basket_menu_trigger').trigger("click");
+ $('#basket_menu_trigger').trigger("click");
+
+ $('.datepicker').datepicker({
+ changeYear: true,
+ changeMonth: true,
+ dateFormat: 'yy/mm/dd'
+ });
+
+ /*$.ajaxSetup({
+
+ error: function (jqXHR, textStatus, errorThrown) {
+ //Request is aborted
+ if (errorThrown === 'abort') {
+ return false;
+ } else {
+ showModal('error', {
+ title: language.errorAjaxRequest + ' ' + jqXHR.responseText
+ });
+ }
+ },
+ timeout: function () {
+ showModal('timeout', {
+ title: 'Server not responding'
+ });
+ }
+ });*/
+
+ $('.tools .answer_selector').bind('click',function () {
+ _answerSelector($(this));
+
+ }).bind('mouseover',function (event) {
+ if (utilsModule.is_ctrl_key(event)) {
+ $(this).addClass('add_selector');
+ }
+ else {
+ $(this).removeClass('add_selector');
+ }
+ }).bind('mouseout', function () {
+ $(this).removeClass('add_selector');
+ });
+
+ // getLanguage();
+
+ _initAnswerForm();
+
+ preferencesModule.initLook();
+
+ // setTimeout("pollNotifications();", 10000);
+
+ $(this).bind('keydown', function (event) {
+ var cancelKey = false;
+ var shortCut = false;
+
+ if ($('#MODALDL').is(':visible')) {
+ switch (event.keyCode) {
+ case 27:
+ hideDwnl();
+ break;
+ }
+ }
+ else {
+ if ($('#EDITWINDOW').is(':visible')) {
+
+ switch (event.keyCode) {
+ case 9: // tab ou shift-tab
+ recordEditorModule.edit_chgFld(event, utilsModule.is_shift_key(event) ? -1 : 1);
+ cancelKey = shortCut = true;
+ break;
+ case 27:
+ recordEditorModule.edit_cancelMultiDesc(event);
+ shortCut = true;
+ break;
+
+ case 33: // pg up
+ if (!p4.edit.textareaIsDirty || recordEditorModule.edit_validField(event, "ask_ok"))
+ recordEditorModule.skipImage(event, 1);
+ cancelKey = true;
+ break;
+ case 34: // pg dn
+ if (!p4.edit.textareaIsDirty || recordEditorModule.edit_validField(event, "ask_ok"))
+ recordEditorModule.skipImage(event, -1);
+ cancelKey = true;
+ break;
+ }
+
+ }
+ else {
+ if (p4.preview.open) {
+ if (($('#dialog_dwnl:visible').length === 0 && $('#DIALOG1').length === 0 && $('#DIALOG2').length === 0)) {
+ switch (event.keyCode) {
+ case 39:
+ recordPreviewModule.getNext();
+ cancelKey = shortCut = true;
+ break;
+ case 37:
+ recordPreviewModule.getPrevious();
+ cancelKey = shortCut = true;
+ break;
+ case 27://escape
+ recordPreviewModule.closePreview();
+ break;
+ case 32:
+ if (p4.slideShow)
+ recordPreviewModule.stopSlide();
+ else
+ recordPreviewModule.startSlide();
+ cancelKey = shortCut = true;
+ break;
+ }
+ }
+ }
+ else {
+ if ($('#EDIT_query').hasClass('focused'))
+ return true;
+
+ if ($('.overlay').is(':visible'))
+ return true;
+
+ if ($('.ui-widget-overlay').is(':visible'))
+ return true;
+
+ switch (p4.active_zone) {
+ case 'rightFrame':
+ switch (event.keyCode) {
+ case 65: // a
+ if (utilsModule.is_ctrl_key(event)) {
+ $('.tools .answer_selector.all_selector').trigger('click');
+ cancelKey = shortCut = true;
+ }
+ break;
+ case 80://P
+ if (utilsModule.is_ctrl_key(event)) {
+ _onOpenPrintModal("lst=" + p4.Results.Selection.serialize());
+ cancelKey = shortCut = true;
+ }
+ break;
+ case 69://e
+ if (utilsModule.is_ctrl_key(event)) {
+ openRecordEditor('IMGT', p4.Results.Selection.serialize());
+ cancelKey = shortCut = true;
+ }
+ break;
+ case 40: // down arrow
+ $('#answers').scrollTop($('#answers').scrollTop() + 30);
+ cancelKey = shortCut = true;
+ break;
+ case 38: // down arrow
+ $('#answers').scrollTop($('#answers').scrollTop() - 30);
+ cancelKey = shortCut = true;
+ break;
+ case 37://previous page
+ $('#PREV_PAGE').trigger('click');
+ shortCut = true;
+ break;
+ case 39://previous page
+ $('#NEXT_PAGE').trigger('click');
+ shortCut = true;
+ break;
+ case 9://tab
+ if (!utilsModule.is_ctrl_key(event) && !$('.ui-widget-overlay').is(':visible') && !$('.overlay_box').is(':visible')) {
+ document.getElementById('EDIT_query').focus();
+ cancelKey = shortCut = true;
+ }
+ break;
+ }
+ break;
+
+
+ case 'idFrameC':
+ switch (event.keyCode) {
+ case 65: // a
+ if (utilsModule.is_ctrl_key(event)) {
+ p4.WorkZone.Selection.selectAll();
+ cancelKey = shortCut = true;
+ }
+ break;
+ case 80://P
+ if (utilsModule.is_ctrl_key(event)) {
+ _onOpenPrintModal("lst=" + p4.WorkZone.Selection.serialize());
+ cancelKey = shortCut = true;
+ }
+ break;
+ case 69://e
+ if (utilsModule.is_ctrl_key(event)) {
+ openRecordEditor('IMGT', p4.WorkZone.Selection.serialize());
+ cancelKey = shortCut = true;
+ }
+ break;
+ // case 46://del
+ // _deleteRecords(p4.Results.Selection.serialize());
+ // cancelKey = true;
+ // break;
+ case 40: // down arrow
+ $('#baskets div.bloc').scrollTop($('#baskets div.bloc').scrollTop() + 30);
+ cancelKey = shortCut = true;
+ break;
+ case 38: // down arrow
+ $('#baskets div.bloc').scrollTop($('#baskets div.bloc').scrollTop() - 30);
+ cancelKey = shortCut = true;
+ break;
+ // case 37://previous page
+ // $('#PREV_PAGE').trigger('click');
+ // break;
+ // case 39://previous page
+ // $('#NEXT_PAGE').trigger('click');
+ // break;
+ case 9://tab
+ if (!utilsModule.is_ctrl_key(event) && !$('.ui-widget-overlay').is(':visible') && !$('.overlay_box').is(':visible')) {
+ document.getElementById('EDIT_query').focus();
+ cancelKey = shortCut = true;
+ }
+ break;
+ }
+ break;
+
+
+ case 'mainMenu':
+ break;
+
+
+ case 'headBlock':
+ break;
+
+ default:
+ break;
+
+ }
+ }
+ }
+ }
+
+ if (!$('#EDIT_query').hasClass('focused') && event.keyCode !== 17) {
+
+ if ($('#keyboard-dialog.auto').length > 0 && shortCut) {
+ _triggerShortcuts();
+ }
+ }
+ if (cancelKey) {
+ event.cancelBubble = true;
+ if (event.stopPropagation)
+ event.stopPropagation();
+ return(false);
+ }
+ return(true);
+ });
+
+
+ $('#EDIT_query').bind('focus',function () {
+ $(this).addClass('focused');
+ }).bind('blur', function () {
+ $(this).removeClass('focused');
+ });
+
+ $('.basketTips').tooltip({
+ delay: 200
+ });
+
+ $('#idFrameC .tabs').tabs({
+ activate: function (event, ui) {
+ if (ui.newTab.context.hash == "#thesaurus_tab") {
+ thesau_show();
+ }
+ p4.WorkZone.open();
+ }
+ });
+
+ $('#PREVIEWBOX .gui_vsplitter', p4.edit.editBox).draggable({
+ axis: 'x',
+ containment: 'parent',
+ drag: function (event, ui) {
+ var x = $(ui.position.left)[0];
+ if (x < 330 || x > (bodySize.x - 400)) {
+ return false;
+ }
+ var v = $(ui.position.left)[0];
+ $("#PREVIEWLEFT").width(v);
+ $("#PREVIEWRIGHT").css("left", $(ui.position.left)[0]);
+ recordPreviewModule.resizePreview();
+ }
+ });
+
+ $('input.input_select_copy').on('focus', function () {
+ $(this).select();
+ });
+ $('input.input_select_copy').on('blur', function () {
+ $(this).deselect();
+ });
+ $('input.input_select_copy').on('click', function () {
+ $(this).select();
+ });
+
+ $('#loader_bar').stop().animate({
+ width: '100%'
+ }, 450, function () {
+ $('#loader').parent().fadeOut('slow', function () {
+ $(this).remove();
+ });
+ });
+
+ });
+
+ function _resizeAll() {
+ var body = $('#mainContainer');
+ bodySize.y = body.height();
+ bodySize.x = body.width();
+
+ $('.overlay').height(bodySize.y).width(bodySize.x);
+
+ var headBlockH = $('#headBlock').outerHeight();
+ var bodyY = bodySize.y - headBlockH - 2;
+ var bodyW = bodySize.x - 2;
+ //$('#desktop').height(bodyY).width(bodyW);
+
+ if (p4.preview.open)
+ recordPreviewModule.resizePreview();
+
+ if ($('#idFrameC').data('ui-resizable')) {
+ $('#idFrameC').resizable('option', 'maxWidth', (480));
+ $('#idFrameC').resizable('option', 'minWidth', 300);
+ }
+
+ answerSizer();
+ linearizeUi();
+
+
+ }
+ function answerSizer() {
+ var el = $('#idFrameC').outerWidth();
+ if (!$.support.cssFloat) {
+ // $('#idFrameC .insidebloc').width(el - 56);
+ }
+ var widthA = Math.round(bodySize.x - el - 10);
+ $('#rightFrame').width(widthA);
+ $('#rightFrame').css('left', $('#idFrameC').width());
+
+ }
+ function linearizeUi() {
+ var list = $('#answers .list');
+ if (list.length > 0) {
+ var fllWidth = $('#answers').innerWidth();
+ fllWidth -= 16;
+
+ var stdWidth = 460;
+ var diff = 28;
+ var n = Math.round(fllWidth / (stdWidth));
+ var w = Math.floor(fllWidth / n) - diff;
+ if (w < 360 && n > 1)
+ w = Math.floor(fllWidth / (n - 1)) - diff;
+ $('#answers .list').width(w);
+ }
+ else {
+
+ var margin = 0;
+ var el = $('#answers .diapo:first');
+ var brdrWidth = el.css('border-width');
+ var stdWidth = el.outerWidth() + 10;
+ var fllWidth = $('#answers').innerWidth();
+ fllWidth -= 16;
+
+ var n = Math.floor(fllWidth / (stdWidth));
+
+ margin = Math.floor((fllWidth % stdWidth) / (2 * n));
+ $('#answers .diapo').css('margin', '5px ' + (5 + margin) + 'px');
+ }
+
+ }
+
+ function doSpecialSearch(qry, allbase) {
+ if (allbase) {
+ searchModule.toggleDatabase(true);
+ }
+ workzoneFacetsModule.resetSelectedFacets();
+ $('#EDIT_query').val(decodeURIComponent(qry).replace(/\+/g, " "));
+ searchModule.newSearch(qry);
+ }
+
+ function addToBasket(sbas_id, record_id, event, singleSelection) {
+ var singleSelection = singleSelection || false;
+ p4.WorkZone.addElementToBasket(sbas_id, record_id, event, singleSelection);
+ }
+
+ function removeFromBasket(el, confirm) {
+ var confirm = confirm || false;
+ p4.WorkZone.removeElementFromBasket(el, confirm);
+ }
+
+ function openRecordEditor(type, value) {
+
+ $('#idFrameE').empty().addClass('loading');
+ showOverlay(2);
+
+ $('#EDITWINDOW').show();
+
+ var options = {
+ lst: '',
+ ssel: '',
+ act: ''
+ };
+
+ switch (type) {
+ case "IMGT":
+ options.lst = value;
+ break;
+
+ case "SSTT":
+ options.ssel = value;
+ break;
+
+ case "STORY":
+ options.story = value;
+ break;
+ }
+
+ $.ajax({
+ url: "../prod/records/edit/",
+ type: "POST",
+ dataType: "html",
+ data: options,
+ success: function (data) {
+ recordEditorModule.initialize();
+ $('#idFrameE').removeClass('loading').empty().html(data);
+ $('#tooltip').hide();
+ return;
+ },
+ error: function (XHR, textStatus, errorThrown) {
+ if (XHR.status === 0) {
+ return false;
+ }
+ }
+ });
+
+ return;
+ }
+
+ function openShareModal(bas, rec) {
+ var dialog = p4.Dialog.Create({
+ title: language['share']
+ });
+
+ dialog.load("../prod/share/record/" + bas + "/" + rec + "/", "GET");
+ }
+ function openPrintModal(value) {
+ _onOpenPrintModal("lst=" + value);
+ }
+
+ function _onOpenPrintModal(value) {
+ if ($("#DIALOG").data("ui-dialog")) {
+ $("#DIALOG").dialog('destroy');
+ }
+ $('#DIALOG').attr('title', language.print)
+ .empty().addClass('loading')
+ .dialog({
+ resizable: false,
+ closeOnEscape: true,
+ modal: true,
+ width: '800',
+ height: '500',
+ open: function (event, ui) {
+ $(this).dialog("widget").css("z-index", "1999");
+ },
+ close: function (event, ui) {
+ $(this).dialog("widget").css("z-index", "auto");
+ }
+ })
+ .dialog('open');
+
+ $.ajax({
+ type: "POST",
+ url: '../prod/printer/?' + value,
+ dataType: 'html',
+ beforeSend: function () {
+
+ },
+ success: function (data) {
+ $('#DIALOG').removeClass('loading').empty()
+ .append(data);
+ return;
+ }
+ });
+ }
+
+ function openToolModal(datas, activeTab) {
+
+ var dialog = p4.Dialog.Create({
+ size: 'Medium',
+ title: language.toolbox,
+ loading: true
+ });
+
+ $.get("../prod/tools/"
+ , datas
+ , function (data) {
+ dialog.setContent(data);
+ dialog.setOption('contextArgs', datas);
+ var tabs = $('.tabs', dialog.getDomElement()).tabs();
+
+ // activate tab if exists:
+ if( activeTab !== undefined ) {
+ tabs.tabs('option', 'active', activeTab);
+ }
+ return;
+ }
+ );
+ }
+
+ function openDownloadModal(value, key) {
+ if( key !== undefined ) {
+ value = key+'='+value
+ }
+ _onOpenDownloadModal(value);
+ }
+ // @TODO duplicate with external module
+ function _onOpenDownloadModal(datas) {
+ var dialog = p4.Dialog.Create({title: language['export']});
+
+ $.post("../prod/export/multi-export/", datas, function (data) {
+
+ dialog.setContent(data);
+
+ $('.tabs', dialog.getDomElement()).tabs();
+
+ $('.close_button', dialog.getDomElement()).bind('click', function () {
+ dialog.Close();
+ });
+
+ return false;
+ });
+ }
+
+
+ function deleteConfirmation(type, el) {
+ el = $(el);
+ switch (type) {
+
+
+ case "IMGT":
+ case "CHIM":
+
+ var lst = '';
+
+ if (type === 'IMGT')
+ lst = p4.Results.Selection.serialize();
+ if (type === 'CHIM')
+ lst = p4.WorkZone.Selection.serialize();
+
+ _deleteRecords(lst);
+
+ return;
+ break;
+
+
+ case "SSTT":
+
+ var buttons = {};
+ buttons[language.valider] = function (e) {
+ workzoneBasketModule.deleteBasket(el);
+ };
+
+ $('#DIALOG').empty().append(language.confirmDel).attr('title', language.attention).dialog({
+ autoOpen: false,
+ resizable: false,
+ modal: true,
+ draggable: false
+ }).dialog('open').dialog('option', 'buttons', buttons);
+ $('#tooltip').hide();
+ return;
+ break;
+ case "STORY":
+ lst = el.val();
+ _deleteRecords(lst);
+ break;
+
+ }
+ }
+ function _deleteRecords(lst) {
+ if (lst.split(';').length === 0) {
+ alert(language.nodocselected);
+ return false;
+ }
+
+ var $dialog = p4.Dialog.Create({
+ size: 'Small',
+ title: language.deleteRecords
+ });
+
+ $.ajax({
+ type: "POST",
+ url: "../prod/records/delete/what/",
+ dataType: 'html',
+ data: {lst: lst},
+ success: function (data) {
+ $dialog.setContent(data);
+ }
+ });
+
+ return false;
+ }
+
+ function toggleTopic(id) {
+ var o = $('#TOPIC_UL' + id);
+ if ($('#TOPIC_UL' + id).hasClass('closed'))
+ $('#TOPIC_TRI' + id + ' ,#TOPIC_UL' + id).removeClass('closed').addClass('opened');
+ else
+ $('#TOPIC_TRI' + id + ' ,#TOPIC_UL' + id).removeClass('opened').addClass('closed');
+ }
+
+ function _initAnswerForm() {
+ var searchForm = $('#searchForm');
+ $('button[type="submit"]', searchForm).bind('click', function () {
+ workzoneFacetsModule.resetSelectedFacets();
+ searchModule.newSearch($("#EDIT_query").val());
+ return false;
+ });
+
+ searchForm.unbind('submit').bind('submit', function () {
+
+ var $this = $(this),
+ method = $this.attr('method') ? $this.attr('method') : 'POST';
+
+ var data = $this.serializeArray();
+
+ answAjax = $.ajax({
+ type: method,
+ url: $this.attr('action'),
+ data: data,
+ dataType: 'json',
+ beforeSend: function (formData) {
+ if (answAjaxrunning && answAjax.abort)
+ answAjax.abort();
+ searchModule.beforeSearch();
+ },
+ error: function () {
+ answAjaxrunning = false;
+ $('#answers').removeClass('loading');
+ },
+ timeout: function () {
+ answAjaxrunning = false;
+ $('#answers').removeClass('loading');
+ },
+ success: function (datas) {
+
+ // DEBUG QUERY PARSER
+ try {
+ console.info(JSON.parse(datas.parsed_query));
+ }
+ catch(e) {}
+
+ $('#answers').empty().append(datas.results).removeClass('loading');
+
+ $("#answers img.lazyload").lazyload({
+ container: $('#answers')
+ });
+
+ workzoneFacetsModule.loadFacets(datas.facets);
+
+ $('#answers').append('');
+
+ $('#tool_results').empty().append(datas.infos);
+ $('#tool_navigate').empty().append(datas.navigationTpl);
+
+ $.each(p4.Results.Selection.get(), function (i, el) {
+ $('#IMGT_' + el).addClass('selected');
+ });
+
+ p4.tot = datas.total_answers;
+ p4.tot_options = datas.form;
+ p4.tot_query = datas.query;
+ p4.navigation = datas.navigation;
+
+ if (datas.next_page) {
+ $("#NEXT_PAGE, #answersNext").bind('click', function () {
+ searchResultModule.gotopage(datas.next_page);
+ });
+ }
+ else {
+ $("#NEXT_PAGE").unbind('click');
+ }
+
+ if (datas.prev_page) {
+ $("#PREV_PAGE").bind('click', function () {
+ searchResultModule.gotopage(datas.prev_page);
+ });
+ }
+ else {
+ $("#PREV_PAGE").unbind('click');
+ }
+
+ searchModule.afterSearch();
+ }
+ });
+ return false;
+ });
+ }
+
+ function _triggerShortcuts() {
+
+ $('#keyboard-stop').bind('click', function () {
+ var display = $(this).get(0).checked ? '0' : '1';
+
+ userModule.setPref('keyboard_infos', display);
+
+ });
+
+ var buttons = {};
+
+ buttons[language.fermer] = function () {
+ $("#keyboard-dialog").dialog('close');
+ };
+
+ $('#keyboard-dialog').dialog({
+ closeOnEscape: false,
+ resizable: false,
+ draggable: false,
+ modal: true,
+ width: 600,
+ height: 400,
+ overlay: {
+ backgroundColor: '#000',
+ opacity: 0.7
+ },
+ open: function (event, ui) {
+ $(this).dialog("widget").css("z-index", "1400");
+ },
+ close: function () {
+ $(this).dialog("widget").css("z-index", "auto");
+ if ($('#keyboard-stop').get(0).checked) {
+ var dialog = $('#keyboard-dialog');
+ if (dialog.data("ui-dialog")) {
+ dialog.dialog('destroy');
+ }
+ dialog.remove();
+ }
+ }
+ }).dialog('option', 'buttons', buttons).dialog('open');
+
+ $('#keyboard-dialog').scrollTop(0);
+
+ return false;
+ }
+
+ function _activeZoning() {
+ $('#idFrameC, #rightFrame').bind('mousedown', function (event) {
+ var old_zone = p4.active_zone;
+ p4.active_zone = $(this).attr('id');
+ if (p4.active_zone !== old_zone && p4.active_zone !== 'headBlock') {
+ $('.effectiveZone.activeZone').removeClass('activeZone');
+ $('.effectiveZone', this).addClass('activeZone');//.flash('#555555');
+ }
+ $('#EDIT_query').blur();
+ });
+ $('#rightFrame').trigger('mousedown');
+ }
+
+ function _answerSelector(el) {
+ if (el.hasClass('all_selector')) {
+ p4.Results.Selection.selectAll();
+ }
+ else {
+ if (el.hasClass('none_selector')) {
+ p4.Results.Selection.empty();
+ }
+ else {
+ if (el.hasClass('starred_selector')) {
+
+ }
+ else {
+ if (el.hasClass('video_selector')) {
+ p4.Results.Selection.empty();
+ p4.Results.Selection.select('.type-video');
+ }
+ else {
+ if (el.hasClass('image_selector')) {
+ p4.Results.Selection.empty();
+ p4.Results.Selection.select('.type-image');
+ }
+ else {
+ if (el.hasClass('document_selector')) {
+ p4.Results.Selection.empty();
+ p4.Results.Selection.select('.type-document');
+ }
+ else {
+ if (el.hasClass('audio_selector')) {
+ p4.Results.Selection.empty();
+ p4.Results.Selection.select('.type-audio');
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ function _saveWindows() {
+ var key = '';
+ var value = '';
+
+
+ if ($('#idFrameE').is(':visible') && $('#EDITWINDOW').is(':visible')) {
+ key = 'edit_window';
+ value = $('#idFrameE').outerWidth() / $('#EDITWINDOW').innerWidth();
+ }
+ else {
+ key = 'search_window';
+ value = $('#idFrameC').outerWidth() / bodySize.x;
+ }
+ userModule.setPref(key, value);
+ }
+
+ return {
+ linearizeUi: linearizeUi,
+ answerSizer: answerSizer,
+ openRecordEditor: openRecordEditor,
+ openPrintModal: openPrintModal,
+ openShareModal: openShareModal,
+ openToolModal: openToolModal,
+ openDownloadModal: openDownloadModal,
+ deleteConfirmation: deleteConfirmation,
+ doSpecialSearch: doSpecialSearch,
+ addToBasket: addToBasket,
+ removeFromBasket: removeFromBasket,
+ toggleTopic: toggleTopic
+ }
+})(p4, humane);
+
+//var language = {}; // handled with external prodution module
+
+
+
+(function ($) {
+ $.fn.extend({
+ highlight: function (color) {
+ if ($(this).hasClass('animating')) {
+ return;
+ }
+ color = typeof color !== 'undefined' ? color : 'red';
+ var oldColor = $(this).css('backgroundColor');
+ return $(this).addClass('animating').stop().animate({
+ backgroundColor: color
+ }, 50, 'linear', function () {
+ $(this).stop().animate({
+ backgroundColor: oldColor
+ }, 450, 'linear', function () {
+ $(this).removeClass('animating');
+ });
+ });
+ }
+ });
+})(jQuery);
diff --git a/resources/www/prod/js/publicator.js b/resources/www/prod/js/publicator.js
deleted file mode 100644
index 8453849c76..0000000000
--- a/resources/www/prod/js/publicator.js
+++ /dev/null
@@ -1,5 +0,0 @@
-function publicator_reload_publicator(url) {
- var options = $('#dialog_publicator form[name="current_datas"]').serializeArray();
- var dialog = p4.Dialog.get(1);
- dialog.load(url, 'POST', options);
-}
diff --git a/templates/web/admin/users.html.twig b/templates/web/admin/users.html.twig
index cd9455994e..3c424a14e1 100644
--- a/templates/web/admin/users.html.twig
+++ b/templates/web/admin/users.html.twig
@@ -447,7 +447,7 @@
var k = el.attr('id').split('_').pop();
- if (is_shift_key(evt) && $('tr.last_selected', cont).length != 0) {
+ if (utilsModule.is_shift_key(evt) && $('tr.last_selected', cont).length != 0) {
var lst = $('tr', cont);
var index1 = $.inArray($('tr.last_selected', cont)[0], lst);
var index2 = $.inArray($(el)[0], lst);
@@ -478,7 +478,7 @@
}
}
else {
- if (!is_ctrl_key(evt)) {
+ if (!utilsModule.is_ctrl_key(evt)) {
if ($.inArray(k, p4.users.sel) < 0) {
p4.users.sel = new Array();
$('tr', cont).removeClass('selected');
diff --git a/templates/web/prod/WorkZone/Macros.html.twig b/templates/web/prod/WorkZone/Macros.html.twig
index bef9793c3d..886384af86 100644
--- a/templates/web/prod/WorkZone/Macros.html.twig
+++ b/templates/web/prod/WorkZone/Macros.html.twig
@@ -45,12 +45,12 @@