diff --git a/web/includes/Filter.php b/web/includes/Filter.php index 70495ccb6e0..9506a88a7c4 100644 --- a/web/includes/Filter.php +++ b/web/includes/Filter.php @@ -1147,6 +1147,7 @@ public function simple_widget() { $html .= ''; $html .= htmlSelect("filter[Query][terms][$i][val]", $availableTags, $selected, $options).PHP_EOL; $html .= ''; + $html .= $this->addButtonForFilterSelect("filter[Query][terms][$i][val]"); // $html .= ''.htmlSelect("filter[Query][terms][$i][val]", array_combine($availableTags,$availableTags), $term['val'], // $options).''.PHP_EOL; // $html .= ''.htmlSelect("filter[Query][terms][$i][val]", $availableTags, $term['val'], $options).''.PHP_EOL; @@ -1192,7 +1193,7 @@ public function simple_widget() { $html .= ''; $html .= htmlSelect("filter[Query][terms][$i][val]", $booleanValues, $term['val'], ['class'=>'chosen chosen-auto-width']).PHP_EOL; $html .= ''; - + $html .= $this->addButtonForFilterSelect("filter[Query][terms][$i][val]"); } else if ( $term['attr'] == 'Group') { $html .= ''; $html .= htmlSelect("filter[Query][terms][$i][val]", Group::get_dropdown_options(), $term['val'], @@ -1200,14 +1201,17 @@ public function simple_widget() { 'multiple'=>'multiple', 'data-placeholder'=>translate('All Groups')]).PHP_EOL; $html .= ''; + $html .= $this->addButtonForFilterSelect("filter[Query][terms][$i][val]"); } else if ( $term['attr'] == 'StateId' ) { $html .= ''; $html .= htmlSelect("filter[Query][terms][$i][val]", $states, $term['val'], ['class'=>'chosen chosen-auto-width']).PHP_EOL; $html .= ''; + $html .= $this->addButtonForFilterSelect("filter[Query][terms][$i][val]"); } else if ( strpos($term['attr'], 'Weekday') !== false ) { $html .= ''; $html .= htmlSelect("filter[Query][terms][$i][val]", $weekdays, $term['val'], ['class'=>'chosen chosen-auto-width']).PHP_EOL; $html .= ''; + $html .= $this->addButtonForFilterSelect("filter[Query][terms][$i][val]"); } else if ( $term['attr'] == 'Monitor' ) { $monitors = []; foreach (Monitor::find(['Deleted'=>false], ['order'=>'lower(Name)']) as $m) { @@ -1230,6 +1234,7 @@ public function simple_widget() { $html .= ''; $html .= htmlSelect("filter[Query][terms][$i][val]", $monitors, $selected, $options).PHP_EOL; $html .= ''; + $html .= $this->addButtonForFilterSelect("filter[Query][terms][$i][val]"); } else if ( $term['attr'] == 'MonitorName' ) { $monitor_names = []; foreach (Monitor::find(['Deleted'=>false], ['order'=>'lower(Name)']) as $m) { @@ -1241,11 +1246,13 @@ public function simple_widget() { $html .= htmlSelect("filter[Query][terms][$i][val]", array_combine($monitor_names,$monitor_names), $term['val'], ['class'=>'term-value chosen chosen-auto-width', 'multiple'=>'multiple', 'data-placeholder'=>translate('All Monitors')]).PHP_EOL; $html .= ''; + $html .= $this->addButtonForFilterSelect("filter[Query][terms][$i][val]"); } else if ( $term['attr'] == 'ServerId' || $term['attr'] == 'MonitorServerId' || $term['attr'] == 'StorageServerId' || $term['attr'] == 'FilterServerId' ) { $html .= ''; $html .= htmlSelect("filter[Query][terms][$i][val]", $servers, $term['val'], ['class'=>'term-value chosen chosen-auto-width', 'multiple'=>'multiple']).PHP_EOL; $html .= ''; + $html .= $this->addButtonForFilterSelect("filter[Query][terms][$i][val]"); } else if ( ($term['attr'] == 'StorageId') || ($term['attr'] == 'SecondaryStorageId') ) { if (!$storageareas) { $storageareas = array('' => array('Name'=>'NULL Unspecified'), '0' => array('Name'=>'Zero')) + ZM_Object::Objects_Indexed_By_Id('ZM\Storage'); @@ -1254,11 +1261,13 @@ public function simple_widget() { $html .= htmlSelect("filter[Query][terms][$i][val]", $storageareas, $term['val'], ['class'=>'term-value chosen chosen-auto-width', 'multiple'=>'multiple']).PHP_EOL; $html .= ''; + $html .= $this->addButtonForFilterSelect("filter[Query][terms][$i][val]"); } else if ( $term['attr'] == 'AlarmedZoneId' ) { $html .= ''; $html .= htmlSelect("filter[Query][terms][$i][val]", $zones, $term['val'], ['class'=>'term-value chosen chosen-auto-width', 'multiple'=>'multiple']).PHP_EOL; $html .= ''; + $html .= $this->addButtonForFilterSelect("filter[Query][terms][$i][val]"); } else if ( $term['attr'] == 'Notes' ) { $attrs = ['id'=>'filterNotes', 'class'=>'term-value chosen chosen-auto-width', 'multiple'=>'multiple', 'data-placeholder'=>translate('Event Type')]; $selected = explode(',', $term['val']); @@ -1286,6 +1295,7 @@ public function simple_widget() { $html .= ''; $html .= htmlSelect("filter[Query][terms][$i][val]", $options, $selected, $attrs).PHP_EOL; $html .= ''; + $html .= $this->addButtonForFilterSelect("filter[Query][terms][$i][val]"); } else { #$html .= $term['attr']; $html .= ''; @@ -1374,5 +1384,19 @@ public function canEdit($u=null) { return false; } + function addButtonForFilterSelect($nameSelect) { + if (isset($_COOKIE['zmUseOldMenuView']) and $_COOKIE["zmUseOldMenuView"] === 'true') { + $html = ''; + } else { + $html = PHP_EOL . ' + + + ' . PHP_EOL; + } + return $html; + } } # end class Filter ?> diff --git a/web/skins/classic/assets/mb.extruder/inc/mbExtruder.js b/web/skins/classic/assets/mb.extruder/inc/mbExtruder.js new file mode 100644 index 00000000000..839e25b6ab7 --- /dev/null +++ b/web/skins/classic/assets/mb.extruder/inc/mbExtruder.js @@ -0,0 +1,550 @@ +/* + * ****************************************************************************** + * jquery.mb.components + * file: mbExtruder.js + * + * Copyright (c) 2001-2014. Matteo Bicocchi (Pupunzi); + * Open lab srl, Firenze - Italy + * email: matteo@open-lab.com + * site: http://pupunzi.com + * blog: http://pupunzi.open-lab.com + * http://open-lab.com + * + * Licences: MIT, GPL + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * last modified: 08/05/14 20.00 + * ***************************************************************************** + */ + +(function($) { + document.extruder=new Object(); + document.extruder.left = 0; + document.extruder.top = 0; + document.extruder.bottom = 0; + document.extruder.right = 0; + document.extruder.idx=0; + + $.mbExtruder= { + author:"Matteo Bicocchi & IgorA100", + version:"2.6.0", + defaults:{ + width:350, + noFlap:false, + positionFixed:true, +/*+*/ selectorResponsiveBlock: null, +/*+*/ attachToParentSide:"left", +/*+*/ bindToButtonByHeight: null, +/*+*/ extruderParentElement: null, + sensibility:800, + position:"top", + accordionPanels:true, +/*~*/ top:"auto", // =topFlap. For compatibility with the previous version +/*+*/ topFlap:"auto", +/*+*/ topBlock:0, + extruderOpacity:1, + zIndex:'max', + flapMargin:35, + textOrientation:"bt", // or "tb" (top-bottom or bottom-top) + onExtOpen:function(){}, + onExtContentLoad:function(){}, + onExtClose:function(){}, + hidePanelsOnClose:true, + closeOnClick:true, + closeOnExternalClick:true, + autoCloseTime:0, + autoOpenTime:0, + slideTimer:300 + }, + + buildMbExtruder: function(options){ + return this.each (function (){ + this.options = {}; + $.extend (this.options, $.mbExtruder.defaults); + $.extend (this.options, options); + + this.idx=document.extruder.idx; + document.extruder.idx++; + var extruder,extruderContent,wrapper,extruderStyle,wrapperStyle,txt,closeTimer,openTimer; + extruder= $(this); + extruderContent=extruder.html(); +/*+*/ + if (this.options.top) this.options.topFlap = this.options.top; + if (this.options.width > window.innerWidth) { + this.options.width = window.innerWidth; + } +/*-*/ + extruder.css("zIndex",100); + var isVertical = this.options.position=="left" || this.options.position=="right"; + var extW= isVertical?1: this.options.width; +/*+*/ if (this.options.selectorResponsiveBlock) { +/*+*/ var c= $("
").addClass("extruder-content").css({width:extW, display:"none"}); + } else { + var c= $("
").addClass("extruder-content").css({overflow:"hidden", width:extW, display:"none"}); + } + c.append(extruderContent); + extruder.html(c); + + var position=this.options.positionFixed?"fixed":"absolute"; + extruder.addClass("extruder"); + extruder.addClass(this.options.position); + var isHorizontal = this.options.position=="top" || this.options.position=="bottom"; + extruderStyle = + this.options.position=="top" ? + {position:position,top:0,left:"50%",marginLeft:-this.options.width/2,width:this.options.width}: + this.options.position=="bottom" ? + {position:position,bottom:0,left:"50%",marginLeft:-this.options.width/2,width:this.options.width}: + this.options.position=="left" ? + {position:position,top:this.options.topBlock,left:0,width:1}: + {position:position,top:this.options.topBlock,right:0,width:1}; + extruder.css(extruderStyle); + extruder.css({opacity:this.options.extruderOpacity}); + extruder.wrapInner("
"); + wrapper= extruder.find(".extruder-wrapper"); + + wrapperStyle={position:"absolute", width:isVertical?1:this.options.width}; + wrapper.css(wrapperStyle); + + if (isHorizontal){ + this.options.position=="top"? document.extruder.top++ : document.extruder.bottom++; + if (document.extruder.top >1 || document.extruder.bottom>1){ + alert("more than 1 mb.extruder on top or bottom is not supported jet... hope soon!"); + return; + } + } + + if ($.metadata){ + $.metadata.setType("class"); + if (extruder.metadata().title) extruder.attr("extTitle",extruder.metadata().title); + if (extruder.metadata().url) extruder.attr("extUrl",extruder.metadata().url); + if (extruder.metadata().data) extruder.attr("extData",extruder.metadata().data); + } + + var flapFooter=$("'; diff --git a/web/skins/classic/views/js/events.js b/web/skins/classic/views/js/events.js index 3c66f4d4695..8c104de5258 100644 --- a/web/skins/classic/views/js/events.js +++ b/web/skins/classic/views/js/events.js @@ -513,6 +513,23 @@ function initPage() { table.find('tr td:nth-child(' + (thumb_ndx+1) + ')').addClass('colThumbnail'); }); + if (useOldMenuView) { + // If new menu is used, then Datepicker initialization occurs in main "skin.js" + // Reinitialization is not allowed because the 'Destroy' method is missing. + initDatepickerEventsPage(); + } + + window.onpageshow = function(evt) { + console.log('Refreshing table'); + table.bootstrapTable('refresh'); + }; + + table.bootstrapTable('resetSearch'); + // The table is initially given a hidden style, so now that we are done rendering, show it + table.show(); +} + +function initDatepickerEventsPage() { $j('#fieldsTable input, #fieldsTable select').each(function(index) { const el = $j(this); if (el.hasClass('datetimepicker')) { @@ -523,15 +540,6 @@ function initPage() { el.on('change', filterEvents); } }); - - window.onpageshow = function(evt) { - console.log('Refreshing table'); - table.bootstrapTable('refresh'); - }; - - table.bootstrapTable('resetSearch'); - // The table is initially given a hidden style, so now that we are done rendering, show it - table.show(); } function filterEvents(clickedElement) { diff --git a/web/skins/classic/views/js/montagereview.js b/web/skins/classic/views/js/montagereview.js index 805c044a02b..d4b8140bde4 100644 --- a/web/skins/classic/views/js/montagereview.js +++ b/web/skins/classic/views/js/montagereview.js @@ -1233,6 +1233,15 @@ function initPage() { $j('#archive_status').bind('change', function() { this.form.submit(); }); + + if (useOldMenuView) { + // If new menu is used, then Datepicker initialization occurs in main "skin.js" + // Reinitialization is not allowed because the 'Destroy' method is missing. + initDatepickerMontageReviewPage(); + } +} + +function initDatepickerMontageReviewPage() { $j('#fieldsTable input, #fieldsTable select').each(function(index) { const el = $j(this); if (el.hasClass('datetimepicker')) { diff --git a/web/skins/classic/views/js/report_event_audit.js b/web/skins/classic/views/js/report_event_audit.js index 75c5f503dfe..49ce70e3993 100644 --- a/web/skins/classic/views/js/report_event_audit.js +++ b/web/skins/classic/views/js/report_event_audit.js @@ -21,7 +21,7 @@ function datetime_change(newDate, oldData) { } } -function initPage() { +function initDatepickerReportEventAuditPage() { $j('#minTime').datetimepicker({ timeFormat: "HH:mm:ss", dateFormat: "yy-mm-dd", @@ -40,5 +40,13 @@ function initPage() { }); } +function initPage() { + if (useOldMenuView) { + // If new menu is used, then Datepicker initialization occurs in main "skin.js" + // Reinitialization is not allowed because the 'Destroy' method is missing. + initDatepickerReportEventAuditPage(); + } +} + // Kick everything off window.addEventListener( 'DOMContentLoaded', initPage );