mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-14 13:33:14 +00:00
New Adv Search
This commit is contained in:
@@ -602,50 +602,9 @@
|
|||||||
<input onclick="reset_adv_search();" type="button" value="{% trans 'Re-initialiser' %}" class="input-button"/>
|
<input onclick="reset_adv_search();" type="button" value="{% trans 'Re-initialiser' %}" class="input-button"/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<table>
|
<table style="widtg:100%;table-layout:fixed;">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td style="width:50%;vertical-align:top;">
|
||||||
<label>
|
|
||||||
{% trans 'Chercher tous les mots' %}
|
|
||||||
</label>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input style="width:150px;" name="query_all" type="text" value="" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<label>
|
|
||||||
{% trans 'Cette expression exacte' %}
|
|
||||||
</label>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input style="width:150px;" name="query_exact" type="text" value="" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<label>
|
|
||||||
{% trans 'Au moins un des mots suivants' %}
|
|
||||||
</label>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input style="width:150px;" name="query_or" type="text" value="" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<label>
|
|
||||||
{% trans 'Aucun des mots suivants' %}
|
|
||||||
</label>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input style="width:150px;" name="query_none" type="text" value="" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div class="sbasglob ui-corner-all">
|
<div class="sbasglob ui-corner-all">
|
||||||
<div style="text-align:center;margin:0 10px;">
|
<div style="text-align:center;margin:0 10px;">
|
||||||
<input class="input-button" type="button"
|
<input class="input-button" type="button"
|
||||||
@@ -655,6 +614,8 @@
|
|||||||
</div>
|
</div>
|
||||||
{{_self.bas_list(module_prod, search_datas)}}
|
{{_self.bas_list(module_prod, search_datas)}}
|
||||||
</div>
|
</div>
|
||||||
|
</td>
|
||||||
|
<td style="width:50%;vertical-align:top;">
|
||||||
<div id="sbasfiltercont" class="ui-corner-all">
|
<div id="sbasfiltercont" class="ui-corner-all">
|
||||||
<div>
|
<div>
|
||||||
{% if registry.get('GV_sphinx') %}
|
{% if registry.get('GV_sphinx') %}
|
||||||
@@ -773,6 +734,9 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@@ -55,6 +55,8 @@ var p4 = p4 || {};
|
|||||||
$dialog,
|
$dialog,
|
||||||
$this = this;
|
$this = this;
|
||||||
|
|
||||||
|
this.closing = false;
|
||||||
|
|
||||||
this.options = $.extend(defaults, options);
|
this.options = $.extend(defaults, options);
|
||||||
|
|
||||||
this.level = getLevel(level);
|
this.level = getLevel(level);
|
||||||
@@ -101,7 +103,17 @@ var p4 = p4 || {};
|
|||||||
{
|
{
|
||||||
$this.options.closeCallback($this.$dialog);
|
$this.options.closeCallback($this.$dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($this.closing === false)
|
||||||
|
{
|
||||||
|
console.log('not already closing');
|
||||||
|
$this.closing = true;
|
||||||
$this.Close();
|
$this.Close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
console.log('already closing');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$dialog.dialog('destroy').attr('title', this.options.title)
|
this.$dialog.dialog('destroy').attr('title', this.options.title)
|
||||||
@@ -141,7 +153,9 @@ var p4 = p4 || {};
|
|||||||
|
|
||||||
phraseaDialog.prototype = {
|
phraseaDialog.prototype = {
|
||||||
Close : function() {
|
Close : function() {
|
||||||
|
console.log('dialog close inside bef');
|
||||||
p4.Dialog.Close(this.level);
|
p4.Dialog.Close(this.level);
|
||||||
|
console.log('dialog close inside aft');
|
||||||
},
|
},
|
||||||
setContent : function (content) {
|
setContent : function (content) {
|
||||||
this.$dialog.removeClass('loading').empty().append(content);
|
this.$dialog.removeClass('loading').empty().append(content);
|
||||||
@@ -194,7 +208,8 @@ var p4 = p4 || {};
|
|||||||
|
|
||||||
$(window).unbind('resize.DIALOG' + getLevel(level));
|
$(window).unbind('resize.DIALOG' + getLevel(level));
|
||||||
|
|
||||||
this.get(level).getDomElement().dialog('destroy').remove();
|
this.get(level).closing = true;
|
||||||
|
this.get(level).getDomElement().dialog('close').dialog('destroy').remove();
|
||||||
|
|
||||||
var id = this.get(level).getId();
|
var id = this.get(level).getId();
|
||||||
|
|
||||||
|
@@ -178,6 +178,7 @@ function checkFilters(save)
|
|||||||
{
|
{
|
||||||
var danger = false;
|
var danger = false;
|
||||||
var search = {};
|
var search = {};
|
||||||
|
var adv_box = $('form.phrasea_query .adv_options');
|
||||||
search.bases = {};
|
search.bases = {};
|
||||||
search.fields = {};
|
search.fields = {};
|
||||||
search.dates = {};
|
search.dates = {};
|
||||||
@@ -189,10 +190,12 @@ function checkFilters(save)
|
|||||||
switches.filter('option').hide().filter('option[selected]').removeAttr('selected').addClass('was');
|
switches.filter('option').hide().filter('option[selected]').removeAttr('selected').addClass('was');
|
||||||
switches.filter(':checkbox').parent().hide().find(':checkbox[checked]').removeAttr('checked').addClass('was');
|
switches.filter(':checkbox').parent().hide().find(':checkbox[checked]').removeAttr('checked').addClass('was');
|
||||||
|
|
||||||
$('form[name="phrasea_query"] .field_filter,form[name="phrasea_query"] .status_filter,form[name="phrasea_query"] .date_filter').removeClass('danger');
|
|
||||||
|
|
||||||
$.each($('form[name="phrasea_query"] .sbascont'),
|
$('.field_filter, .status_filter, .date_filter', adv_box).removeClass('danger');
|
||||||
function(){
|
|
||||||
|
var adv_box = $('form.phrasea_query .adv_options');
|
||||||
|
console.log('loopin on , ', $('.sbascont', adv_box));
|
||||||
|
$.each($('.sbascont', adv_box), function(){
|
||||||
|
|
||||||
var id = $(this).parent().find('input[name=reference]').val();
|
var id = $(this).parent().find('input[name=reference]').val();
|
||||||
search.bases[id] = [];
|
search.bases[id] = [];
|
||||||
@@ -205,6 +208,7 @@ function checkFilters(save)
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cbck = chuckbass.filter(':checked');
|
var cbck = chuckbass.filter(':checked');
|
||||||
|
console.log(cbck.length);
|
||||||
if(cbck.length>0)
|
if(cbck.length>0)
|
||||||
{
|
{
|
||||||
var zfield = $('#sbasfiltercont .field_'+id).show();
|
var zfield = $('#sbasfiltercont .field_'+id).show();
|
||||||
@@ -230,7 +234,7 @@ function checkFilters(save)
|
|||||||
if(!reset_field && search.fields.length>0)
|
if(!reset_field && search.fields.length>0)
|
||||||
{
|
{
|
||||||
danger = true;
|
danger = true;
|
||||||
$('form[name="phrasea_query"] .field_filter').addClass('danger');
|
$('.field_filter', adv_box).addClass('danger');
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.status_filter :checkbox[checked]').each(function(){
|
$('.status_filter :checkbox[checked]').each(function(){
|
||||||
@@ -238,17 +242,17 @@ function checkFilters(save)
|
|||||||
var n = $(this).attr('n');
|
var n = $(this).attr('n');
|
||||||
search.status[n] = $(this).val().split('_');
|
search.status[n] = $(this).val().split('_');
|
||||||
danger = true;
|
danger = true;
|
||||||
$('form[name="phrasea_query"] .status_filter') .addClass('danger');
|
$('.status_filter', adv_box) .addClass('danger');
|
||||||
});
|
});
|
||||||
|
|
||||||
search.dates.minbound = $('.date_filter input[name=datemin]').val();
|
search.dates.minbound = $('.date_filter input[name=datemin]', adv_box).val();
|
||||||
search.dates.maxbound = $('.date_filter input[name=datemax]').val();
|
search.dates.maxbound = $('.date_filter input[name=datemax]', adv_box).val();
|
||||||
search.dates.field = $('.date_filter select[name=datefield]').val();
|
search.dates.field = $('.date_filter select[name=datefield]', adv_box).val();
|
||||||
|
|
||||||
if($.trim(search.dates.minbound) || $.trim(search.dates.maxbound))
|
if($.trim(search.dates.minbound) || $.trim(search.dates.maxbound))
|
||||||
{
|
{
|
||||||
danger = true;
|
danger = true;
|
||||||
$('form[name="phrasea_query"] .date_filter').addClass('danger');
|
$(' .date_filter', adv_box).addClass('danger');
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.field_filter select').scrollTop(scroll);
|
$('.field_filter select').scrollTop(scroll);
|
||||||
@@ -389,35 +393,6 @@ function newSearch()
|
|||||||
|
|
||||||
function newAdvSearch()
|
function newAdvSearch()
|
||||||
{
|
{
|
||||||
var cont = $('form[name="phrasea_query"]');
|
|
||||||
var val_all = $.trim($('input[name=query_all]',cont).val()).split(' ').join(' AND ');
|
|
||||||
var val_or = $.trim($('input[name=query_or]',cont).val()).split(' ').join(' OR ');
|
|
||||||
var val_exact = $.trim($('input[name=query_exact]',cont).val());
|
|
||||||
var val_none = $.trim($('input[name=query_none]',cont).val()).split(' ').join(' EXCEPT ');
|
|
||||||
|
|
||||||
var val = val_all != '' ? '('+val_all+')' : '';
|
|
||||||
|
|
||||||
if(val_or!='')
|
|
||||||
val = val + (val != '' ? ' AND ' : '') + '('+val_or+')';
|
|
||||||
if(val_exact!='')
|
|
||||||
val = val + (val != '' ? ' AND ' : '') + '"'+val_exact+'"';
|
|
||||||
if(val_none!='')
|
|
||||||
val = val + (val != '' ? ' ' : 'all ') +'EXCEPT '+ val_none;
|
|
||||||
|
|
||||||
|
|
||||||
val = $.trim(val);
|
|
||||||
if(val == '')
|
|
||||||
{
|
|
||||||
var current = $('#EDIT_query').val();
|
|
||||||
if($.trim(current) == '')
|
|
||||||
{
|
|
||||||
val = 'all';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
val = current;
|
|
||||||
}
|
|
||||||
$('#EDIT_query').val(val);
|
|
||||||
|
|
||||||
newSearch();
|
newSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -498,8 +473,8 @@ function afterSearch()
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initAnswerForm(){
|
function initAnswerForm(){
|
||||||
$('form[name="phrasea_query"] button').button();
|
$('form.phrasea_query button').button();
|
||||||
$('#searchForm').bind('submit',function(){
|
$('#searchForm').unbind('submit').bind('submit',function(){
|
||||||
answAjax = $.ajax({
|
answAjax = $.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/prod/answer.php",
|
url: "/prod/answer.php",
|
||||||
@@ -848,7 +823,8 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
closeCallback: function(dialog){
|
closeCallback: function(dialog){
|
||||||
$('form[name=phrasea_query]').html(dialog.html());
|
dialog.find('form.phrasea_query button').button('destroy');
|
||||||
|
$('form[name=phrasea_query]').html(dialog.find('form.phrasea_query').html());
|
||||||
$('form[name=phrasea_query]').find('.adv_options').hide();
|
$('form[name=phrasea_query]').find('.adv_options').hide();
|
||||||
$('form[name=phrasea_query]').find('.adv_trigger').show();
|
$('form[name=phrasea_query]').find('.adv_trigger').show();
|
||||||
initAnswerForm();
|
initAnswerForm();
|
||||||
@@ -857,12 +833,22 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
$dialog = p4.Dialog.Create(options);
|
$dialog = p4.Dialog.Create(options);
|
||||||
|
|
||||||
|
$('form[name=phrasea_query] button').button('destroy');
|
||||||
var html = $('<form class="phrasea_query"></form>').append($('form[name=phrasea_query]').html());
|
var html = $('<form class="phrasea_query"></form>').append($('form[name=phrasea_query]').html());
|
||||||
$('form[name=phrasea_query]').empty();
|
$('form[name=phrasea_query]').empty();
|
||||||
|
|
||||||
$dialog.setContent(html);
|
$dialog.setContent(html);
|
||||||
$dialog.getDomElement().find('.adv_options').show();
|
$dialog.getDomElement().find('.adv_options').show();
|
||||||
$dialog.getDomElement().find('.adv_trigger').hide();
|
$dialog.getDomElement().find('.adv_trigger').hide();
|
||||||
|
$dialog.getDomElement().find('button').button();
|
||||||
|
$dialog.getDomElement().find('form').bind('submit', function(){
|
||||||
|
console.log('before dialog close');
|
||||||
|
$dialog.Close();
|
||||||
|
console.log('after dialog close');
|
||||||
|
newSearch();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user