Advanced search: Client side handles hierarchical keys correctly.

SVN:trunk[5687]
This commit is contained in:
Guillaume Lajarige
2018-04-18 08:34:45 +00:00
parent baf413ee55
commit 0210e090f2
6 changed files with 1842 additions and 1621 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1159,6 +1159,20 @@ input.dp-applied {
}
}
}
.sfc_opc_mc_items_hint{
margin-top: 15px;
margin-bottom: 15px;
padding-left: 9px;
padding-right: 9px;
color: $gray;
font-size: 10px;
font-style: italic;
> span{
margin-right: 0.5em;
font-style: italic;
}
}
}
}
}

View File

@@ -1447,13 +1447,20 @@ When associated with a trigger, each action is given an "order" number, specifyi
'UI:Search:Criteria:Title:Enum:In' => '%1$s: %2$s',
'UI:Search:Criteria:Title:Enum:In:Many' => '%1$s: %2$s and %3$s others',
'UI:Search:Criteria:Title:Enum:In:All' => '%1$s: Any',
// - External key widget
'UI:Search:Criteria:Title:ExternalKey:Empty' => '%1$s is defined',
'UI:Search:Criteria:Title:ExternalKey:NotEmpty' => '%1$s is not defined',
'UI:Search:Criteria:Title:ExternalKey:Equals' => '%1$s %2$s',
'UI:Search:Criteria:Title:ExternalKey:In' => '%1$s: %2$s',
'UI:Search:Criteria:Title:ExternalKey:In:Many' => '%1$s: %2$s and %3$s others',
'UI:Search:Criteria:Title:ExternalKey:In:All' => '%1$s: Any',
// - External key widget
'UI:Search:Criteria:Title:ExternalKey:Empty' => '%1$s is defined',
'UI:Search:Criteria:Title:ExternalKey:NotEmpty' => '%1$s is not defined',
'UI:Search:Criteria:Title:ExternalKey:Equals' => '%1$s %2$s',
'UI:Search:Criteria:Title:ExternalKey:In' => '%1$s: %2$s',
'UI:Search:Criteria:Title:ExternalKey:In:Many' => '%1$s: %2$s and %3$s others',
'UI:Search:Criteria:Title:ExternalKey:In:All' => '%1$s: Any',
// - Hierarchical key widget
'UI:Search:Criteria:Title:HierarchicalKey:Empty' => '%1$s is defined',
'UI:Search:Criteria:Title:HierarchicalKey:NotEmpty' => '%1$s is not defined',
'UI:Search:Criteria:Title:HierarchicalKey:Equals' => '%1$s %2$s',
'UI:Search:Criteria:Title:HierarchicalKey:In' => '%1$s: %2$s',
'UI:Search:Criteria:Title:HierarchicalKey:In:Many' => '%1$s: %2$s and %3$s others',
'UI:Search:Criteria:Title:HierarchicalKey:In:All' => '%1$s: Any',
// - Criteria operators
// - Default widget
@@ -1496,6 +1503,7 @@ When associated with a trigger, each action is given an "order" number, specifyi
'UI:Search:Criteria:DateTime:PlaceholderFromTime' => 'Any date',
'UI:Search:Criteria:DateTime:PlaceholderUntil' => 'Any date',
'UI:Search:Criteria:DateTime:PlaceholderUntilTime' => 'Any date',
'UI:Search:Criteria:HierarchicalKey:ChildrenIncluded:Hint' => 'Children of the selected objects will be included.',
'UI:Search:Criteria:Raw:Filtered' => 'Filtered',
'UI:Search:Criteria:Raw:FilteredOn' => 'Filtered on %1$s',

View File

@@ -503,26 +503,6 @@ $(function()
});
},
// - Compute the title string
_computeEmptyOperatorTitle: function(sTitle) {
if (sTitle !== undefined) {
return sTitle;
}
sTitle = Dict.Format('UI:Search:Criteria:Title:Default:Empty', this.options.field.label);
return sTitle;
},
_computeNotEmptyOperatorTitle: function(sTitle) {
if (sTitle !== undefined) {
return sTitle;
}
sTitle = Dict.Format('UI:Search:Criteria:Title:Default:NotEmpty', this.options.field.label);
return sTitle;
},
_computeTitle: function(sTitle)
{
if(sTitle !== undefined)
@@ -563,6 +543,24 @@ $(function()
return sTitle;
},
_computeEmptyOperatorTitle: function(sTitle) {
if (sTitle !== undefined) {
return sTitle;
}
sTitle = Dict.Format('UI:Search:Criteria:Title:Default:Empty', this.options.field.label);
return sTitle;
},
_computeNotEmptyOperatorTitle: function(sTitle) {
if (sTitle !== undefined) {
return sTitle;
}
sTitle = Dict.Format('UI:Search:Criteria:Title:Default:NotEmpty', this.options.field.label);
return sTitle;
},
// - Set the title element
_setTitle: function(sTitle)
{

View File

@@ -52,5 +52,6 @@ $(function()
//------------------
// Inherited methods
//------------------
});
});

View File

@@ -4,11 +4,13 @@ $(function()
{
// the widget definition, where 'itop' is the namespace,
// 'search_form_criteria_hierarchical_key' the widget name
$.widget( 'itop.search_form_criteria_hierarchical_key', $.itop.search_form_criteria_enum,
$.widget( 'itop.search_form_criteria_hierarchical_key', $.itop.search_form_criteria_external_key,
{
// default options
options:
{
// True if the widget should also retrieve children of the selected objects.
'is_hierarchical': true,
},
@@ -48,26 +50,31 @@ $(function()
// Inherited methods
//------------------
// Event callbacks
// - External events
_onGetData: function(oData)
{
var oCriteriaData = this._super(oData);
oCriteriaData.is_hierarchical = this.options.is_hierarchical;
return oCriteriaData;
},
// DOM element helpers
prepareInOperator: function(oOpElem, sOpIdx, oOp)
_prepareInOperator: function(oOpElem, sOpIdx, oOp)
{
var me = this;
this._super();
this._super(oOpElem, sOpIdx, oOp);
// Note: Hierarchical key is on stand by for now.
// // DOM elements
// // - Add search dialog button
// this.element.find('.sf_filter')
// .append('<button type="button" class="sff_hierarchy_dialog"><span class=" fa fa-sitemap"></span></button>')
// .addClass('sf_with_buttons');
//
// // Events
// // - Open hierarchy dialog
// this.element.find('.sff_hierarchy_dialog').on('click', function(){
// // TODO: Open hierarchy dialog with right params
// alert('Not implemented yet');
// });
if(this.options.is_hierarchical === true)
{
var oChildrenHintElem = $('<div></div>')
.addClass('sfc_opc_mc_items_hint')
.append('<span class="fa fa-info"></span>')
.append(Dict.S('UI:Search:Criteria:HierarchicalKey:ChildrenIncluded:Hint'))
.appendTo(oOpElem.find('.sfc_opc_mc_items_wrapper'));
}
},
});
});