Add Wiki Buttons to feed editing, a=chris

Chris Pollett [2014-07-02 17:Jul:nd]
Add Wiki Buttons to feed editing, a=chris
Filename
controllers/components/social_component.php
views/elements/groupfeed_element.php
diff --git a/controllers/components/social_component.php b/controllers/components/social_component.php
index e4141499d..fde989ca9 100644
--- a/controllers/components/social_component.php
+++ b/controllers/components/social_component.php
@@ -885,6 +885,7 @@ class SocialComponent extends Component implements CrawlConstants
         $data['PAGING_QUERY'] = "?c=$controller_name&a=groupFeeds";
         $data['OTHER_PAGING_QUERY'] =
             "?c=$other_controller_name&a=groupFeeds";
+        $this->initializeWikiEditor($data, -1);
         return $data;
     }
     /**
@@ -1220,8 +1221,9 @@ class SocialComponent extends Component implements CrawlConstants
      *     view and layout that the wiki editor will be drawn on
      *     This method tacks on to INCLUDE_SCRIPTS to make the layout load
      *     wiki.js.
-     * @param $id if "" then all textareas on page will get editor buttons
-     *     otherwise just the on with $id will. (Can call this method
+     * @param $id if "" then all textareas on page will get editor buttons,
+     *     if -1 then sets up translations, but does not add any button,
+     *     otherwise, jadd buttons to textarea $id will. (Can call this method
      *     multiple times, if want more than one but not all)
      */
     function initializeWikiEditor(&$data, $id = "")
@@ -1270,10 +1272,12 @@ class SocialComponent extends Component implements CrawlConstants
                 'wiki_js_link_url :"'. tl('wiki_js_link_url').'"'.
                 '};';
         }
-        if($id == "") {
-            $data['SCRIPT'] .= "editorizeAll();\n";
-        } else {
-            $data['SCRIPT'] .= "editorize('$id');\n";
+        if($id != -1) {
+            if($id == "") {
+                $data['SCRIPT'] .= "editorizeAll();\n";
+            } else {
+                $data['SCRIPT'] .= "editorize('$id');\n";
+            }
         }
     }
     /**
diff --git a/views/elements/groupfeed_element.php b/views/elements/groupfeed_element.php
index ceefba1bb..416e661b6 100644
--- a/views/elements/groupfeed_element.php
+++ b/views/elements/groupfeed_element.php
@@ -361,13 +361,17 @@ class GroupfeedElement extends Element implements CrawlConstants
                         e(tl("groupfeed_element_add_comment"));
                     ?></label></b></h2>'+
                     '<textarea class="short-text-area" '+
-                    'id="comment-'+ id +'" name="description" ></textarea>' +
+                    'id="comment-'+ id +'" name="description" '+
+                    'data-buttons="all,!wikibtn-search,!wikibtn-heading" '+
+                    '></textarea>' +
                     '<button class="button-box float-opposite" ' +
                     'type="submit"><?php e(tl("groupfeed_element_save"));
                     ?></button>' +
                     '<div>&nbsp;</div>'+
                     '</form>';
-                elt('comment-' + id).focus();
+                var comment_id = 'comment-' + id;
+                editorize(comment_id);
+                elt(comment_id).focus();
             } else {
                 elt(id).innerHTML = "";
             }
@@ -403,12 +407,15 @@ class GroupfeedElement extends Element implements CrawlConstants
                         e(tl("groupfeed_element_post"));
                     ?></label></b></p>' +
                     '<textarea class="short-text-area" '+
-                    'id="description-'+ id +'" name="description" ></textarea>'+
+                    'id="description-'+ id +'" name="description" '+
+                    'data-buttons="all,!wikibtn-search,!wikibtn-heading" '+
+                    '></textarea>' +
                     '<button class="button-box float-opposite" ' +
                     'type="submit"><?php e(tl("groupfeed_element_save"));
                     ?></button>' +
                     '<div>&nbsp;</div>'+
                     '</form>';
+                editorize('description-'+ id);
             } else {
                 elt(id).innerHTML = "";
             }
@@ -446,13 +453,15 @@ class GroupfeedElement extends Element implements CrawlConstants
                         e(tl("groupfeed_element_post"));
                     ?></label></b></p>' +
                     '<textarea class="short-text-area" '+
-                    'id="description-'+ id +'" name="description" >' +
-                    description + '</textarea>'+
+                    'id="description-'+ id +'" name="description" '+
+                    'data-buttons="all,!wikibtn-search,!wikibtn-heading" '+
+                    '>' + description + '</textarea>'+
                     '<button class="button-box float-opposite" ' +
                     'type="submit"><?php e(tl("groupfeed_element_save"));
                     ?></button>' +
                     '<div>&nbsp;</div>'+
                     '</form>';
+                editorize('description-'+ id);
             } else {
                 elt(id).innerHTML = "";
                 setDisplay('result-'+id, true);
ViewGit