# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: moodle/lib/formslib.php
--- moodle/lib/formslib.php Base (1.206)
+++ moodle/lib/formslib.php Locally Modified (Based On 1.206)
@@ -1354,6 +1354,8 @@
             $linktext = isset($buttonargs[3]) ? $buttonargs[3] : false;
 
             $element->_helpbutton = $OUTPUT->old_help_icon($page, $text, $module, $linktext);
+            //$OUTPUT->help_icon($identifier, $component, $linktext);
+            // $OUTPUT->help_icon($elementname, $module); // this is works
 
         } else if (!$suppresscheck) {
             print_error('nonexistentformelements', 'form', '', $elementname);
Index: moodle/lib/javascript-static.js
--- moodle/lib/javascript-static.js Base (1.141)
+++ moodle/lib/javascript-static.js Locally Modified (Based On 1.141)
@@ -1218,9 +1218,12 @@
 }
 
 function openpopup(event, args) {
-
     YAHOO.util.Event.preventDefault(event);
 
+    if (M.help_content.instance !== null) {       
+        var id = '#' + args.id;        
+        M.help_content.instance.load_from_openpopup(event, args);//event.target);
+    } else {        
     var fullurl = args.url;
     if (!args.url.match(/https?:\/\//)) {
         fullurl = M.cfg.wwwroot + args.url;
@@ -1236,6 +1239,7 @@
     windowobj.focus();
     return false;
 }
+}
 
 /* This is only used on a few help pages. */
 emoticons_help = {
@@ -1460,3 +1464,117 @@
         item.style.display = "none";
     }
 }
+
+M.help_content = {
+    instance : null,
+    init : function(Y) {        
+        YUI().use('overlay', 'io', 'event-mouseenter', 'node', "*", function(Y) {
+
+            var help_content_overlay = {
+                overlay : null,
+                init : function() {
+                    var xy = Y.one('#helpcontent').getXY(); 
+
+                    // Create an overlay from markup
+                    this.overlay = new Y.Overlay({
+                        srcNode : "#helpcontent",
+                        contentBox: '#helpcontent',
+                        width:"30em",
+                        xy:[xy[0] + 200, xy[1] + 300]
+                    });
+                    this.overlay.render();
+                    this.overlay.hide();
+
+                    Y.on("click", Y.bind(this.overlay.show, this.overlay), "#show");
+                    Y.on("click", Y.bind(this.overlay.hide, this.overlay), "#hide");
+                    
+                    var menuButton = Y.one(".helplink"),
+                    overlaycontent = this;
+
+                    var boundingBox = this.overlay.get("boundingBox");
+
+                    //  Hide the menu if the user clicks outside of its content 
+                    boundingBox.get("ownerDocument").on("mousedown", function (event) {
+                        var oTarget = event.target;
+
+                        if (!oTarget.compareTo(menuButton) &&
+                            !menuButton.contains(oTarget) &&
+                            !oTarget.compareTo(boundingBox) &&
+                            !boundingBox.contains(oTarget)) {
+                            overlaycontent.overlay.hide();
+                        }
+                    });                    
+                },
+                
+                load_from_openpopup : function(event, node) {
+                    var spinner = document.createElement('img');
+                    spinner.src = M.cfg.loadingicon;
+                    this.overlay.set('bodyContent', spinner);
+
+                    var positionX = 0;
+                    var positionY = 0;
+
+                    if (event.pageX) {
+                        positionX = event.pageX + 10;
+                        positionY = event.pageY + 5;
+                    } else {
+                        positionX = document.getElementById(node['id']).offsetLeft + 55;
+                        positionY = document.getElementById(node['id']).offsetTop + 100;
+                    }
+                    
+                    if (Y.UA.chrome) {
+                        positionX += 75;
+                        positionY += 20;
+                    }
+
+                    if (document.getElementById('page').offsetWidth <= positionX+30) {
+                        positionX -= 200;
+                    }
+                    this.overlay.set('x', positionX);
+                    this.overlay.set('y', positionY);
+                    //menuButton.set("tabIndex", 0);
+                    
+                    var fullurl = node.url;
+                    if (!node.url.match(/https?:\/\//)) {
+                        fullurl = M.cfg.wwwroot + node.url;
+                    }
+                    
+                    var ajaxurl = fullurl + '&ajax=1';
+                    thishelpcontent = this;
+                    
+                    var cfg = {
+                        method: 'get',
+                        on: {
+                            success: function(id, o, node) {
+                                thishelpcontent.load_from_openpopup_callback(o.responseText);                                
+                            },
+                            failure: function(id, o, node) {
+                                var debuginfo = o.statusText;
+                                if (M.cfg.developerdebug) {
+                                    o.statusText += ' (' + ajaxurl + ')';
+                                }                                
+                                thishelpcontent.load_from_openpopup_callback('bodyContent',debuginfo);
+                            }
+                        }
+                    };
+                    
+                    var conn = Y.io(ajaxurl, cfg);
+                    this.overlay.show();
+                },
+                
+                load_from_openpopup_callback : function(content) {                                                            
+                    this.overlay.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
+                },
+                
+                hideContent : function() {
+                    help = this;
+                    help.overlay.hide();
+                }
+                
+            }
+            help_content_overlay.init();
+            M.help_content.instance = help_content_overlay;
+            
+        });
+    }
+}
Index: moodle/lib/outputrenderers.php
--- moodle/lib/outputrenderers.php Base (1.187)
+++ moodle/lib/outputrenderers.php Locally Modified (Based On 1.187)
@@ -623,6 +623,10 @@
 
         $output = $this->container_end_all(true);
 
+        $helpcontent_body = html_writer::tag('div',  '<button class="closehelpbutton" type="button" id="hide"><img src="'.$this->pix_url('t/delete').'" alt="close" /></button>', array('class'=>'helpcontent_body'));
+        $output .= html_writer::tag('div', $helpcontent_body, array('id'=>'helpcontent', 'class'=>'yui3-overlay-loading'));       
+        $this->page->requires->js_init_call('M.help_content.init');
+        
         $footer = $this->opencontainers->pop('header/footer');
 
         if (debugging() and $DB and $DB->is_transaction_started()) {
@@ -740,6 +744,8 @@
             $skipdest = html_writer::tag('span', '', array('id' => 'sb-' . $bc->skipid, 'class' => 'skip-block-to'));
         }
 
+        //$bc->attributes['id'] = $bc->id;
+        //$bc->attributes['class'] = $bc->get_classes_string();
         $output .= html_writer::start_tag('div', $bc->attributes);
 
         $controlshtml = $this->block_controls($bc->controls);
@@ -1460,7 +1466,7 @@
         $attributes = array('href'=>$url, 'title'=>$title);
         $id = html_writer::random_id('helpicon');
         $attributes['id'] = $id;
-        $this->add_action_handler(new popup_action('click', $url), $id);
+        $this->add_action_handler(new popup_action('click', $url, 'popup', array('id'=>$id)), $id);
         $output = html_writer::tag('a', $output, $attributes);
 
         // and finally span
@@ -1523,7 +1529,7 @@
         $attributes = array('href'=>$url, 'title'=>$title);
         $id = html_writer::random_id('helpicon');
         $attributes['id'] = $id;
-        $this->add_action_handler(new popup_action('click', $url), $id);
+        $this->add_action_handler(new popup_action('click', $url, 'popup', array('id'=>$id)), $id);
         $output = html_writer::tag('a', $output, $attributes);
 
         // and finally span
Index: moodle/lib/outputrequirementslib.php
--- moodle/lib/outputrequirementslib.php Base (1.23)
+++ moodle/lib/outputrequirementslib.php Locally Modified (Based On 1.23)
@@ -249,8 +249,8 @@
         $this->string_for_js('confirmation', 'admin');
         $this->string_for_js('cancel', 'moodle');
         $this->string_for_js('yes', 'moodle');
-        $this->js_init_call('M.util.init_help_icons');
 
+
         if ($page->pagelayout === 'frametop') {
             $this->js_init_call('M.util.init_frametop');
         }
Index: moodle/theme/base/style/core.css
--- moodle/theme/base/style/core.css Base (1.18)
+++ moodle/theme/base/style/core.css Locally Modified (Based On 1.18)
@@ -534,3 +534,9 @@
  * Web Service
  */
 #webservice-doc-generator td {text-align: left;border: 0px solid black;}
+#helpcontent{ float: none; clear: both; border: 3px solid #000; background-color: #FFF; z-index: 10; }
+#show { margin-left:5px; padding:0; }
+#hide { float: right; }
+.closehelpbutton { border: none; background: none; }
+.yui3-js-enabled .yui3-overlay-loading { top:-1000em; left:-1000em; position:absolute; display: none; }
+.yui3-overlay-content { padding:3px; border:10px solid red; background-color:red; -moz-border-radius:5px; font-size:.95em; }
