diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php
index e19a985b6..8a20df278 100644
--- a/application/cmdbabstract.class.inc.php
+++ b/application/cmdbabstract.class.inc.php
@@ -4292,7 +4292,7 @@ EOF
$('.ui-layout-content').prepend('
');
$(''+data.popup_message+'
').dialog({title: $sJSTitle, modal: true, autoOpen: true, buttons:[ {text: $sJSOk, click: function() { $(this).dialog('close'); } }], close: function() { $(this).remove(); }});
}
- $('.wizContainer form button.action:not(.cancel)').attr('disabled', 'disabled');
+ $('.wizContainer form button.action:not(.cancel)').prop('disabled', true);
}
else if ((data.operation == 'lost') || (data.operation == 'expired'))
{
@@ -4301,7 +4301,7 @@ EOF
$('.ui-layout-content').prepend('');
$(''+data.popup_message+'
').dialog({title: $sJSTitle, modal: true, autoOpen: true, buttons:[ {text: $sJSOk, click: function() { $(this).dialog('close'); } }], close: function() { $(this).remove(); }});
}
- $('.wizContainer form button.action:not(.cancel)').attr('disabled', 'disabled');
+ $('.wizContainer form button.action:not(.cancel)').prop('disabled', true);
}
}, 'json');
}, $iInterval);
diff --git a/application/itopwebpage.class.inc.php b/application/itopwebpage.class.inc.php
index ca4563f56..7fc9a176e 100644
--- a/application/itopwebpage.class.inc.php
+++ b/application/itopwebpage.class.inc.php
@@ -73,7 +73,6 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
$this->add_linked_stylesheet("../css/jquery.treeview.css");
$this->add_linked_stylesheet("../css/jquery.autocomplete.css");
$this->add_linked_stylesheet("../css/jquery-ui-timepicker-addon.css");
- $this->add_linked_stylesheet("../css/fg.menu.css");
$this->add_linked_stylesheet("../css/jquery.multiselect.css");
$this->add_linked_stylesheet("../css/magnific-popup.css");
$this->add_linked_stylesheet("../css/c3.min.css");
@@ -93,7 +92,6 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
$this->add_linked_script("../js/ckeditor/adapters/jquery.js");
$this->add_linked_script("../js/jquery.qtip-1.0.min.js");
$this->add_linked_script('../js/property_field.js');
- $this->add_linked_script('../js/fg.menu.js');
$this->add_linked_script('../js/icon_select.js');
$this->add_linked_script('../js/raphael-min.js');
$this->add_linked_script('../js/d3.js');
@@ -361,7 +359,7 @@ EOF
return;
}
ui.panel.html('
');
- ui.jqXHR.success(function() {
+ ui.jqXHR.done(function() {
ui.tab.data( "loaded", true );
});
}
diff --git a/application/nicewebpage.class.inc.php b/application/nicewebpage.class.inc.php
index b3c023aaf..63227e88d 100644
--- a/application/nicewebpage.class.inc.php
+++ b/application/nicewebpage.class.inc.php
@@ -37,8 +37,8 @@ class NiceWebPage extends WebPage
{
parent::__construct($s_title, $bPrintable);
$this->m_aReadyScripts = array();
- $this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery-1.12.4.min.js');
- $this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery-migrate-1.4.1.min.js'); // Needed since many other plugins still rely on oldies like $.browser
+ $this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery-3.3.1.min.js');
+ $this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery-migrate-3.0.1.min.js'); // Needed since many other plugins still rely on oldies like $.browser
$this->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot().'css/ui-lightness/jquery-ui-1.11.4.custom.css');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery-ui-1.11.4.custom.min.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/utils.js');
diff --git a/application/ui.htmleditorwidget.class.inc.php b/application/ui.htmleditorwidget.class.inc.php
index 683e372db..0aafec101 100644
--- a/application/ui.htmleditorwidget.class.inc.php
+++ b/application/ui.htmleditorwidget.class.inc.php
@@ -101,7 +101,7 @@ class UIHTMLEditorWidget
$oPage->add_ready_script(
<<add_ready_script("$('#{$this->iId}_confirm').bind('keyup change', function(evt, sFormId) { return ValidatePasswordField('$this->iId', sFormId) } );"); // Bind to a custom event: validate
$oPage->add_ready_script("$('#{$this->iId}').bind('update', function(evt, sFormId)
{
- if ($(this).attr('disabled'))
+ if ($(this).prop('disabled'))
{
- $('#{$this->iId}_confirm').attr('disabled', 'disabled');
- $('#{$this->iId}_changed').attr('disabled', 'disabled');
- $('#{$this->iId}_reset').attr('disabled', 'disabled');
+ $('#{$this->iId}_confirm').prop('disabled', true);
+ $('#{$this->iId}_changed').prop('disabled', true);
+ $('#{$this->iId}_reset').prop('disabled', true);
}
else
{
- $('#{$this->iId}_confirm').removeAttr('disabled');
- $('#{$this->iId}_changed').removeAttr('disabled');
- $('#{$this->iId}_reset').removeAttr('disabled');
+ $('#{$this->iId}_confirm').prop('disabled', false);
+ $('#{$this->iId}_changed').prop('disabled', false);
+ $('#{$this->iId}_reset').prop('disabled', false);
}
}
);"); // Bind to a custom event: update to handle enabling/disabling
diff --git a/css/fg.menu.css b/css/fg.menu.css
deleted file mode 100755
index 39a5a2e14..000000000
--- a/css/fg.menu.css
+++ /dev/null
@@ -1,115 +0,0 @@
-/* Styles for jQuery menu widget
-Author: Maggie Wachs, maggie@filamentgroup.com
-Date: September 2008
-*/
-
-
-/* REQUIRED STYLES - the menus will only render correctly with these rules */
-
-.positionHelper { z-index: 2999; }
-.fg-menu-container { position: absolute; top:0; left:-999px; padding: .4em; overflow: hidden; }
-.fg-menu-container.fg-menu-flyout { overflow: visible; }
-
-.fg-menu, .fg-menu ul { list-style-type:none; padding: 0; margin:0; }
-
-.fg-menu { position:relative; }
-.fg-menu-flyout .fg-menu { position:static; }
-
-.fg-menu ul { position:absolute; top:0; }
-.fg-menu ul ul { top:-1px; }
-
-.fg-menu-container.fg-menu-ipod .fg-menu-content,
-.fg-menu-container.fg-menu-ipod .fg-menu-content ul { background: none !important; }
-
-.fg-menu.fg-menu-scroll,
-.fg-menu ul.fg-menu-scroll { overflow: scroll; overflow-x: hidden; }
-
-.fg-menu li { clear:both; float:left; width:100%; margin: 0; padding:0; border: 0; }
-.fg-menu li li { font-size:1em; } /* inner li font size must be reset so that they don't blow up */
-
-.fg-menu-flyout ul ul { padding: .4em; }
-.fg-menu-flyout li { position:relative; }
-
-.fg-menu-scroll { overflow: scroll; overflow-x: hidden; }
-
-.fg-menu-breadcrumb { margin: 0; padding: 0; }
-
-.fg-menu-footer { margin-top: .4em; padding: .4em; }
-.fg-menu-header { margin-bottom: .4em; padding: .4em; }
-
-.fg-menu-breadcrumb li { float: left; list-style: none; margin: 0; padding: 0 .2em; font-size: .9em; opacity: .7; }
-.fg-menu-breadcrumb li.fg-menu-prev-list,
-.fg-menu-breadcrumb li.fg-menu-current-crumb { clear: left; float: none; opacity: 1; }
-.fg-menu-breadcrumb li.fg-menu-current-crumb { padding-top: .2em; }
-
-.fg-menu-breadcrumb a,
-.fg-menu-breadcrumb span { float: left; }
-
-.fg-menu-footer a:link,
-.fg-menu-footer a:visited { float:left; width:100%; text-decoration: none; }
-.fg-menu-footer a:hover,
-.fg-menu-footer a:active { }
-
-.fg-menu-footer a span { float:left; cursor: pointer; }
-
-.fg-menu-breadcrumb .fg-menu-prev-list a:link,
-.fg-menu-breadcrumb .fg-menu-prev-list a:visited,
-.fg-menu-breadcrumb .fg-menu-prev-list a:hover,
-.fg-menu-breadcrumb .fg-menu-prev-list a:active { background-image: none; text-decoration:none; }
-
-.fg-menu-breadcrumb .fg-menu-prev-list a { float: left; padding-right: .4em; }
-.fg-menu-breadcrumb .fg-menu-prev-list a .ui-icon { float: left; }
-
-.fg-menu-breadcrumb .fg-menu-current-crumb a:link,
-.fg-menu-breadcrumb .fg-menu-current-crumb a:visited,
-.fg-menu-breadcrumb .fg-menu-current-crumb a:hover,
-.fg-menu-breadcrumb .fg-menu-current-crumb a:active { display:block; background-image:none; font-size:1.3em; text-decoration:none; }
-
-
-
-/* REQUIRED LINK STYLES: links are "display:block" by default; if the menu options are split into
- selectable node links and 'next' links, the script floats the node links left and floats the 'next' links to the right */
-
-.fg-menu a:link,
-.fg-menu a:visited,
-.fg-menu a:hover,
-.fg-menu a:active { float:left; width:92%; padding:.3em 3%; text-decoration:none; outline: 0 !important; }
-
-.fg-menu a { border: 1px dashed transparent; }
-
-.fg-menu a.ui-state-default:link,
-.fg-menu a.ui-state-default:visited,
-.fg-menu a.ui-state-default:hover,
-.fg-menu a.ui-state-default:active,
-.fg-menu a.ui-state-hover:link,
-.fg-menu a.ui-state-hover:visited,
-.fg-menu a.ui-state-hover:hover,
-.fg-menu a.ui-state-hover:active,
- .fg-menu a.ui-state-active:link,
- .fg-menu a.ui-state-active:visited,
- .fg-menu a.ui-state-active:hover,
-.fg-menu a.ui-state-active:active { border-style: solid; font-weight: normal; }
-
-.fg-menu a span { display:block; cursor:pointer; }
-
-
- /* SUGGESTED STYLES - for use with jQuery UI Themeroller CSS */
-
-.fg-menu-indicator span { float:left; }
-.fg-menu-indicator span.ui-icon { float:right; }
-
-.fg-menu-content.ui-widget-content,
-.fg-menu-content ul.ui-widget-content { border:0; }
-
-
-/* ICONS AND DIVIDERS */
-
-.fg-menu.fg-menu-has-icons a:link,
-.fg-menu.fg-menu-has-icons a:visited,
-.fg-menu.fg-menu-has-icons a:hover,
-.fg-menu.fg-menu-has-icons a:active { padding-left:20px; }
-
-.fg-menu .horizontal-divider hr, .fg-menu .horizontal-divider span { padding:0; margin:5px .6em; }
-.fg-menu .horizontal-divider hr { border:0; height:1px; }
-.fg-menu .horizontal-divider span { font-size:.9em; text-transform: uppercase; padding-left:.2em; }
-
diff --git a/css/light-grey.css b/css/light-grey.css
index 062946973..f8d1c8e4f 100644
--- a/css/light-grey.css
+++ b/css/light-grey.css
@@ -2840,3 +2840,13 @@ table.listResults .originColor {
#ds_flash {
margin-bottom: 5px;
}
+.menu-icon-select {
+ max-height: 300px;
+ position: absolute;
+ z-index: 201;
+ overflow-x: hidden;
+ overflow-y: auto;
+}
+.menu-icon-select > .ui-menu-item {
+ padding: 0.3em 3%;
+}
diff --git a/css/light-grey.scss b/css/light-grey.scss
index 4c83fa55e..c347d71f9 100644
--- a/css/light-grey.scss
+++ b/css/light-grey.scss
@@ -3230,4 +3230,17 @@ table.listResults .originColor{
//Impact analysis filter
#ds_flash{
margin-bottom: 5px;
+}
+
+/////////
+// Icon select
+.menu-icon-select{
+ max-height : 300px;
+ position : absolute;
+ z-index : 201;
+ overflow-x : hidden;
+ overflow-y : auto;
+}
+.menu-icon-select > .ui-menu-item{
+ padding: .3em 3%;
}
\ No newline at end of file
diff --git a/datamodels/2.x/itop-backup/status.php b/datamodels/2.x/itop-backup/status.php
index 58c3eec6c..b6ccfa4d4 100644
--- a/datamodels/2.x/itop-backup/status.php
+++ b/datamodels/2.x/itop-backup/status.php
@@ -374,7 +374,7 @@ function LaunchRestoreNow(sBackupFile, sConfirmationMessage)
}
else
{
- $('button.restore').attr('disabled', 'disabled');
+ $('button.restore').prop('disabled', true);
$.unblockUI();
}
});
@@ -385,7 +385,7 @@ EOF
if (MetaModel::GetConfig()->Get('demo_mode'))
{
- $oP->add_ready_script("$('button').attr('disabled', 'disabled').attr('title', 'Disabled in demonstration mode')");
+ $oP->add_ready_script("$('button').prop('disabled', true).attr('title', 'Disabled in demonstration mode')");
}
}
catch(Exception $e)
diff --git a/datamodels/2.x/itop-config/config.php b/datamodels/2.x/itop-config/config.php
index 0ea260951..2f981ba4d 100644
--- a/datamodels/2.x/itop-config/config.php
+++ b/datamodels/2.x/itop-config/config.php
@@ -245,8 +245,8 @@ var EditorUtils = (function() {
var updateConfigEditorButtonState = function(editor) {
var isSameContent = (editor.getValue() == $('#prev_config').val());
var hasNoError = $.isEmptyObject(editor.getSession().getAnnotations());
- $('#cancel_button').attr('disabled', isSameContent);
- $('#submit_button').attr('disabled', isSameContent || !hasNoError);
+ $('#cancel_button').prop('disabled', isSameContent);
+ $('#submit_button').prop('disabled', isSameContent || !hasNoError);
};
return {
diff --git a/datamodels/2.x/itop-portal-base/portal/src/views/layout.html.twig b/datamodels/2.x/itop-portal-base/portal/src/views/layout.html.twig
index d9a237208..a63a81eaa 100644
--- a/datamodels/2.x/itop-portal-base/portal/src/views/layout.html.twig
+++ b/datamodels/2.x/itop-portal-base/portal/src/views/layout.html.twig
@@ -79,8 +79,8 @@
{% endblock %}
{% block pPageScripts %}
-
-
+
+
diff --git a/js/datatable.js b/js/datatable.js
index 08a09a19e..27fcf9dd6 100644
--- a/js/datatable.js
+++ b/js/datatable.js
@@ -221,13 +221,13 @@ $(function()
$('#datatable_dlg_'+sListId).find('input[name=scope]').each(function() {
if ($(this).attr('stay-disabled') != 'true')
{
- $(this).removeAttr('disabled');
+ $(this).prop('disabled', false);
}
});
}
else
{
- $('#datatable_dlg_'+sListId).find('input[name=scope]').attr('disabled', 'disabled');
+ $('#datatable_dlg_'+sListId).find('input[name=scope]').prop('disabled', true);
}
},
// events bound via _bind are removed automatically
diff --git a/js/extkeywidget.js b/js/extkeywidget.js
index 6ab23e0cc..9d58634bf 100644
--- a/js/extkeywidget.js
+++ b/js/extkeywidget.js
@@ -35,7 +35,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
this.Init = function()
{
// make sure that the form is clean
- $('#'+this.id+'_btnRemove').prop('disabled','disabled');
+ $('#'+this.id+'_btnRemove').prop('disabled',true);
$('#'+this.id+'_linksToRemove').val('');
};
@@ -142,11 +142,11 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
var okBtn = $('#btn_ok_'+me.id);
if ($('#count_'+me.id).val() > 0)
{
- okBtn.removeAttr('disabled');
+ okBtn.prop('disabled', false);
}
else
{
- okBtn.prop('disabled', 'disabled');
+ okBtn.prop('disabled', true);
}
};
@@ -467,7 +467,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
}
else
{
- $('#label_'+me.id).removeAttr('disabled');
+ $('#label_'+me.id).prop('disabled', false);
$('#label_'+me.id).css({'background': '#fff url(../images/ac-background.gif) no-repeat right'});
$('#mini_add_'+me.id).show();
$('#mini_tree_'+me.id).show();
diff --git a/js/fg.menu.js b/js/fg.menu.js
deleted file mode 100755
index 2c22fc97e..000000000
--- a/js/fg.menu.js
+++ /dev/null
@@ -1,653 +0,0 @@
-/*--------------------------------------------------------------------
-Scripts for creating and manipulating custom menus based on standard markup
-Version: 3.0, 03.31.2009
-
-By: Maggie Costello Wachs (maggie@filamentgroup.com) and Scott Jehl (scott@filamentgroup.com)
- http://www.filamentgroup.com
- * reference articles: http://www.filamentgroup.com/lab/jquery_ipod_style_drilldown_menu/
-
-Copyright (c) 2009 Filament Group
-Dual licensed under the MIT (filamentgroup.com/examples/mit-license.txt) and GPL (filamentgroup.com/examples/gpl-license.txt) licenses.
---------------------------------------------------------------------*/
-
-
-var allUIMenus = [];
-
-$.fn.menu = function(options){
- var caller = this;
- var options = options;
- var m = new Menu(caller, options);
- allUIMenus.push(m);
-
- $(this)
- .mousedown(function(){
- if (!m.menuOpen) { m.showLoading(); };
- })
- .click(function(){
- if (m.menuOpen == false) { m.showMenu(); }
- else { m.kill(); };
- return false;
- });
-};
-
-function Menu(caller, options){
- var menu = this;
- var caller = $(caller);
- var container = $('');
-
- this.menuOpen = false;
- this.menuExists = false;
-
- var options = jQuery.extend({
- content: null,
- width: 180, // width of menu container, must be set or passed in to calculate widths of child menus
- maxHeight: 180, // max height of menu (if a drilldown: height does not include breadcrumb)
- positionOpts: {
- posX: 'left',
- posY: 'bottom',
- offsetX: 0,
- offsetY: 0,
- directionH: 'right',
- directionV: 'down',
- detectH: true, // do horizontal collision detection
- detectV: true, // do vertical collision detection
- linkToFront: false
- },
- showSpeed: 200, // show/hide speed in milliseconds
- callerOnState: 'ui-state-active', // class to change the appearance of the link/button when the menu is showing
- loadingState: 'ui-state-loading', // class added to the link/button while the menu is created
- linkHover: 'ui-state-hover', // class for menu option hover state
- linkHoverSecondary: 'li-hover', // alternate class, may be used for multi-level menus
- // ----- multi-level menu defaults -----
- crossSpeed: 200, // cross-fade speed for multi-level menus
- crumbDefaultText: 'Choose an option:',
- backLink: true, // in the ipod-style menu: instead of breadcrumbs, show only a 'back' link
- backLinkText: 'Back',
- flyOut: false, // multi-level menus are ipod-style by default; this parameter overrides to make a flyout instead
- flyOutOnState: 'ui-state-default',
- nextMenuLink: 'ui-icon-triangle-1-e', // class to style the link (specifically, a span within the link) used in the multi-level menu to show the next level
- topLinkText: 'All',
- nextCrumbLink: 'ui-icon-carat-1-e'
- }, options);
-
- var killAllMenus = function(){
- $.each(allUIMenus, function(i){
- if (allUIMenus[i].menuOpen) { allUIMenus[i].kill(); };
- });
- };
-
- this.kill = function(){
- caller
- .removeClass(options.loadingState)
- .removeClass('fg-menu-open')
- .removeClass(options.callerOnState);
- container.find('li').removeClass(options.linkHoverSecondary).find('a').removeClass(options.linkHover);
- if (options.flyOutOnState) { container.find('li a').removeClass(options.flyOutOnState); };
- if (options.callerOnState) { caller.removeClass(options.callerOnState); };
- if (container.is('.fg-menu-ipod')) { menu.resetDrilldownMenu(); };
- if (container.is('.fg-menu-flyout')) { menu.resetFlyoutMenu(); };
- container.parent().hide();
- menu.menuOpen = false;
- $(document).unbind('click', killAllMenus);
- $(document).unbind('keydown');
- };
-
- this.showLoading = function(){
- caller.addClass(options.loadingState);
- };
-
- this.showMenu = function(){
- killAllMenus();
- if (!menu.menuExists) { menu.create() };
- caller
- .addClass('fg-menu-open')
- .addClass(options.callerOnState);
- container.parent().show().click(function(){ menu.kill(); return false; });
- container.hide().slideDown(options.showSpeed).find('.fg-menu:eq(0)');
- menu.menuOpen = true;
- caller.removeClass(options.loadingState);
- $(document).click(killAllMenus);
-
- // assign key events
- $(document).keydown(function(event){
- var e;
- if (event.which !="") { e = event.which; }
- else if (event.charCode != "") { e = event.charCode; }
- else if (event.keyCode != "") { e = event.keyCode; }
-
- var menuType = ($(event.target).parents('div').is('.fg-menu-flyout')) ? 'flyout' : 'ipod' ;
-
- switch(e) {
- case 37: // left arrow
- if (menuType == 'flyout') {
- $(event.target).trigger('mouseout');
- if ($('.'+options.flyOutOnState).size() > 0) { $('.'+options.flyOutOnState).trigger('mouseover'); };
- };
-
- if (menuType == 'ipod') {
- $(event.target).trigger('mouseout');
- if ($('.fg-menu-footer').find('a').size() > 0) { $('.fg-menu-footer').find('a').trigger('click'); };
- if ($('.fg-menu-header').find('a').size() > 0) { $('.fg-menu-current-crumb').prev().find('a').trigger('click'); };
- if ($('.fg-menu-current').prev().is('.fg-menu-indicator')) {
- $('.fg-menu-current').prev().trigger('mouseover');
- };
- };
- return false;
- break;
-
- case 38: // up arrow
- if ($(event.target).is('.' + options.linkHover)) {
- var prevLink = $(event.target).parent().prev().find('a:eq(0)');
- if (prevLink.size() > 0) {
- $(event.target).trigger('mouseout');
- prevLink.trigger('mouseover');
- };
- }
- else { container.find('a:eq(0)').trigger('mouseover'); }
- return false;
- break;
-
- case 39: // right arrow
- if ($(event.target).is('.fg-menu-indicator')) {
- if (menuType == 'flyout') {
- $(event.target).next().find('a:eq(0)').trigger('mouseover');
- }
- else if (menuType == 'ipod') {
- $(event.target).trigger('click');
- setTimeout(function(){
- $(event.target).next().find('a:eq(0)').trigger('mouseover');
- }, options.crossSpeed);
- };
- };
- return false;
- break;
-
- case 40: // down arrow
- if ($(event.target).is('.' + options.linkHover)) {
- var nextLink = $(event.target).parent().next().find('a:eq(0)');
- if (nextLink.size() > 0) {
- $(event.target).trigger('mouseout');
- nextLink.trigger('mouseover');
- };
- }
- else { container.find('a:eq(0)').trigger('mouseover'); }
- return false;
- break;
-
- case 27: // escape
- killAllMenus();
- break;
-
- case 13: // enter
- if ($(event.target).is('.fg-menu-indicator') && menuType == 'ipod') {
- $(event.target).trigger('click');
- setTimeout(function(){
- $(event.target).next().find('a:eq(0)').trigger('mouseover');
- }, options.crossSpeed);
- };
- break;
- };
- });
- };
-
- this.create = function(){
- container.css({ width: options.width, 'max-height': options.maxHeight, 'overflow': 'auto' }).appendTo('body').find('ul:first').not('.fg-menu-breadcrumb').addClass('fg-menu');
- container.find('ul, li a').addClass('ui-corner-all');
-
- // aria roles & attributes
- container.find('ul').attr('role', 'menu').eq(0).attr('aria-activedescendant','active-menuitem').attr('aria-labelledby', caller.attr('id'));
- container.find('li').attr('role', 'menuitem');
- container.find('li:has(ul)').attr('aria-haspopup', 'true').find('ul').attr('aria-expanded', 'false');
- container.find('a').attr('tabindex', '-1');
-
- // when there are multiple levels of hierarchy, create flyout or drilldown menu
- if (container.find('ul').size() > 1) {
- if (options.flyOut) { menu.flyout(container, options); }
- else { menu.drilldown(container, options); }
- }
- else {
- container.find('a').click(function(){
- menu.chooseItem(this);
- return false;
- });
- };
-
- if (options.linkHover) {
- var allLinks = container.find('.fg-menu li a');
- allLinks.hover(
- function(){
- var menuitem = $(this);
- $('.'+options.linkHover).removeClass(options.linkHover).blur().parent().removeAttr('id');
- $(this).addClass(options.linkHover).focus().parent().attr('id','active-menuitem');
- },
- function(){
- $(this).removeClass(options.linkHover).blur().parent().removeAttr('id');
- }
- );
- };
-
- if (options.linkHoverSecondary) {
- container.find('.fg-menu li').hover(
- function(){
- $(this).siblings('li').removeClass(options.linkHoverSecondary);
- if (options.flyOutOnState) { $(this).siblings('li').find('a').removeClass(options.flyOutOnState); }
- $(this).addClass(options.linkHoverSecondary);
- },
- function(){ $(this).removeClass(options.linkHoverSecondary); }
- );
- };
-
- menu.setPosition(container, caller, options);
- menu.menuExists = true;
- };
-
- this.chooseItem = function(item){
- menu.kill();
- if (options.callback)
- {
- options.callback({item: $(item), text: $(item).text() })
- }
- };
-};
-
-Menu.prototype.flyout = function(container, options) {
- var menu = this;
-
- this.resetFlyoutMenu = function(){
- var allLists = container.find('ul ul');
- allLists.removeClass('ui-widget-content').hide();
- };
-
- container.addClass('fg-menu-flyout').find('li:has(ul)').each(function(){
- var linkWidth = container.width();
- var showTimer, hideTimer;
- var allSubLists = $(this).find('ul');
-
- allSubLists.css({ left: linkWidth, width: linkWidth }).hide();
-
- $(this).find('a:eq(0)').addClass('fg-menu-indicator').html('' + $(this).find('a:eq(0)').text() + '').hover(
- function(){
- clearTimeout(hideTimer);
- var subList = $(this).next();
- if (!fitVertical(subList, $(this).offset().top)) { subList.css({ top: 'auto', bottom: 0 }); };
- if (!fitHorizontal(subList, $(this).offset().left + 100)) { subList.css({ left: 'auto', right: linkWidth, 'z-index': 999 }); };
- showTimer = setTimeout(function(){
- subList.addClass('ui-widget-content').show(options.showSpeed).attr('aria-expanded', 'true');
- }, 300);
- },
- function(){
- clearTimeout(showTimer);
- var subList = $(this).next();
- hideTimer = setTimeout(function(){
- subList.removeClass('ui-widget-content').hide(options.showSpeed).attr('aria-expanded', 'false');
- }, 400);
- }
- );
-
- $(this).find('ul a').hover(
- function(){
- clearTimeout(hideTimer);
- if ($(this).parents('ul').prev().is('a.fg-menu-indicator')) {
- $(this).parents('ul').prev().addClass(options.flyOutOnState);
- }
- },
- function(){
- hideTimer = setTimeout(function(){
- allSubLists.hide(options.showSpeed);
- container.find(options.flyOutOnState).removeClass(options.flyOutOnState);
- }, 500);
- }
- );
- });
-
- container.find('a').click(function(){
- menu.chooseItem(this);
- return false;
- });
-};
-
-
-Menu.prototype.drilldown = function(container, options) {
- var menu = this;
- var topList = container.find('.fg-menu');
- var breadcrumb = $('');
- var crumbDefaultHeader = $('');
- var firstCrumbText = (options.backLink) ? options.backLinkText : options.topLinkText;
- var firstCrumbClass = (options.backLink) ? 'fg-menu-prev-list' : 'fg-menu-all-lists';
- var firstCrumbLinkClass = (options.backLink) ? 'ui-state-default ui-corner-all' : '';
- var firstCrumbIcon = (options.backLink) ? '' : '';
- var firstCrumb = $('- '+firstCrumbIcon+firstCrumbText+'
');
-
- container.addClass('fg-menu-ipod');
-
- if (options.backLink) { breadcrumb.addClass('fg-menu-footer').appendTo(container).hide(); }
- else { breadcrumb.addClass('fg-menu-header').prependTo(container); };
- breadcrumb.append(crumbDefaultHeader);
-
- var checkMenuHeight = function(el){
- if (el.height() > options.maxHeight) { el.addClass('fg-menu-scroll') };
- el.css({ height: options.maxHeight });
- };
-
- var resetChildMenu = function(el){ el.removeClass('fg-menu-scroll').removeClass('fg-menu-current').height('auto'); };
-
- this.resetDrilldownMenu = function(){
- $('.fg-menu-current').removeClass('fg-menu-current');
- topList.animate({ left: 0 }, options.crossSpeed, function(){
- $(this).find('ul').each(function(){
- $(this).hide();
- resetChildMenu($(this));
- });
- topList.addClass('fg-menu-current');
- });
- $('.fg-menu-all-lists').find('span').remove();
- breadcrumb.empty().append(crumbDefaultHeader);
- $('.fg-menu-footer').empty().hide();
- checkMenuHeight(topList);
- };
-
- topList
- .addClass('fg-menu-content fg-menu-current ui-widget-content ui-helper-clearfix')
- .css({ width: container.width() })
- .find('ul')
- .css({ width: container.width(), left: container.width() })
- .addClass('ui-widget-content')
- .hide();
- checkMenuHeight(topList);
-
- topList.find('a').each(function(){
- // if the link opens a child menu:
- if ($(this).next().is('ul')) {
- $(this)
- .addClass('fg-menu-indicator')
- .each(function(){ $(this).html('' + $(this).text() + ''); })
- .click(function(){ // ----- show the next menu
- var nextList = $(this).next();
- var parentUl = $(this).parents('ul:eq(0)');
- var parentLeft = (parentUl.is('.fg-menu-content')) ? 0 : parseFloat(topList.css('left'));
- var nextLeftVal = Math.round(parentLeft - parseFloat(container.width()));
- var footer = $('.fg-menu-footer');
-
- // show next menu
- resetChildMenu(parentUl);
- checkMenuHeight(nextList);
- topList.animate({ left: nextLeftVal }, options.crossSpeed);
- nextList.show().addClass('fg-menu-current').attr('aria-expanded', 'true');
-
- var setPrevMenu = function(backlink){
- var b = backlink;
- var c = $('.fg-menu-current');
- var prevList = c.parents('ul:eq(0)');
- c.hide().attr('aria-expanded', 'false');
- resetChildMenu(c);
- checkMenuHeight(prevList);
- prevList.addClass('fg-menu-current').attr('aria-expanded', 'true');
- if (prevList.hasClass('fg-menu-content')) { b.remove(); footer.hide(); };
- };
-
- // initialize "back" link
- if (options.backLink) {
- if (footer.find('a').size() == 0) {
- footer.show();
- $(' Back')
- .appendTo(footer)
- .click(function(){ // ----- show the previous menu
- var b = $(this);
- var prevLeftVal = parseFloat(topList.css('left')) + container.width();
- topList.animate({ left: prevLeftVal }, options.crossSpeed, function(){
- setPrevMenu(b);
- });
- return false;
- });
- }
- }
- // or initialize top breadcrumb
- else {
- if (breadcrumb.find('li').size() == 1){
- breadcrumb.empty().append(firstCrumb);
- firstCrumb.find('a').click(function(){
- menu.resetDrilldownMenu();
- return false;
- });
- }
- $('.fg-menu-current-crumb').removeClass('fg-menu-current-crumb');
- var crumbText = $(this).find('span:eq(0)').text();
- var newCrumb = $('');
- newCrumb
- .appendTo(breadcrumb)
- .find('a').click(function(){
- if ($(this).parent().is('.fg-menu-current-crumb')){
- menu.chooseItem(this);
- }
- else {
- var newLeftVal = - ($('.fg-menu-current').parents('ul').size() - 1) * 180;
- topList.animate({ left: newLeftVal }, options.crossSpeed, function(){
- setPrevMenu();
- });
-
- // make this the current crumb, delete all breadcrumbs after this one, and navigate to the relevant menu
- $(this).parent().addClass('fg-menu-current-crumb').find('span').remove();
- $(this).parent().nextAll().remove();
- };
- return false;
- });
- newCrumb.prev().append(' ');
- };
- return false;
- });
- }
- // if the link is a leaf node (doesn't open a child menu)
- else {
- $(this).click(function(){
- menu.chooseItem(this);
- return false;
- });
- };
- });
-};
-
-
-/* Menu.prototype.setPosition parameters (defaults noted with *):
- referrer = the link (or other element) used to show the overlaid object
- settings = can override the defaults:
- - posX/Y: where the top left corner of the object should be positioned in relation to its referrer.
- X: left*, center, right
- Y: top, center, bottom*
- - offsetX/Y: the number of pixels to be offset from the x or y position. Can be a positive or negative number.
- - directionH/V: where the entire menu should appear in relation to its referrer.
- Horizontal: left*, right
- Vertical: up, down*
- - detectH/V: detect the viewport horizontally / vertically
- - linkToFront: copy the menu link and place it on top of the menu (visual effect to make it look like it overlaps the object) */
-
-Menu.prototype.setPosition = function(widget, caller, options) {
- var el = widget;
- var referrer = caller;
- var dims = {
- refX: referrer.offset().left,
- refY: referrer.offset().top,
- refW: referrer.getTotalWidth(),
- refH: referrer.getTotalHeight()
- };
- var options = options;
- var xVal, yVal;
-
- var helper = $('');
- helper.css({ position: 'absolute', left: dims.refX, top: dims.refY, width: dims.refW, height: dims.refH });
- el.wrap(helper);
-
- // get X pos
- switch(options.positionOpts.posX) {
- case 'left': xVal = 0;
- break;
- case 'center': xVal = dims.refW / 2;
- break;
- case 'right': xVal = dims.refW;
- break;
- };
-
- // get Y pos
- switch(options.positionOpts.posY) {
- case 'top': yVal = 0;
- break;
- case 'center': yVal = dims.refH / 2;
- break;
- case 'bottom': yVal = dims.refH;
- break;
- };
-
- // add the offsets (zero by default)
- xVal += options.positionOpts.offsetX;
- yVal += options.positionOpts.offsetY;
-
- // position the object vertically
- if (options.positionOpts.directionV == 'up') {
- el.css({ top: 'auto', bottom: yVal });
- if (options.positionOpts.detectV && !fitVertical(el)) {
- el.css({ bottom: 'auto', top: yVal });
- }
- }
- else {
- el.css({ bottom: 'auto', top: yVal });
- if (options.positionOpts.detectV && !fitVertical(el)) {
- el.css({ top: 'auto', bottom: yVal });
- }
- };
-
- // and horizontally
- if (options.positionOpts.directionH == 'left') {
- el.css({ left: 'auto', right: xVal });
- if (options.positionOpts.detectH && !fitHorizontal(el)) {
- el.css({ right: 'auto', left: xVal });
- }
- }
- else {
- el.css({ right: 'auto', left: xVal });
- if (options.positionOpts.detectH && !fitHorizontal(el)) {
- el.css({ left: 'auto', right: xVal });
- }
- };
-
- // if specified, clone the referring element and position it so that it appears on top of the menu
- if (options.positionOpts.linkToFront) {
- referrer.clone().addClass('linkClone').css({
- position: 'absolute',
- top: 0,
- right: 'auto',
- bottom: 'auto',
- left: 0,
- width: referrer.width(),
- height: referrer.height()
- }).insertAfter(el);
- };
-};
-
-
-/* Utilities to sort and find viewport dimensions */
-
-function sortBigToSmall(a, b) { return b - a; };
-
-jQuery.fn.getTotalWidth = function(){
- return $(this).width() + parseInt($(this).css('paddingRight')) + parseInt($(this).css('paddingLeft')) + parseInt($(this).css('borderRightWidth')) + parseInt($(this).css('borderLeftWidth'));
-};
-
-jQuery.fn.getTotalHeight = function(){
- return $(this).height() + parseInt($(this).css('paddingTop')) + parseInt($(this).css('paddingBottom')) + parseInt($(this).css('borderTopWidth')) + parseInt($(this).css('borderBottomWidth'));
-};
-
-function getScrollTop(){
- return self.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
-};
-
-function getScrollLeft(){
- return self.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;
-};
-
-function getWindowHeight(){
- var de = document.documentElement;
- return self.innerHeight || (de && de.clientHeight) || document.body.clientHeight;
-};
-
-function getWindowWidth(){
- var de = document.documentElement;
- return self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
-};
-
-/* Utilities to test whether an element will fit in the viewport
- Parameters:
- el = element to position, required
- leftOffset / topOffset = optional parameter if the offset cannot be calculated (i.e., if the object is in the DOM but is set to display: 'none') */
-
-function fitHorizontal(el, leftOffset){
- var leftVal = parseInt(leftOffset) || $(el).offset().left;
- return (leftVal + $(el).width() <= getWindowWidth() + getScrollLeft() && leftVal - getScrollLeft() >= 0);
-};
-
-function fitVertical(el, topOffset){
- var topVal = parseInt(topOffset) || $(el).offset().top;
- return (topVal + $(el).height() <= getWindowHeight() + getScrollTop() && topVal - getScrollTop() >= 0);
-};
-
-/*--------------------------------------------------------------------
- * javascript method: "pxToEm"
- * by:
- Scott Jehl (scott@filamentgroup.com)
- Maggie Wachs (maggie@filamentgroup.com)
- http://www.filamentgroup.com
- *
- * Copyright (c) 2008 Filament Group
- * Dual licensed under the MIT (filamentgroup.com/examples/mit-license.txt) and GPL (filamentgroup.com/examples/gpl-license.txt) licenses.
- *
- * Description: Extends the native Number and String objects with pxToEm method. pxToEm converts a pixel value to ems depending on inherited font size.
- * Article: http://www.filamentgroup.com/lab/retaining_scalable_interfaces_with_pixel_to_em_conversion/
- * Demo: http://www.filamentgroup.com/examples/pxToEm/
- *
- * Options:
- scope: string or jQuery selector for font-size scoping
- reverse: Boolean, true reverses the conversion to em-px
- * Dependencies: jQuery library
- * Usage Example: myPixelValue.pxToEm(); or myPixelValue.pxToEm({'scope':'#navigation', reverse: true});
- *
- * Version: 2.0, 08.01.2008
- * Changelog:
- * 08.02.2007 initial Version 1.0
- * 08.01.2008 - fixed font-size calculation for IE
---------------------------------------------------------------------*/
-
-Number.prototype.pxToEm = String.prototype.pxToEm = function(settings){
- //set defaults
- settings = jQuery.extend({
- scope: 'body',
- reverse: false
- }, settings);
-
- var pxVal = (this == '') ? 0 : parseFloat(this);
- var scopeVal;
- var getWindowWidth = function(){
- var de = document.documentElement;
- return self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
- };
-
- /* When a percentage-based font-size is set on the body, IE returns that percent of the window width as the font-size.
- For example, if the body font-size is 62.5% and the window width is 1000px, IE will return 625px as the font-size.
- When this happens, we calculate the correct body font-size (%) and multiply it by 16 (the standard browser font size)
- to get an accurate em value. */
-
- if (settings.scope == 'body' && $.browser.msie && (parseFloat($('body').css('font-size')) / getWindowWidth()).toFixed(1) > 0.0) {
- var calcFontSize = function(){
- return (parseFloat($('body').css('font-size'))/getWindowWidth()).toFixed(3) * 16;
- };
- scopeVal = calcFontSize();
- }
- else { scopeVal = parseFloat(jQuery(settings.scope).css("font-size")); };
-
- var result = (settings.reverse == true) ? (pxVal * scopeVal).toFixed(2) + 'px' : (pxVal / scopeVal).toFixed(2) + 'em';
- return result;
-};
-
-function KillAllMenus()
-{
- $.each(allUIMenus, function(i){
- if (allUIMenus[i].menuOpen) { allUIMenus[i].kill(); };
- });
-};
\ No newline at end of file
diff --git a/js/field_sorter.js b/js/field_sorter.js
index a71d0f5a3..733756978 100644
--- a/js/field_sorter.js
+++ b/js/field_sorter.js
@@ -121,8 +121,8 @@ $(function()
$(this).removeClass('selected');
}
});
- this.moveup_btn.removeAttr('disabled');
- this.movedown_btn.removeAttr('disabled');
+ this.moveup_btn.prop('disabled', false);
+ this.movedown_btn.prop('disabled', false);
},
_moveUp: function()
{
diff --git a/js/forms-json-utils.js b/js/forms-json-utils.js
index f00e37385..75c379245 100644
--- a/js/forms-json-utils.js
+++ b/js/forms-json-utils.js
@@ -138,8 +138,8 @@ var oFormErrors = { err_form0: 0 };
function CheckFields(sFormId, bDisplayAlert)
{
- $('#'+sFormId+' :submit').attr('disable', 'disabled');
- $('#'+sFormId+' :button[type=submit]').attr('disable', 'disabled');
+ $('#'+sFormId+' :submit').prop('disable', true);
+ $('#'+sFormId+' :button[type=submit]').prop('disable', true);
firstErrorId = '';
// The two 'fields' below will be updated when the 'validate' event is processed
@@ -156,8 +156,8 @@ function CheckFields(sFormId, bDisplayAlert)
{
alert(Dict.S('UI:FillAllMandatoryFields'));
}
- $('#'+sFormId+' :submit').attr('disable', '');
- $('#'+sFormId+' :button[type=submit]').attr('disable', '');
+ $('#'+sFormId+' :submit').prop('disable', false);
+ $('#'+sFormId+' :button[type=submit]').prop('disable', false);
if (oFormErrors['input_'+sFormId] != null)
{
$('#'+oFormErrors['input_'+sFormId]).focus();
@@ -198,7 +198,7 @@ function ValidateField(sFieldId, sPattern, bMandatory, sFormId, nullValue, origi
{
var bValid = true;
var sExplain = '';
- if ($('#'+sFieldId).attr('disabled'))
+ if ($('#'+sFieldId).prop('disabled'))
{
bValid = true; // disabled fields are not checked
}
@@ -251,7 +251,7 @@ function ValidateCKEditField(sFieldId, sPattern, bMandatory, sFormId, nullValue,
var sExplain = '';
var sTextContent;
- if ($('#'+sFieldId).attr('disabled'))
+ if ($('#'+sFieldId).prop('disabled'))
{
bValid = true; // disabled fields are not checked
}
@@ -382,7 +382,7 @@ function ValidateCaseLogField(sFieldId, bMandatory, sFormId, nullValue, original
var sExplain = '';
var sTextContent;
- if ($('#'+sFieldId).attr('disabled'))
+ if ($('#'+sFieldId).prop('disabled'))
{
bValid = true; // disabled fields are not checked
}
diff --git a/js/icon_select.js b/js/icon_select.js
index 413a403d2..b71eeb453 100644
--- a/js/icon_select.js
+++ b/js/icon_select.js
@@ -13,7 +13,17 @@ $(function()
labels: {cancel: 'Cancel', pick_icon_file: 'Select an icon file to upload:', upload_dlg_title: 'Icon Upload...', upload: 'Upload...'},
post_upload_to: null
},
-
+
+ menus : [],
+
+ _cleanAllMenus()
+ {
+ var me = this;
+ $.each(this.menus, function(i){
+ me._cleanMenu(me.menus[i]);
+ });
+ },
+
// the constructor
_create: function()
{
@@ -36,7 +46,11 @@ $(function()
this.oLabel = $(''+sLabel+'');
this.oButton = $('');
this.oButton.prepend(this.oLabel).prepend(this.oImg);
- this.oButton.click(function(event, ui) { me._on_button_clicked(event, ui); });
+ this.oButton.click(function(event, ui) {
+ //me._cleanAllMenus();
+ me._on_button_clicked(event, ui);
+ event.stopPropagation();
+ });
this.element.after(this.oButton);
this.element.addClass( "itop-icon-select" ).button();
this.element.bind( "reverted.itop-icon-select", function(ev, data) {
@@ -69,6 +83,7 @@ $(function()
// called when created, and later when changing options
_refresh: function()
{
+ this._cleanAllMenus();
if (!this.element.parent().is(':visible'))
{
this.options.offsetX = null; // Menu needs to be reconstructed when the button becomes visible
@@ -87,23 +102,43 @@ $(function()
_create_menu: function()
{
var me = this;
- var sMenu = '';
+ $(document).on('click', function(){
+ me._cleanAllMenus();
+ });
+ var oMenu =
+ $('