[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 M.core_message = M.core_message || {}; 2 3 M.core_message.init_focus = function(Y, eid) { 4 document.getElementById(eid).focus(); 5 }; 6 7 M.core_message.init_refresh_page = function(Y, delay, url) { 8 var delay_callback = function() { 9 document.location.replace(url); 10 }; 11 setTimeout(delay_callback, delay); 12 }; 13 14 M.core_message.combinedsearchgotfocus = function(e) { 15 if (e.target.get('value')==this.defaultsearchterm) { 16 e.target.select(); 17 } 18 }; 19 20 M.core_message.init_notification = function(Y, title, content, url) { 21 Y.use('overlay', function() { 22 var o = new Y.Overlay({ 23 headerContent : title, 24 bodyContent : content 25 }); 26 o.render(Y.one(document.body)); 27 28 if (Y.UA.ie > 0 && Y.UA.ie < 7) { 29 // Adjust for IE 6 (can't handle fixed pos) 30 //align the bottom right corner of the overlay with the bottom right of the viewport 31 o.set("align", { 32 points:[Y.WidgetPositionAlign.BR, Y.WidgetPositionAlign.BR] 33 }); 34 } 35 36 Y.one('#notificationyes').on('click', function(e) { 37 window.location.href = url; 38 }, o); 39 Y.one('#notificationno').on('click', function(e) { 40 o.hide(); 41 e.preventDefault(); 42 return false; 43 }, o); 44 }); 45 }; 46 47 M.core_message.init_defaultoutputs = function(Y) { 48 var defaultoutputs = { 49 50 init : function() { 51 Y.all('#defaultmessageoutputs select').each(function(node) { 52 // attach event listener 53 node.on('change', defaultoutputs.changeState); 54 // set initial layout 55 node.simulate("change"); 56 }, this); 57 58 Y.all('#defaultmessageoutputs input.messagedisable').each(function(node) { 59 // Attach event listener 60 node.on('change', defaultoutputs.changeProviderState); 61 node.simulate("change"); 62 }, this); 63 }, 64 65 changeState : function(e) { 66 var value = e.target._node.options[e.target.get('selectedIndex')].value; 67 var parentnode = e.target.ancestor('td'); 68 switch (value) { 69 case 'forced': 70 defaultoutputs.updateCheckboxes(parentnode, 1, 1); 71 break; 72 case 'disallowed': 73 defaultoutputs.updateCheckboxes(parentnode, 1, 0); 74 break; 75 case 'permitted': 76 defaultoutputs.updateCheckboxes(parentnode, 0, 0); 77 break; 78 } 79 }, 80 81 updateCheckboxes : function(blocknode, disabled, checked) { 82 blocknode.all('input[type=checkbox]').each(function(node) { 83 node.removeAttribute('disabled'); 84 if (disabled) { 85 node.setAttribute('disabled', 1) 86 node.removeAttribute('checked'); 87 } 88 if (checked) { 89 node.setAttribute('checked', 1) 90 } 91 }, this); 92 }, 93 94 changeProviderState : function(e) { 95 var isenabled = e.target.get('checked') || undefined; 96 var parentnode = e.target.ancestor('tr'); 97 if (!isenabled) { 98 parentnode.all('select').each(function(node) { 99 node.set('value', 'disallowed'); 100 node.setAttribute('disabled', 1); 101 defaultoutputs.updateCheckboxes(node.ancestor('td'), 1, 0); 102 }, this); 103 parentnode.addClass('dimmed_text'); 104 } else { 105 parentnode.all('select[disabled]').each(function(node) { 106 node.removeAttribute('disabled'); 107 node.set('value', 'permitted'); 108 defaultoutputs.updateCheckboxes(node.ancestor('td'), 0, 0); 109 }, this); 110 parentnode.removeClass('dimmed_text'); 111 } 112 } 113 } 114 115 defaultoutputs.init(); 116 } 117 118 M.core_message.init_editsettings = function(Y) { 119 var editsettings = { 120 121 init : function() { 122 var disableall = Y.one(".disableallcheckbox"); 123 disableall.on('change', editsettings.changeState); 124 disableall.simulate("change"); 125 }, 126 127 changeState : function(e) { 128 Y.all('.notificationpreference').each(function(node) { 129 var disabled = e.target.get('checked'); 130 131 node.removeAttribute('disabled'); 132 if (disabled) { 133 node.setAttribute('disabled', 1) 134 } 135 }, this); 136 } 137 } 138 139 editsettings.init(); 140 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |