_binary From cb3550e59221561c1237fe31c302521ae9013459 Mon Sep 17 00:00:00 2001
From: epinapala <epinapala@ebay.com>
Date: Sat, 18 Oct 2014 13:55:45 -0700
Subject: [PATCH 1/2]  Made all suggested changes by Professor, See a summary
 below: (1) basic.js is not allowed to have hard-coded constants or make use
 of PHP. X (2) You are using 8 spaces rather than 4 spaces for tabbing on code
 you introduced in basic.js. X (3) Although I said to put renderHelpButton in
 View, you should instead make a Helper subclass. That way your code isn't
 loaded every time any view is made (even on those pages that don't have
 wiki-help). (4) I still can't get any wiki help pages to work. I just get
 data equal null errors in the Javascript console when I set the group id to
 be of an existing group.X (5) The word Edit is hard-coded and not localizable
 in displayHelpForId. (6) The point of the square brackets around Edit is
 accessibility. But you put them as part of the link text rather than outside
 the link text which defeats their purpose.X (7) Don't have global uses of
 anonymous function definitions like you did for the function get in basic.js.
 Make it match the other function definitions in basic.jsX (8) The function
 name get is too vague and non-specific. There is already a getPage function
 in basic.js. Your code seems to be adding some functionality related to it,
 so maybe call it getPageWithCallback.X (9) Output html should be XHTML 5. So
 you can't write things like <hr>. Instead it should be <hr />X (10) Each
 parameter or return value in a comment needs a short description next to it.X
 (11) target_c --> target_controller (no abbreviations in variable names)X
 (12) {type} as the type is too vague.X (13) Don't use braces around types.
 Write String not {String}.X (14) Javascript has a Function object type, it
 does not have a function type.X (15) @returns --> @returnX

---
 scripts/basic.js                        | 278 ++++++++++++++++----------------
 views/elements/element.php              |   2 +-
 views/elements/managegroups_element.php |   2 +-
 3 files changed, 142 insertions(+), 140 deletions(-)

diff --git a/scripts/basic.js b/scripts/basic.js
index 27e81dd..9febc8a 100755
--- a/scripts/basic.js
+++ b/scripts/basic.js
@@ -180,22 +180,22 @@ function toggleDisplay(id)
     }
     obj.style.display = value;
 }
-
 current_activity_closed = true;
 current_activity_top = 0;
 /*
  * Toggles Help element from display:none and display block.
  * Also changes the width of the Current activity accordingly.
- * @param {String} help element's id to toggle.
- * @param {String} isMobile flag true/false.
+ * @param String help element's id to toggle.
+ * @param String isMobile flag true/false.
+ * @param String target_controller Edit page's controller name.
+ * @return none
  */
-function toggleHelp(id, isMobile, target_c)
-{
-    var activity = (target_c === "admin") ? 'current-activity'
-    : 'small-margin-current-activity';
+function toggleHelp(id, isMobile, target_controller) {
+    var activity = (target_controller === "admin") ? 'current-activity' :
+        'small-margin-current-activity';
     var images = document.querySelectorAll(".wiki-resource-image");
     var all_help_elements =
-            document.getElementsByClassName(activity);
+        document.getElementsByClassName(activity);
     var help_node = all_help_elements[0];
     if (current_activity_closed === true) {
         current_activity_top = getCssProperty(help_node, 'top');
@@ -208,11 +208,11 @@ function toggleHelp(id, isMobile, target_c)
         var decrease_width_by = Math.floor(getCssProperty(obj, 'width') / 3);
         //Calculate pixel to inch. clientWidth only returns in pixels.
         if (obj.style.display === "none") {
-            new_width = Math.floor(getCssProperty(help_node, 'width'))
-                    + decrease_width_by;
+            new_width = Math.floor(getCssProperty(help_node, 'width')) +
+                decrease_width_by;
         } else if (obj.style.display === "block") {
-            new_width = Math.floor(getCssProperty(help_node, 'width'))
-                    - decrease_width_by;
+            new_width = Math.floor(getCssProperty(help_node, 'width')) -
+                decrease_width_by;
         }
 
         if (new_width !== undefined) {
@@ -227,8 +227,8 @@ function toggleHelp(id, isMobile, target_c)
             help_node.style.top = current_activity_top + "px";
             current_activity_closed = true;
         } else if (obj.style.display === "block") {
-            help_node.style.top = current_activity_top
-                    + height_after_toggle + "px";
+            help_node.style.top = current_activity_top +
+                height_after_toggle + "px";
             /* The div.clientHeight doesnt include the height
             of the images inside the div before the images are completely
             loaded. So we iterate through the
@@ -236,9 +236,9 @@ function toggleHelp(id, isMobile, target_c)
             height to the top of the current_activity div dynamically. */
             for (var i = 0; i < images.length; i++) {
                 var image = images[i];
-                image.onload = function(){
-                    help_node.style.top =  getCssProperty(help_node, 'top')
-                            + this.height + 'px';
+                image.onload = function() {
+                    help_node.style.top = getCssProperty(help_node,
+                        'top') + this.height + 'px';
                 };
             }
             current_activity_closed = false;
@@ -247,12 +247,12 @@ function toggleHelp(id, isMobile, target_c)
 }
 
 /*
- * gets the Css property given an element and property name.
- * @param {Element} elm to get the Css property for
- * @param {String} Css property name.
+ * Gets the Css property given an element and property name.
+ * @param Object elm Element to get the Css property for.
+ * @param String property Css property name.
+ * @return String Css property value
  */
-function getCssProperty(elm, property)
-{
+function getCssProperty(elm, property) {
     //always returns in px
     return parseInt(window.getComputedStyle(elm, null)
         .getPropertyValue(property));
@@ -261,11 +261,10 @@ function getCssProperty(elm, property)
 /**
  * This is a JS function to convert yioop wiki markup to
  * html.
- * @param {String} wiki_text tobe parsed as HTML
- * @returns {String} parsed html
+ * @param String wiki_text to be parsed as HTML
+ * @return String parsed html.
  */
-function parseWikiContent(wiki_text, group_id, page_id)
-{
+function parseWikiContent(wiki_text, group_id, page_id) {
     var html = wiki_text;
 
     /* note that line breaks from a text area are sent
@@ -276,68 +275,63 @@ function parseWikiContent(wiki_text, group_id, page_id)
     html = parseLists(html);
 
     //Regex replace normal links
-    html = html.replace(/[^\[](http[^\[\s]*)/g, function (m, l) {
-    // normal link
+    html = html.replace(/[^\[](http[^\[\s]*)/g, function(m, l) {
+        // normal link
         return '<a href="' + l + '">' + l + '</a>';
     });
 
     //Regex replace for external links
-    html = html.replace(/[\[](http.*)[!\]]/g, function (m, l) {
-    // external link
+    html = html.replace(/[\[](http.*)[!\]]/g, function(m, l) {
+        // external link
         var p = l.replace(/[\[\]]/g, '').split(/ /);
         var link = p.shift();
-        return '<a href="' + link + '">'
-        + (p.length ? p.join(' ') : link) + '</a>';
+        return '<a href="' + link + '">' + (p.length ? p.join(' ') :
+            link) + '</a>';
     });
 
     //Regex replace for headings
     html = html.replace(/(?:^|\n)([=]+)(.*)\1/g,
-            function (match, contents, t) {
-                return '<h'
-                        + contents.length + '>'
-                        + t
-                        + '</h'
-                        + contents.length
-                        + '>';
-            });
+        function(match, contents, t) {
+            return '<h' + contents.length + '>' + t + '</h' + contents.length +
+                '>';
+        });
 
     //Regex replace for Bold characters
-    html = html.replace(/'''(.*?)'''/g, function (match, contents) {
+    html = html.replace(/'''(.*?)'''/g, function(match, contents) {
         return '<b>' + contents + '</b>';
     });
 
     //Regex replace for Italic characters
-    html = html.replace(/''(.*?)''/g, function (match, contents) {
+    html = html.replace(/''(.*?)''/g, function(match, contents) {
         return '<i>' + contents + '</i>';
     });
 
     //Regex for resource extraction.
     html = html.replace(/{{resource:(.+?)\|(.+?)}}/g,
-            function (match, contents, desc) {
-                return '<img src="' + "?c=resource&a=get&f=resources&g="
-                + group_id
-                + "&p=" + page_id
-                + "&n=" + contents + '" alt="' + desc
-                + '" class="wiki-resource-image"/>';
-            });
+        function(match, contents, desc) {
+            return '<img src="' + "?c=resource&a=get&f=resources&g=" +
+                group_id + "&p=" + page_id + "&n=" + contents +
+                '" alt="' + desc + '" class="wiki-resource-image"/>';
+        });
 
     //Regex replace for HR
-    html = html.replace(/----(.*?)/g, function (match, contents) {
-        return '<hr>' + contents + '</hr>';
+    html = html.replace(/----(.*?)/g, function(match, contents) {
+        return contents + '<hr />';
     });
 
     //replace nowiki with pre tags
-    html = html.replace(/<nowiki>(.*?)<\/nowiki>/g, function(match, contents) {
+    html = html.replace(/<nowiki>(.*?)<\/nowiki>/g, function(match,
+        contents) {
         return '<pre>' + contents + '</pre>';
     });
 
     //Regex replace for blocks
     html = html.replace(/(?:^|\n+)([^# =\*<].+)(?:\n+|$)/gm,
-            function (match, contents) {
-                if (contents.match(/^\^+$/))
-                    return contents;
-                return "\n<div>" + contents + "</div>\n";
-            });
+        function(match, contents) {
+            if (contents.match(/^\^+$/))
+                return contents;
+            return "\n<div>" + contents + "</div>\n";
+        });
 
     return html;
 }
@@ -345,40 +339,38 @@ function parseWikiContent(wiki_text, group_id, page_id)
 /**
  * Lists need to be recursively parsed. So the below function is used
  * to recursively convert wiki markup to html.
- * @param {String} str
- * @returns {String}
- */
-function parseLists(str)
-{
-    return str.replace(/(?:(?:(?:^|\n)[\*#].*)+)/g, function (match) {
+ * @param String str usually the content string in which the UL/OL lists are
+ * needed to be parsed to html.
+ * @return String parsed html.
+ **/
+function parseLists(str) {
+    return str.replace(/(?:(?:(?:^|\n)[\*#].*)+)/g, function(match) {
         var listType = match.match(/(^|\n)#/) ? 'ol' : 'ul';
         match = match.replace(/(^|\n)[\*#][ ]{0,1}/g, "$1");
         match = parseLists(match);
-        return '<'
-                + listType + '><li>'
-                + match.replace(/^\n/, '')
-                .split(/\n/).join('</li><li>')
-                + '</li></' + listType
-                + '>';
+        return '<' + listType + '><li>' + match.replace(/^\n/, '')
+            .split(/\n/).join('</li><li>') + '</li></' + listType +
+            '>';
     });
 }
 
 /**
- * get does a GET HTTP call on the url passed.
+ * getPageWithCallback does a GET HTTP call on the url passed.
  * Also fires the callback functions passed as
  * params appropriately.
  *
- * @param {String} url
- * @param {String} response_type
- * @param {function} success_call_back
- * @param {function} error_handler
- */
-var get = function (url, response_type, success_call_back, error_handler)
-{
+ * @param String url the url used for making GET HTTP call.
+ * @param String response_type The response type expected.
+ * @param Function object success_call_back Callback function on success.
+ * @param Function object error_handler Callback function on failure.
+ * @return none
+ * */
+function getPageWithCallback(url, response_type,
+    success_call_back, error_handler) {
     var request = makeRequest();
     request.open('GET', url, true);
     request.responseType = response_type;
-    request.onload = function () {
+    request.onload = function() {
         var status = request.status;
         if (status == 200) {
             success_call_back && success_call_back(request.response);
@@ -390,71 +382,83 @@ var get = function (url, response_type, success_call_back, error_handler)
 };
 
 /**
+ * /**
  * takes in the help point id, uses it to fetch wiki content, then
  * wiki content is being eval'd to be painted int he help pane.
  * Ajax call happens only if help needs to be displayed.
- * @param {object} help_point element
- * @param {String} is_mobile flag to check if the client is mobile
+ * @param Object help_point element
+ * @param String is_mobile flag to check if the client is mobile
  * or not.
+ * @param String target_controller Wiki page's controller name.
+ * @param String csrf_token_key teh dynamic name used for CSRF token var.
+ * @param String csrf_token_value The CSRF token to render edit page.
+ * @param String help_group_id  help's group_id required to render resources.
+ * @param String api_controller api's controller name.
+ * @param String api_action api's action name.
+ * @param String mode r/w mode , usually read.
+ * @return none
  */
-function displayHelpForId(help_point,
-                is_mobile,target_c,csrf_token_key,csrf_token_value)
-{
-    var help_group_id = 7;
-    var c = 'api';
-    var a = "wiki";
-    var arg = "read";
-
+function displayHelpForId(
+    help_point,
+    is_mobile,
+    target_controller,
+    csrf_token_key,
+    csrf_token_value,
+    help_group_id,
+    api_controller,
+    api_action,
+    mode) {
     if ((elt("help-frame").style.display) === "block") {
-        toggleHelp('help-frame', is_mobile,target_c);
+        toggleHelp('help-frame', is_mobile, target_controller);
         return;
     }
-    get("?c=" + c + "&group_id=" + help_group_id + "&" +
-            "arg=" + arg + "&" +
-            "a=" + a + "&" +
-            csrf_token_key +'=' + csrf_token_value + "&" +
-            "page_name=" + help_point.getAttribute("data-pagename"),
-            'json',
-            function (data) {
-                elt("help-frame-body").innerHTML = parseWikiContent(
-                        data.wiki_content,
-                        data.group_id,
-                        data.page_id
-                        );
-                elt('page_name').innerHTML = data.page_name + ' <a href="'+
-                        getEditLink(
-                        target_c,
-                        csrf_token_key,
-                        csrf_token_value,
-                        help_group_id,
-                        data.page_name) +'">'+
-                        '[Edit]</a>' ;
+    getPageWithCallback("?c=" + api_controller + "&group_id=" +
+        help_group_id + "&" +
+        "arg=" + mode + "&" +
+        "a=" + api_action + "&" +
+        csrf_token_key + '=' + csrf_token_value + "&" +
+        "page_name=" + help_point.getAttribute("data-pagename"),
+        'json',
+        function(data) {
+            elt("help-frame-body").innerHTML = parseWikiContent(
+                data.wiki_content,
+                data.group_id,
+                data.page_id
+            );
+            elt('page_name').innerHTML = data.page_name + ' [<a href="' +
+                getEditLink(
+                    target_controller,
+                    csrf_token_key,
+                    csrf_token_value,
+                    help_group_id,
+                    data.page_name) + '">' +
+                'Edit</a>]';
 
-                toggleHelp('help-frame', is_mobile,target_c);
-            },
-            function (status) {
-                toggleHelp('help-frame', is_mobile,target_c);
-            });
+            toggleHelp('help-frame', is_mobile, target_controller);
+        },
+        function(status) {
+            toggleHelp('help-frame', is_mobile, target_controller);
+        });
     event.preventDefault();
 }
 
 /**
  * Simple function to construct the Wiki Edit hyperlink with passed in params.
- * @param {type} target_c
- * @param {type} csrf_token
- * @param {type} group_id
- * @param {type} page_name
- * @returns {String}
+ * @param String target_controller Edit page's controller name.
+ * @param String csrf_token_key teh dynamic name used for CSRF token var.
+ * @param String csrf_token_value The CSRF token to render edit page.
+ * @param String group_id GroupId of the group which has the wiki.
+ * @param String page_name Page name,unique Identifier for wiki edit page.
+ * @return String
  */
-function getEditLink(target_c,
-                csrf_token_key, csrf_token_value, group_id, page_name)
-{
-    return '?c=' + target_c +
-            '&'+ csrf_token_key +'=' + csrf_token_value +
-            '&group_id=' + group_id +
-            '&arg=edit' +
-            '&a=wiki' +
-            '&page_name=' + page_name;
+function getEditLink(target_controller, csrf_token_key, csrf_token_value,
+    group_id, page_name) {
+    return '?c=' + target_controller +
+        '&' + csrf_token_key + '=' + csrf_token_value +
+        '&group_id=' + group_id +
+        '&arg=edit' +
+        '&a=wiki' +
+        '&page_name=' + page_name;
 }
 
 
@@ -463,20 +467,18 @@ function getEditLink(target_c,
  * converts them into html then populates the preview
  * div with parsed html contents. It takes in a page id and group id that are
  * required to render image urls, If any exist.
- * @param {type} page_id
- * @param {type} group_id
+ * @param String page_id required to render resources.
+ * @param String group_id required to render resources.
+ * @return none
  */
-function renderPreview(page_id, group_id)
-{
+function renderPreview(page_id, group_id) {
     if (event.preventDefault)
         event.preventDefault();
     event.returnValue = false;
     var textArea = document.getElementById('wiki-page');
     var div = document.getElementById('wiki-preview');
-    div.innerHTML = "<hr>"
-            + "<p>"
-            + parseWikiContent(
-            textArea.value,
-            group_id,
-            page_id) + "</p> <hr>";
+    div.innerHTML = "<hr>" + "<p>" + parseWikiContent(
+        textArea.value,
+        group_id,
+        page_id) + "</p> <hr>";
 }
\ No newline at end of file
diff --git a/views/elements/element.php b/views/elements/element.php
index 3910c02..a395f7e 100755
--- a/views/elements/element.php
+++ b/views/elements/element.php
@@ -84,7 +84,7 @@ abstract class Element
                     href=""
                     onclick="javascript:displayHelpForId(this,'
                 . $is_mobile . ',\'' . $target_c . '\',\''. CSRF_TOKEN .'\',\''
-                . $csrf_token_value . '\')" '
+                . $csrf_token_value ."','17','api','wiki','read" . '\')" '
                 . 'data-pagename="' . $help_point_id . '">?</button>';
     }
 
diff --git a/views/elements/managegroups_element.php b/views/elements/managegroups_element.php
index 737f7cc..a0320b2 100755
--- a/views/elements/managegroups_element.php
+++ b/views/elements/managegroups_element.php
@@ -328,7 +328,7 @@ class ManagegroupsElement extends Element
                     <td>[<a href="<?php e($browse_url); ?>"><?php
                         e(tl('managegroups_element_browse')); ?></a>]
                     <?php
-                    e($this->renderHelpButton("browse_url", $data[CSRF_TOKEN],
+                    e($this->renderHelpButton("CSH Eswara -", $data[CSRF_TOKEN],
                             $_REQUEST['c']));
                     ?></td>
                 <?php
-- 
1.9.3 (Apple Git-50)


From c0a4795ef467f0f43319b8629869c2a6bb46ea4b Mon Sep 17 00:00:00 2001
From: epinapala <epinapala@ebay.com>
Date: Sat, 18 Oct 2014 15:07:24 -0700
Subject: [PATCH 2/2] Created a new subclass for helper- help button. Fixes
 some undefined vars. Few more bug fixes.

---
 views/elements/api_element.php          |  1 +
 views/elements/element.php              | 21 --------
 views/elements/help_element.php         |  2 +
 views/elements/managegroups_element.php |  4 +-
 views/helpers/helpbutton_helper.php     | 95 +++++++++++++++++++++++++++++++++
 5 files changed, 100 insertions(+), 23 deletions(-)
 create mode 100644 views/helpers/helpbutton_helper.php

diff --git a/views/elements/api_element.php b/views/elements/api_element.php
index 59e9920..f847cf3 100644
--- a/views/elements/api_element.php
+++ b/views/elements/api_element.php
@@ -75,6 +75,7 @@ class ApiElement extends Element implements CrawlConstants {
      */
     function renderJsonDocument($data, $can_edit, $logged_in) {
         $out_array = array();
+        $http_code = 0;
         if ($data["PAGE"]) {
             $out_array["wiki_content"] = html_entity_decode($data['PAGE'],
                     ENT_QUOTES);
diff --git a/views/elements/element.php b/views/elements/element.php
index a395f7e..e48cbd6 100755
--- a/views/elements/element.php
+++ b/views/elements/element.php
@@ -67,27 +67,6 @@ abstract class Element
      * that should be used in drawing the view
      */
     public abstract function render($data);
-
-    /**
-     * This method is used to render the help button,
-     * given a help point  csrf token and target controller name.
-     *
-     * @param  $help_point_id - used to set as help button id
-     * @param  $csrf_token_value - csrf token to make api call/open edit link
-     * @param  $target_c - target controller to remember the view.
-     * @return String button html.
-     */
-    public function renderHelpButton($help_point_id,
-            $csrf_token_value, $target_c) {
-        $is_mobile = MOBILE ? "true" : "false";
-        return '<button type="button"
-                    href=""
-                    onclick="javascript:displayHelpForId(this,'
-                . $is_mobile . ',\'' . $target_c . '\',\''. CSRF_TOKEN .'\',\''
-                . $csrf_token_value ."','17','api','wiki','read" . '\')" '
-                . 'data-pagename="' . $help_point_id . '">?</button>';
-    }
-
 }
 
 ?>
diff --git a/views/elements/help_element.php b/views/elements/help_element.php
index 8a54055..f1a32ff 100644
--- a/views/elements/help_element.php
+++ b/views/elements/help_element.php
@@ -70,6 +70,8 @@ class HelpElement extends Element {
                     </div>
                 </div>
             <?php } else {
+                $help_class_add = "";
+                $help_id = "";
                 if($data['c'] != 'admin'){
                     $help_class_add = "small-margin-help-pane";
                     $help_id ="small-margin-help";
diff --git a/views/elements/managegroups_element.php b/views/elements/managegroups_element.php
index a0320b2..1016ee7 100755
--- a/views/elements/managegroups_element.php
+++ b/views/elements/managegroups_element.php
@@ -328,8 +328,8 @@ class ManagegroupsElement extends Element
                     <td>[<a href="<?php e($browse_url); ?>"><?php
                         e(tl('managegroups_element_browse')); ?></a>]
                     <?php
-                    e($this->renderHelpButton("CSH Eswara -", $data[CSRF_TOKEN],
-                            $_REQUEST['c']));
+                    e($this->view->helper("helpbutton")->render(
+                            "browse_url", $data[CSRF_TOKEN],$_REQUEST['c']));
                     ?></td>
                 <?php
                 }
diff --git a/views/helpers/helpbutton_helper.php b/views/helpers/helpbutton_helper.php
new file mode 100644
index 0000000..9efc184
--- /dev/null
+++ b/views/helpers/helpbutton_helper.php
@@ -0,0 +1,95 @@
+<?php
+/**
+ * SeekQuarry/Yioop --
+ * Open Source Pure PHP Search Engine, Crawler, and Indexer
+ *
+ * Copyright (C) 2009 - 2014  Chris Pollett chris@pollett.org
+ *
+ * LICENSE:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * END LICENSE
+ *
+ * @author Eswara Rajesh Pinapala epinapala@live.com
+ * @package seek_quarry
+ * @subpackage helper
+ * @license http://www.gnu.org/licenses/ GPL3
+ * @link http://www.seekquarry.com/
+ * @copyright 2009 - 2014
+ * @filesource
+ */
+if(!defined('BASE_DIR')) {echo "BAD REQUEST"; exit();}
+/**
+ * Load base helper class if needed
+ */
+require_once BASE_DIR."/views/helpers/helper.php";
+/**
+ * This is a helper class is used to
+ * draw help button for context sensitive
+ * help.
+ *
+ * @author Eswara Rajesh Pinapala
+ * @package seek_quarry
+ * @subpackage helper
+ */
+class HelpbuttonHelper extends Helper
+{
+    /**
+     * The constructor at this point initializes the
+     * all the required code for Wiki Help initialization.
+     */
+    function __construct()
+    {
+        $this->localizationdata = "\ntl = {".
+            'wiki_view_edit :"'.
+            tl('wiki_view_edit').'",'.
+            'wiki_view_read :"'.
+            tl('wiki_view_read').'"'.
+            '};';
+        parent::__construct();
+    }
+
+    /**
+     * This method is used to render the help button,
+     * given a help point  csrf token and target controller name.
+     *
+     * @param  $help_point_id - used to set as help button id
+     * @param  $csrf_token_value - csrf token to make api call/open edit link
+     * @param  $target_c - target controller to remember the view.
+     * @return String button html.
+     */
+    public function render($help_point_id,
+                           $csrf_token_value, $target_c) {
+        //set up an array of translation for javascript-land
+        if(!isset($data['SCRIPT'])) {
+            $data['SCRIPT'] = "";
+        }
+        $data['SCRIPT'] .= $this->localizationdata;
+        $is_mobile = MOBILE ? "true" : "false";
+        $wiki_group_id = "7";
+        $api_controller = "api";
+        $api_wiki_action ="wiki";
+        $api_wiki_mode = "read";
+
+        return '<button type="button"
+                    href=""
+                    onclick="javascript:displayHelpForId(this,'
+        . $is_mobile . ',\'' . $target_c . '\',\''. CSRF_TOKEN .'\',\''
+        . $csrf_token_value ."','$wiki_group_id','$api_controller',"
+        . "'$api_wiki_action','$api_wiki_mode" . '\')" '
+        . 'data-pagename="' . $help_point_id . '">?</button>';
+    }
+}
+?>
-- 
1.9.3 (Apple Git-50)

