_binary From 24d284a4d142858d4c05cd3cc73ef3afd4bd2e24 Mon Sep 17 00:00:00 2001
From: epinapala <epinapala@ebay.com>
Date: Tue, 14 Oct 2014 22:18:15 -0700
Subject: [PATCH 1/3] before addign icons

---
 .gitignore                                  |   6 +-
 controllers/api_controller.php              | 130 ++++++++++++
 controllers/components/social_component.php |  73 ++++++-
 controllers/controller.php                  |   1 +
 css/search.css                              |  84 +++++++-
 index.php                                   |   5 +-
 locale/ar/configure.ini                     |   3 +
 locale/bn/configure.ini                     |   3 +
 locale/de/configure.ini                     |   3 +
 locale/en-US/configure.ini                  |   5 +-
 locale/es/configure.ini                     |   3 +
 locale/fa/configure.ini                     |   3 +
 locale/fr-FR/configure.ini                  |   3 +
 locale/he/configure.ini                     |   3 +
 locale/hi/configure.ini                     |   3 +
 locale/in-ID/configure.ini                  |   3 +
 locale/it/configure.ini                     |   3 +
 locale/ja/configure.ini                     |   3 +
 locale/kn/configure.ini                     |   3 +
 locale/ko/configure.ini                     |   3 +
 locale/pl/configure.ini                     |   3 +
 locale/pt/configure.ini                     |   3 +
 locale/ru/configure.ini                     |   3 +
 locale/te/configure.ini                     |   3 +
 locale/th/configure.ini                     |   3 +
 locale/tr/configure.ini                     |   3 +
 locale/vi-VN/configure.ini                  |   3 +
 locale/zh-CN/configure.ini                  |   3 +
 models/group_model.php                      |   2 +-
 resources/grouped.png                       | Bin 0 -> 4876 bytes
 resources/list.png                          | Bin 0 -> 4842 bytes
 scripts/basic.js                            | 300 ++++++++++++++++++++++++++++
 views/admin_view.php                        |   1 +
 views/api_view.php                          |  61 ++++++
 views/elements/api_element.php              | 108 ++++++++++
 views/elements/element.php                  |  22 ++
 views/elements/groupfeed_element.php        |  36 +++-
 views/elements/help_element.php             | 100 ++++++++++
 views/elements/managegroups_element.php     |  21 +-
 views/elements/wiki_element.php             |   9 +
 views/group_view.php                        |   1 +
 views/layouts/api_layout.php                |  63 ++++++
 42 files changed, 1075 insertions(+), 16 deletions(-)
 create mode 100644 controllers/api_controller.php
 create mode 100644 resources/grouped.png
 create mode 100644 resources/list.png
 create mode 100644 views/api_view.php
 create mode 100644 views/elements/api_element.php
 create mode 100644 views/elements/help_element.php
 create mode 100644 views/layouts/api_layout.php

diff --git a/.gitignore b/.gitignore
index fb633b5..f946ad8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
-local_config.php
-.DS_Store
+local_config.php
+.DS_Store
+nbproject/
+/.idea/
diff --git a/controllers/api_controller.php b/controllers/api_controller.php
new file mode 100644
index 0000000..de467a9
--- /dev/null
+++ b/controllers/api_controller.php
@@ -0,0 +1,130 @@
+<?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 element
+ *  @license http://www.gnu.org/licenses/ GPL3
+ *  @link http://www.seekquarry.com/
+ *  @copyright 2009 - 2014
+ *  @filesource
+ */
+
+/**
+ * Description of ApiController
+ *
+ * @author epinapala
+ */
+if (!defined('BASE_DIR')) {
+    echo "BAD REQUEST";
+    exit();
+}
+/** Load base controller class if needed */
+require_once BASE_DIR . "/controllers/controller.php";
+/** Loads common constants for web crawling */
+require_once BASE_DIR . "/lib/crawl_constants.php";
+/** For Wiki Parsing */
+require_once BASE_DIR . "/lib/wiki_parser.php";
+
+/**
+ * Controller used to handle user group activities outside of
+ * the admin panel setting. This either could be because the admin panel
+ * is "collapsed" or because the request concerns a wiki page.
+ *
+ * @author Eswara Rajesh Pinapala
+ * @package seek_quarry
+ * @subpackage controller
+ */
+class ApiController extends Controller implements CrawlConstants {
+
+    /**
+     * Says which activities (roughly methods invoke for the api) this
+     * controller will respond to (note: more activities will be loaded from
+     * components)
+     * @var array
+     */
+    var $activities = array("wiki");
+
+    /**
+     * Used to process requests related to user group activities outside of
+     * the admin panel setting. This either could be because the admin panel
+     * is "collapsed" or because the request concerns a wiki page.
+     */
+    function processRequest() {
+        $data = array();
+        if (!PROFILE) {
+            return $this->configureRequest();
+        }
+        if (isset($_SESSION['USER_ID'])) {
+            $user_id = $_SESSION['USER_ID'];
+            $data['ADMIN'] = 1;
+        } else {
+            $user_id = $_SERVER['REMOTE_ADDR'];
+        }
+        $data['SCRIPT'] = "";
+        $token_okay = $this->checkCSRFToken(CSRF_TOKEN, $user_id);
+        
+        $data = array_merge($data, $this->processSession());
+        
+        if (isset($data["VIEW"])) {
+            $view = $data["VIEW"];
+        } else {
+            $view = 'api';
+        }
+        $_SESSION['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR'];
+        $this->displayView($view, $data);
+    }
+
+    /**
+     * Used to perform the actual activity call to be done by the 
+     * api_controller.
+     * processSession is called from @see processRequest, which does some
+     * cleaning of fields if the CSRFToken is not valid. It is more likely
+     * that that api_controller may be involved in such requests as it can
+     * be invoked either when a user is logged in or not and for users with and
+     * without accounts. processSession makes sure the $_REQUEST'd activity is
+     * valid (or falls back to groupFeeds) then calls it. If someone uses
+     * the Settings link to change the language or default number of feed
+     * elements to view, this method sets up the $data variable so that
+     * the back/cancel button on that page works correctly.
+     */
+    function processSession() {
+        if (isset($_REQUEST['a']) &&
+                in_array($_REQUEST['a'], $this->activities)) {
+            $activity = $_REQUEST['a'];
+        } else {
+            $activity = "groupFeeds";
+        }
+        $data = $this->call($activity);
+        $data['ACTIVITY_CONTROLLER'] = "group";
+        $data['ACTIVITY_METHOD'] = $activity; //for settings controller
+        if (!is_array($data)) {
+            $data = array();
+        }
+        return $data;
+    }
+}
+
+?>
diff --git a/controllers/components/social_component.php b/controllers/components/social_component.php
index 3327ffc..f649e94 100644
--- a/controllers/components/social_component.php
+++ b/controllers/components/social_component.php
@@ -718,6 +718,56 @@ class SocialComponent extends Component implements CrawlConstants
         }
         $possible_arguments = array("addcomment", "deletepost", "addgroup",
             "newthread", "updatepost", "status", "upvote", "downvote");
+        if (isset($_REQUEST['v']) && $_REQUEST['v'] == 'grouped') {
+            $data['MODE'] = 'grouped';
+            if (isset($_REQUEST['limit'])) {
+                $limit = $parent->clean($_REQUEST['limit'], "int");
+            } else {
+                $limit = 0;
+            }
+            //$data['NUM_SHOWN'] = (isset($_REQUEST['limit'])
+            //      && $_REQUEST['limit'] > 0 ) ? $_REQUEST['limit'] : 5;
+            $data['GROUPS'] = $group_model->getRows($limit, $results_per_page, 
+                    $data['NUM_GROUPS'], array(), array($user_id, false));
+            $num_shown = count($data['GROUPS']);
+            for ($i = 0; $i < $num_shown; $i++) {
+                $search_array = array(array("group_id", "=",
+                        $data['GROUPS'][$i]['GROUP_ID'], ""),
+                    array("pub_date", "", "", "DESC"));
+                $item = $group_model->getGroupItems(
+                        0, 
+                        1, 
+                        $search_array, 
+                        $user_id);
+                $data['GROUPS'][$i]['NUM_POSTS'] = 
+                        $group_model->getGroupItemCount(
+                                $search_array, $user_id);
+                $data['GROUPS'][$i]['NUM_THREADS'] = 
+                        $group_model->getGroupItemCount(
+                                $search_array, 
+                                $user_id, 
+                                $data['GROUPS'][$i]['GROUP_ID']
+                                );
+                $data['GROUPS'][$i]['NUM_PAGES'] = 
+                        $group_model->getGroupPageCount(
+                        $data['GROUPS'][$i]['GROUP_ID']);
+                if (isset($item[0]['TITLE'])) {
+                    $data['GROUPS'][$i]["ITEM_TITLE"] = $item[0]['TITLE'];
+                    $data['GROUPS'][$i]["THREAD_ID"] = $item[0]['PARENT_ID'];
+                } else {
+                    $data['GROUPS'][$i]["ITEM_TITLE"] = 
+                            tl('accountaccess_component_no_posts_yet');
+                    $data['GROUPS'][$i]["THREAD_ID"] = -1;
+                }
+            }
+            $data['NUM_SHOWN'] = $num_shown;
+            $data['LIMIT'] = $limit;
+            $data['RESULTS_PER_PAGE'] = $results_per_page;
+            $data['PAGING_QUERY'] = "./?c=$controller_name&amp;a=groupFeeds";
+            $data['OTHER_PAGING_QUERY'] =
+            "./?c=$other_controller_name&amp;a=groupFeeds";
+            return $data;
+        }
         if(isset($_REQUEST['arg']) &&
             in_array($_REQUEST['arg'], $possible_arguments)) {
             switch($_REQUEST['arg'])
@@ -1245,11 +1295,21 @@ EOD;
         }
         $group = $group_model->getGroupById($group_id, $user_id);
         $data["CAN_EDIT"] = false;
-        $data["MODE"] = "read";
+        if((isset($_REQUEST['c'])) && $_REQUEST['c'] == "api"){
+            $data['MODE'] = 'api';
+            $data['VIEW'] = 'api';
+        }else {
+            $data["MODE"] = "read";
+        }
         if(!$group) {
+            if($data['MODE'] !== 'api'){
             $data['SCRIPT'] .= "doMessage('<h1 class=\"red\" >".
                 tl("group_controller_no_group_access").
                 "</h1>');";
+            }else{
+                $data['errors'] =  array();
+                $data['errors'][] = tl("group_controller_no_group_access");
+            }
             $group_id = PUBLIC_GROUP_ID;
             $group = $group_model->getGroupById($group_id, $user_id);
         } else {
@@ -1292,7 +1352,8 @@ EOD;
                 case "edit":
                     if(!$data["CAN_EDIT"]) { continue; }
                     if(isset($_REQUEST['caret']) &&
-                       isset($_REQUEST['scroll_top'])) {
+                       isset($_REQUEST['scroll_top']) 
+                            && !isset($page)) {
                         $caret = $parent->clean($_REQUEST['caret'],
                             'int');
                         $scroll_top= $parent->clean($_REQUEST['scroll_top'],
@@ -1304,7 +1365,11 @@ EOD;
                             "} ".
                             "wiki.scrollTop = $scroll_top;";
                     }
-                    $data["MODE"] = "edit";
+                    if(isset($page)){
+                        $data["MODE"] = "read";
+                    }else{
+                        $data["MODE"] = "edit";
+                    }
                     $page_info = $group_model->getPageInfoByName($group_id,
                         $page_name, $locale_tag, 'resources');
                     /* if page not yet created than $page_info will be null
@@ -1609,7 +1674,7 @@ EOD;
             $page_name = tl('group_controller_main');
         }
         $data["GROUP"] = $group;
-        if(in_array($data["MODE"], array("read", "edit", "media"))) {
+        if(in_array($data["MODE"], array("read", "edit", "media","api"))) {
             if(!isset($data["PAGE"]) || !$data['PAGE']) {
                 $data["PAGE_NAME"] = $page_name;
                 if(isset($search_page_info) && $search_page_info) {
diff --git a/controllers/controller.php b/controllers/controller.php
index 7b8bdfd..863ddd1 100755
--- a/controllers/controller.php
+++ b/controllers/controller.php
@@ -254,6 +254,7 @@ abstract class Controller
                 $data['TOTAL_ELAPSED_TIME'] += $mail_total_time;
             }
         }
+        $data['c'] = isset($_REQUEST['c']) ? $_REQUEST['c'] : NULL;
         $this->view($view)->render($data);
     }
     /**
diff --git a/css/search.css b/css/search.css
index d96382f..cf0b54b 100755
--- a/css/search.css
+++ b/css/search.css
@@ -2199,7 +2199,7 @@ div.group-result
     font-size: 16pt;
     max-width: 9in;
     min-height: 6.5in;
-    min-width: 9in;
+    min-width: 8in;
     padding-left: 0.1in;
     padding-right: 0.1in;
     padding-bottom: 0.1in;
@@ -2763,3 +2763,85 @@ table.wikitable > caption
     z-index: 200;
 }
 
+.html-ltr #help
+{
+    border-radius: 8px;
+    float: left;
+    width: 4.0in;
+    position: absolute;
+    left: 11.5in;
+    top: 135px;
+}
+
+.html-rtl #help
+{
+    border-radius: 8px;
+    float: left;
+    width: 4.0in;
+    position: absolute;
+    right: 11.5in;
+    top: 135px;
+}
+
+.html-ltr #small-margin-help
+{
+    border-radius: 8px;
+    float: left;
+    width: 4.0in;
+    position: absolute;
+    left: 11.5in;
+    top: 135px;
+}
+
+.html-rtl #small-margin-help
+{
+    border-radius: 8px;
+    float: left;
+    width: 4.0in;
+    position: absolute;
+    right: 9.5in;
+    top: 135px;
+}
+
+.html-ltr #mobile-help
+{
+    float: left;
+    width: 3in;
+    position: absolute;
+    top: 142px;
+}
+
+.html-rtl #mobile-help
+{
+    float: left;
+    width: 3in;
+    position: absolute;
+    top: 142px;
+}
+
+.help-pane{
+    display : none;
+    width: 320px;
+    border:2px solid #0094ff;
+}
+
+.small-margin-help-pane {
+display: none;
+width: 380px;
+border: 2px solid #0094ff;
+left: -1in;
+top: 1in;
+}
+
+.help-pane h2 {
+    background:#0094ff;
+    color:white;
+    padding:10px;
+}
+.help-pane p {
+    color:#333;
+    padding:10px;
+}
+.wiki-resource-image{
+    max-width:100%;
+}
diff --git a/index.php b/index.php
index 6d4d781..13d0b5a 100755
--- a/index.php
+++ b/index.php
@@ -124,8 +124,9 @@ if (function_exists('lcfirst') === false) {
         return (string)(strtolower(substr($str, 0, 1)).substr($str, 1));
     }
 }
-$available_controllers = array( "admin", "archive",  "cache", "classifier",
-    "crawl", "fetch", "group", "machine", "resource", "search", "settings",
+$available_controllers = array( "admin", "api", "archive",  "cache", "classifier",
+    "crawl", "fetch", "group", "machine", "resource", "search", 
+    "settings",
     "statistics", "static");
 if(!WEB_ACCESS) {
 $available_controllers = array("admin", "archive", "cache", "crawl", "fetch",
diff --git a/locale/ar/configure.ini b/locale/ar/configure.ini
index 08844aa..d6bc5e2 100755
--- a/locale/ar/configure.ini
+++ b/locale/ar/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/locale/bn/configure.ini b/locale/bn/configure.ini
index 0f6bb07..0e1c73f 100755
--- a/locale/bn/configure.ini
+++ b/locale/bn/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/locale/de/configure.ini b/locale/de/configure.ini
index 384c3bc..9c92c70 100755
--- a/locale/de/configure.ini
+++ b/locale/de/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/locale/en-US/configure.ini b/locale/en-US/configure.ini
index dc5715f..bd9552d 100755
--- a/locale/en-US/configure.ini
+++ b/locale/en-US/configure.ini
@@ -3233,7 +3233,7 @@ wiki_element_archive_info = "To archive a page so it won&#039;t appear in search
 ; wiki_element.php line: 384
 wiki_element_edit_reason = "Edit Reason:"
 ;
-; wiki_element.php line: 392
+; wiki_element.php line: 393
 wiki_element_savebutton = "Save"
 ;
 ; wiki_element.php line: 396
@@ -3242,6 +3242,9 @@ wiki_element_media_list = "Media List Page"
 ; wiki_element.php line: 397
 wiki_element_ml_description = "The uploaded items below will all appear when this page is read as a gallery or media list."
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = "Preview"
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = "Page Resources"
 ;
diff --git a/locale/es/configure.ini b/locale/es/configure.ini
index dcd55af..ecaf8cf 100755
--- a/locale/es/configure.ini
+++ b/locale/es/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/locale/fa/configure.ini b/locale/fa/configure.ini
index 4a60883..a76687a 100755
--- a/locale/fa/configure.ini
+++ b/locale/fa/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/locale/fr-FR/configure.ini b/locale/fr-FR/configure.ini
index c3a16cb..98e4562 100755
--- a/locale/fr-FR/configure.ini
+++ b/locale/fr-FR/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/locale/he/configure.ini b/locale/he/configure.ini
index c528da5..0564177 100755
--- a/locale/he/configure.ini
+++ b/locale/he/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/locale/hi/configure.ini b/locale/hi/configure.ini
index b6f6e8f..47af7cf 100755
--- a/locale/hi/configure.ini
+++ b/locale/hi/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/locale/in-ID/configure.ini b/locale/in-ID/configure.ini
index 76d2840..5282a5c 100755
--- a/locale/in-ID/configure.ini
+++ b/locale/in-ID/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/locale/it/configure.ini b/locale/it/configure.ini
index 11c9844..acad5ee 100755
--- a/locale/it/configure.ini
+++ b/locale/it/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/locale/ja/configure.ini b/locale/ja/configure.ini
index 06dc5e7..6dfebc3 100755
--- a/locale/ja/configure.ini
+++ b/locale/ja/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/locale/kn/configure.ini b/locale/kn/configure.ini
index 74f46af..c70e3df 100755
--- a/locale/kn/configure.ini
+++ b/locale/kn/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/locale/ko/configure.ini b/locale/ko/configure.ini
index 11b84f7..c42163b 100755
--- a/locale/ko/configure.ini
+++ b/locale/ko/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/locale/pl/configure.ini b/locale/pl/configure.ini
index 3e8a064..c8ca748 100755
--- a/locale/pl/configure.ini
+++ b/locale/pl/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/locale/pt/configure.ini b/locale/pt/configure.ini
index 4310ca6..30e71bd 100755
--- a/locale/pt/configure.ini
+++ b/locale/pt/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/locale/ru/configure.ini b/locale/ru/configure.ini
index a6e4185..60f17dd 100755
--- a/locale/ru/configure.ini
+++ b/locale/ru/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/locale/te/configure.ini b/locale/te/configure.ini
index 50a739c..91e47d4 100755
--- a/locale/te/configure.ini
+++ b/locale/te/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/locale/th/configure.ini b/locale/th/configure.ini
index e7ed27d..0ffb090 100755
--- a/locale/th/configure.ini
+++ b/locale/th/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/locale/tr/configure.ini b/locale/tr/configure.ini
index 82fe851..a459061 100755
--- a/locale/tr/configure.ini
+++ b/locale/tr/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/locale/vi-VN/configure.ini b/locale/vi-VN/configure.ini
index 5c99ae9..7a761bc 100755
--- a/locale/vi-VN/configure.ini
+++ b/locale/vi-VN/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/locale/zh-CN/configure.ini b/locale/zh-CN/configure.ini
index 87bd5b6..7914cc0 100755
--- a/locale/zh-CN/configure.ini
+++ b/locale/zh-CN/configure.ini
@@ -3242,6 +3242,9 @@ wiki_element_media_list = ""
 ; wiki_element.php line: 397
 wiki_element_ml_description = ""
 ;
+; wiki_element.php line: 399
+wiki_element_previewbutton = ""
+;
 ; wiki_element.php line: 414
 wiki_view_page_resources = ""
 ;
diff --git a/models/group_model.php b/models/group_model.php
index 857a2bd..36c844a 100644
--- a/models/group_model.php
+++ b/models/group_model.php
@@ -969,7 +969,7 @@ class GroupModel extends Model
     function getPageInfoByName($group_id, $name, $locale_tag, $mode)
     {
         $db = $this->db;
-        if($mode == "edit") {
+        if($mode == "edit" || $mode == "api") {
             $sql = "SELECT HP.PAGE_ID AS ID, HP.PAGE AS PAGE,
                 GP.DISCUSS_THREAD AS DISCUSS_THREAD FROM GROUP_PAGE GP,
                 GROUP_PAGE_HISTORY HP WHERE GP.GROUP_ID = ?
diff --git a/resources/grouped.png b/resources/grouped.png
new file mode 100644
index 0000000000000000000000000000000000000000..328d7576ed70ee8384890c2f345cf448a03b2139
GIT binary patch
diff --git a/resources/list.png b/resources/list.png
new file mode 100644
index 0000000000000000000000000000000000000000..60e5f369347076049163ba5ce3ca53b0d7f39a3b
GIT binary patch
diff --git a/scripts/basic.js b/scripts/basic.js
index 52658e6..6d07541 100755
--- a/scripts/basic.js
+++ b/scripts/basic.js
@@ -180,3 +180,303 @@ 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.
+ */
+function toggleHelp(id, isMobile, target_c) 
+{
+    var activity = (target_c === "admin") ? 'current-activity' 
+    : 'small-margin-current-activity';
+    var images = document.querySelectorAll(".wiki-resource-image");
+    var all_help_elements =
+            document.getElementsByClassName(activity);
+    var help_node = all_help_elements[0];
+    if (current_activity_closed === true) {
+        current_activity_top = getCssProperty(help_node, 'top');
+    }
+    obj = elt(id);
+
+    if (isMobile === false) {
+        toggleDisplay(id);
+        var new_width;
+        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;
+        } else if (obj.style.display === "block") {
+            new_width = Math.floor(getCssProperty(help_node, 'width'))
+                    - decrease_width_by;
+        }
+
+        if (new_width !== undefined) {
+            help_node.style.maxWidth = new_width + "px";
+        }
+    } else {
+        toggleDisplay(id);
+        var height_after_toggle = (obj.clientHeight);
+        //Calculate pixel to inch. clientWidth only returns in pixels.
+        if (obj.style.display === "none") {
+            //on closing, restore top
+            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";
+            /* The div.clientHeight doesnt include the height
+            of the images inside the div before the images are completely
+            loaded. So we iterate through the 
+            image elements, as each image loads add the image
+            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';
+                };
+            }
+            current_activity_closed = false;
+        }
+    }
+}
+
+/*
+ * gets the Css property given an element and property name.
+ * @param {Element} elm to get the Css property for
+ * @param {String} Css property name.
+ */
+function getCssProperty(elm, property)
+{
+    //always returns in px
+    return parseInt(window.getComputedStyle(elm, null)
+        .getPropertyValue(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
+ */
+function parseWikiContent(wiki_text, group_id, page_id)
+{
+    var html = wiki_text;
+    
+    /* note that line breaks from a text area are sent
+    as \r\n , so make sure we clean them up to replace
+    all \r\n with \n */
+    html = html.replace(/\r\n/g, "\n");
+
+    html = parseLists(html);
+
+    //Regex replace normal links
+    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
+        var p = l.replace(/[\[\]]/g, '').split(/ /);
+        var link = p.shift();
+        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
+                        + '>';
+            });
+
+    //Regex replace for Bold characters
+    html = html.replace(/'''(.*?)'''/g, function (match, contents) {
+        return '<b>' + contents + '</b>';
+    });
+
+    //Regex replace for Italic characters
+    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"/>';
+            });
+
+    //Regex replace for HR
+    html = html.replace(/----(.*?)/g, function (match, contents) {
+        return '<hr>' + contents + '</hr>';
+    });
+
+    //replace nowiki with pre tags
+    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";
+            });
+
+    return html;
+}
+
+/**
+ * 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) {
+        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
+                + '>';
+    });
+}
+
+/**
+ * get 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)
+{
+    var request = makeRequest();
+    request.open('GET', url, true);
+    request.responseType = response_type;
+    request.onload = function () {
+        var status = request.status;
+        if (status == 200) {
+            success_call_back && success_call_back(request.response);
+        } else {
+            error_handler && error_handler(status);
+        }
+    };
+    request.send();
+};
+
+/**
+ * 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
+ * or not.
+ */
+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";
+
+    if ((elt("help-frame").style.display) === "block") {
+        toggleHelp('help-frame', is_mobile,target_c);
+        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>' ;
+
+                toggleHelp('help-frame', is_mobile,target_c);
+            },
+            function (status) {
+                toggleHelp('help-frame', is_mobile,target_c);
+            });
+    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}
+ */
+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;
+}
+
+
+/**
+ * this function grabs the contents of the wiki text area, 
+ * 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
+ */
+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>";
+}
\ No newline at end of file
diff --git a/views/admin_view.php b/views/admin_view.php
index ddec49e..e3044d8 100755
--- a/views/admin_view.php
+++ b/views/admin_view.php
@@ -75,6 +75,7 @@ class AdminView extends View
         if(!MOBILE) {e(' ['.$data['CURRENT_ACTIVITY'].']');}?></span></h1>
         <?php
         $this->element("activity")->render($data);
+        $this->element("help")->render($data);
         if(isset($data['ELEMENT'])) {
             $element = $data['ELEMENT'];
             $this->element($element)->render($data);
diff --git a/views/api_view.php b/views/api_view.php
new file mode 100644
index 0000000..07ebb8b
--- /dev/null
+++ b/views/api_view.php
@@ -0,0 +1,61 @@
+<?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 view
+ * @license http://www.gnu.org/licenses/ GPL3
+ * @link http://www.seekquarry.com/
+ * @copyright 2009 - 2014
+ * @filesource
+ */
+if(!defined('BASE_DIR')) {echo "BAD REQUEST"; exit();}
+/**
+ * View used to draw and allow editing of wiki page when not in the admin view
+ * (so activities panel on side is not present.) This is also used to draw
+ * wiki pages for public groups when not logged.
+ *
+ * @author Eswara Rajesh Pinapala
+ * @package seek_quarry
+ * @subpackage view
+ */
+class ApiView extends View
+{
+    /** This view is drawn on a web layout
+     * @var string
+     */
+    var $layout = "api";
+
+    /**
+     * Draws a minimal container with a WikiElement in it on which a group
+     * wiki page can be drawn
+     *
+     * @param array $data with fields used for drawing the container and page
+     */
+    function renderView($data)
+    {
+        $this->element("api")->render($data);
+    }
+}
+?>
diff --git a/views/elements/api_element.php b/views/elements/api_element.php
new file mode 100644
index 0000000..bf958ac
--- /dev/null
+++ b/views/elements/api_element.php
@@ -0,0 +1,108 @@
+<?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 view
+ * @license http://www.gnu.org/licenses/ GPL3
+ * @link http://www.seekquarry.com/
+ * @copyright 2009 - 2014
+ * @filesource
+ */
+if (!defined('BASE_DIR')) {
+    echo "BAD REQUEST";
+    exit();
+}
+/** Loads common constants for web crawling */
+require_once BASE_DIR . "/lib/crawl_constants.php";
+
+/**
+ * Element responsible for drawing wiki pages in either admin or wiki view
+ * It is also responsible for rendering wiki history pages, and listings of
+ * wiki pages available for a group
+ *
+ * @author Eswara Rajesh Pinapala 
+ * @package seek_quarry
+ * @subpackage element
+ */
+class ApiElement extends Element implements CrawlConstants {
+
+    /**
+     * Draw a wiki page for group, or, depending on $data['MODE'] a listing
+     * of all pages for a group, or the history of revisions of a given page
+     * or the edit page form
+     *
+     * @param array $data fields contain data about the page being
+     * displayeed or edited, or the list of pages being displayed.
+     */
+    function render($data) {
+        $logged_in = isset($data["ADMIN"]) && $data["ADMIN"];
+        $can_edit = $logged_in && isset($data["CAN_EDIT"]) && $data["CAN_EDIT"];
+        $this->renderJsonDocument($data, $can_edit, $logged_in);
+    }
+
+    /**
+     * Used to send a Wiki content response for reading. If the page does 
+     * not exist various create/login-to-create etc messages are displayed 
+     * depending of it the user is logged in. and has write permissions 
+     * on the group.
+     * @param array $data fields PAGE used for page contents
+     * @param bool $can_edit whether the current user has permissions to
+     *     edit or create this page
+     * @param bool $logged_in whethe current user is logged in or not
+     */
+    function renderJsonDocument($data, $can_edit, $logged_in) {
+        $out_array = array();
+        if ($data["PAGE"]) {
+            $out_array["wiki_content"] = html_entity_decode($data['PAGE'], 
+                    ENT_QUOTES);
+            $out_array['group_id'] = $data['GROUP']['GROUP_ID'];
+            $out_array['group_name'] = $data['GROUP']['GROUP_NAME'];
+            $out_array['page_id'] = $data['PAGE_ID'];
+            $out_array['page_name'] = $data['PAGE_NAME'];
+            $http_code = 200;
+        } else if (!$logged_in) {
+            $out_array["logged_in"] = false;
+            $http_code = 401;
+        }
+        if ($can_edit) {
+            $out_array["can_edit"] = true;
+        }
+
+        if (isset($data['errors']) && count($data['errors']) > 0) {
+            $out_array['errors'] = json_encode(
+                    array_map(
+                            function($string) {
+                        return html_entity_decode($string, ENT_QUOTES);
+                    }, $data['errors']));
+        }
+
+        header("Content-Type: application/json");
+        http_response_code($http_code);
+        e(json_encode($out_array));
+        exit();
+    }
+
+}
diff --git a/views/elements/element.php b/views/elements/element.php
index 046ed54..c072811 100755
--- a/views/elements/element.php
+++ b/views/elements/element.php
@@ -67,5 +67,27 @@ 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 . '\')" '
+                . 'data-pagename="' . $help_point_id . '">?</button>';
+    }
+
 }
+
 ?>
diff --git a/views/elements/groupfeed_element.php b/views/elements/groupfeed_element.php
index b910273..db41425 100644
--- a/views/elements/groupfeed_element.php
+++ b/views/elements/groupfeed_element.php
@@ -158,12 +158,43 @@ class GroupfeedElement extends Element implements CrawlConstants
             ?>
             </h2>
             <?php
+            if(!isset($data['JUST_GROUP_ID'])){
+            e("<a href=\"" . $paging_query . "\">[U]</a>" . "  |  " );
+            e("<a href=\"" . $paging_query . "&amp;v=grouped\">[G]</a>". " " );
+            }
         }
         ?>
         <div>
         &nbsp;
         </div>
         <?php
+      if(isset($data['MODE']) && $data['MODE'] == 'grouped'){
+        //Grouped View
+        //var_dump($data['GROUPS']);
+        foreach($data['GROUPS'] as $group){
+            e("<div class=\"access-result\">" .
+                    "<div><b>" . 
+                    "<a href=\"$paging_query&amp;just_group_id=".
+                    $group['GROUP_ID']. "\" " .
+                    "rel=\"nofollow\">".
+                    $group['GROUP_NAME']."</a> " . 
+                    "[<a href=\"$paging_query&amp;group_id=".
+                    $group['GROUP_ID']. "&amp;a=wiki\">".
+                    tl('manageaccount_element_group_wiki') . "</a>] " .
+                    "(". tl('manageaccount_element_group_stats',
+                        $group['NUM_POSTS'], $group['NUM_THREADS']) . ")</b>" .
+                    "</div>" .
+                    "<div class=\"slight-pad\">" .
+                    "<b>" . tl('manageaccount_element_last_post') . "</b> " .
+                    "<a href=\"$paging_query&amp;just_thread=" .
+                    $group['THREAD_ID'] ."\">" .
+                    $group['ITEM_TITLE'] ."</a>" .
+                    "</div>" .
+                "</div>");
+        }
+        $data['TOTAL_ROWS'] = $data['NUM_GROUPS'];
+        $paging_query .= "&amp;v=grouped";
+       }else{
         $open_in_tabs = $data['OPEN_IN_TABS'];
         $time = time();
         $can_comment = array(GROUP_READ_COMMENT, GROUP_READ_WRITE,
@@ -375,6 +406,7 @@ class GroupfeedElement extends Element implements CrawlConstants
             </div>
             <?php
             } //end foreach
+       }//No grouped View
             $data['FRAGMENT'] = "";
             if(isset($data['JUST_THREAD']) && $logged_in) {
                 $data['FRAGMENT'] = '#result-'.$page['ID'];
@@ -397,6 +429,7 @@ class GroupfeedElement extends Element implements CrawlConstants
         if(!$is_status) {
             $this->renderScripts($data);
         }
+    
     }
     /**
      * Used to render the Javascript that appears at the non-status updating
@@ -462,7 +495,8 @@ class GroupfeedElement extends Element implements CrawlConstants
                     ?></label></b></h2>'+
                     '<textarea class="short-text-area" '+
                     'id="comment-'+ id +'" name="description" '+
-                    'data-buttons="all,!wikibtn-search,!wikibtn-heading,!wikibtn-slide" '+
+                    'data-buttons="all,!wikibtn-search,!wikibtn-heading,'+
+                    '!wikibtn-slide" '+
                     '></textarea>' +
                     '<button class="button-box float-opposite" ' +
                     'type="submit"><?php e(tl("groupfeed_element_save"));
diff --git a/views/elements/help_element.php b/views/elements/help_element.php
new file mode 100644
index 0000000..b360d2f
--- /dev/null
+++ b/views/elements/help_element.php
@@ -0,0 +1,100 @@
+<?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 element
+ *  @license http://www.gnu.org/licenses/ GPL3
+ *  @link http://www.seekquarry.com/
+ *  @copyright 2009 - 2014
+ *  @filesource
+ */
+if (!defined('BASE_DIR')) {
+    echo "BAD REQUEST";
+    exit();
+}
+
+/**
+ * This element is used to display the list of available activities
+ * in the AdminView
+ *
+ * @author Eswara Rajesh Pinapala
+ *
+ * @package seek_quarry
+ * @subpackage element
+ */
+class HelpElement extends Element {
+
+    /**
+     * Displays a list of admin activities
+     *
+     * @param array $data  available activities and CSRF token
+     */
+    function render($data) {
+        ?>
+        <?php
+            if (MOBILE) { ?>
+                <div id="mobile-help">
+                    <div id="help-frame" class="frame help-pane">
+                        <div id="help-frame-head">
+                            <h2 id="page_name"></h2>
+                        </div>
+
+                        <div id="help-frame-body" class="wordwrap">
+
+                        </div>
+                        <div id="help-frame-editor" class="wordwrap">
+
+                        </div>
+                    </div>
+                </div>
+            <?php } else {
+                if($data['c'] != 'admin'){
+                    $help_class_add = "small-margin-help-pane";
+                    $help_id ="small-margin-help";
+                }else{
+                    $help_id = "help";
+                }
+                ?>
+                <div id="<?php e($help_id); ?>">
+                  <div id="help-frame" class="frame help-pane <?php 
+                  e($help_class_add); ?>">
+                      <div id="help-frame-head">
+                          <h2 id="page_name"></h2>
+                      </div>
+
+                    <div id="help-frame-body" class="wordwrap">
+                       
+                    </div>
+                    <div id="help-frame-editor" class="wordwrap">
+
+                    </div>
+                  </div>
+                </div>
+                <?php
+            }
+    }
+
+}
+?>
\ No newline at end of file
diff --git a/views/elements/managegroups_element.php b/views/elements/managegroups_element.php
index fa06f58..3ebbc5f 100755
--- a/views/elements/managegroups_element.php
+++ b/views/elements/managegroups_element.php
@@ -93,6 +93,7 @@ class ManagegroupsElement extends Element
         <?php
             $group_url = "?c=admin&amp;".CSRF_TOKEN."=".$data[CSRF_TOKEN];
             $base_url = $group_url . "&amp;a=manageGroups";
+            $wiki_url = $group_url . "&amp;a=wiki&amp;group_id=";
             $group_url .= "&amp;a=groupFeeds&amp;just_group_id=";
             if(isset($data['browse'])) {
                 $base_url .= "&amp;browse=".$data['browse'];
@@ -199,7 +200,15 @@ class ManagegroupsElement extends Element
                         ($group['MEMBER_ACCESS'] != GROUP_PRIVATE ||
                         $group["OWNER_ID"] == $_SESSION['USER_ID'])) {
                         e("<td><a href='".$group_url.$group['GROUP_ID']."' >".
-                            $group_column."</a></td>");
+                            $group_column."</a>".
+                                " <a href=\"" 
+                                . $wiki_url. $group['GROUP_ID'] 
+                                ."\">"
+                                ."["
+                                . (tl('manageaccount_element_group_wiki')) 
+                                ."]"
+                                . "</a>"
+                                ."</td>");
                     } else {
                         e("<td>$group_column</td>");
                     }
@@ -317,7 +326,11 @@ class ManagegroupsElement extends Element
                 ?> /></td><?php
                 if($addgroup) { ?>
                     <td>[<a href="<?php e($browse_url); ?>"><?php 
-                        e(tl('managegroups_element_browse')); ?></a>]</td>
+                        e(tl('managegroups_element_browse')); ?></a>]
+                    <?php 
+                    e($this->renderHelpButton("browse_url", $data[CSRF_TOKEN],
+                            $_REQUEST['c']));
+                    ?></td>
                 <?php
                 }
         ?></tr>
@@ -385,11 +398,11 @@ class ManagegroupsElement extends Element
                         if($data['CURRENT_GROUP']['owner'] ==
                             $user_array['USER_NAME']) {
                             e("<td>".
-                                $data['MEMBERSHIP_CODES'][$user_array['STATUS']] .
+                            $data['MEMBERSHIP_CODES'][$user_array['STATUS']] .
                                 "</td>");
                             e("<td>" . tl('managegroups_element_groupowner') .
                                 "</td><td><span class='gray'>".
-                                tl('managegroups_element_delete')."</span></td>");
+                            tl('managegroups_element_delete')."</span></td>");
                         } else {
                             e("<td>".$data['MEMBERSHIP_CODES'][
                                 $user_array['STATUS']]);
diff --git a/views/elements/wiki_element.php b/views/elements/wiki_element.php
index d157de9..acd7510 100644
--- a/views/elements/wiki_element.php
+++ b/views/elements/wiki_element.php
@@ -391,8 +391,17 @@ class WikiElement extends Element implements CrawlConstants
             <div id="save-container" class="top-margin center">
             <button class="button-box" type="submit"><?php
                 e(tl('wiki_element_savebutton')); ?></button>
+            <button id="wiki-preview-btn" 
+                    onclick="javascript:renderPreview('<?php
+                        e($data["PAGE_ID"] . "','" 
+                      . $data['GROUP']['GROUP_ID']);
+            ?>')" class="button-box"><?php
+                e(tl('wiki_element_previewbutton')); ?></button>
             </div>
         </form>
+        <div id="wiki-preview">
+    
+        </div>
         <div class="top-margin" id="media-list-page">
         <h2><?php e(tl('wiki_element_media_list'))?></h2>
         <p><?php e(tl('wiki_element_ml_description'))?></p>
diff --git a/views/group_view.php b/views/group_view.php
index a5404ae..cf99488 100644
--- a/views/group_view.php
+++ b/views/group_view.php
@@ -114,6 +114,7 @@ class GroupView extends View implements CrawlConstants
             $element = $data['ELEMENT'];
             $this->element($element)->render($data);
         }
+        $this->element("help")->render($data);
         if(PROFILE) {
         ?>
         <script type="text/javascript">
diff --git a/views/layouts/api_layout.php b/views/layouts/api_layout.php
new file mode 100644
index 0000000..822fd77
--- /dev/null
+++ b/views/layouts/api_layout.php
@@ -0,0 +1,63 @@
+<?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 element
+ *  @license http://www.gnu.org/licenses/ GPL3
+ *  @link http://www.seekquarry.com/
+ *  @copyright 2009 - 2014
+ *  @filesource
+ */
+
+if (!defined('BASE_DIR')) {
+    echo "BAD REQUEST";
+    exit();
+}
+
+/**
+ * Layout used for the seek_quarry Website
+ * including pages such as search landing page
+ * and settings page
+ *
+ * @author Eswara Rajesh Pinapala
+ * @package seek_quarry
+ * @subpackage layout
+ */
+class ApiLayout extends Layout {
+
+    /**
+     * Responsible for drawing the prefix/suffix (if any for the API response)
+     *
+     * @param array $data  an array of data set up by the controller to be
+     * be used in drawing the WebLayout and its View.
+     */
+    function render($data) {
+        $this->view->renderView($data);
+    }
+
+}
+
+?>
-- 
1.9.3 (Apple Git-50)


From 585fd5d16a80e6749f9797b6a89c9c5d8bd26aaf Mon Sep 17 00:00:00 2001
From: epinapala <epinapala@ebay.com>
Date: Tue, 14 Oct 2014 22:29:54 -0700
Subject: [PATCH 2/3] Add icons for views

---
 resources/grouped.png                | Bin 4876 -> 3918 bytes
 resources/list.png                   | Bin 4842 -> 3851 bytes
 views/elements/groupfeed_element.php |   6 ++++--
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/resources/grouped.png b/resources/grouped.png
index 328d7576ed70ee8384890c2f345cf448a03b2139..e6e30c05eea2722b51707f1b4a904e91ecd0779f 100644
GIT binary patch
diff --git a/resources/list.png b/resources/list.png
index 60e5f369347076049163ba5ce3ca53b0d7f39a3b..2cc2dafb57500a4028573b743658f5c73eaf8c57 100644
GIT binary patch
diff --git a/views/elements/groupfeed_element.php b/views/elements/groupfeed_element.php
index db41425..2781fc7 100644
--- a/views/elements/groupfeed_element.php
+++ b/views/elements/groupfeed_element.php
@@ -159,8 +159,10 @@ class GroupfeedElement extends Element implements CrawlConstants
             </h2>
             <?php
             if(!isset($data['JUST_GROUP_ID'])){
-            e("<a href=\"" . $paging_query . "\">[U]</a>" . "  |  " );
-            e("<a href=\"" . $paging_query . "&amp;v=grouped\">[G]</a>". " " );
+            e("<a href=\"" . $paging_query . "\">"
+                    . "<img src=\"resources/list.png\" /></a>" . "  " );
+            e("<a href=\"" . $paging_query . "&amp;v=grouped\">"
+                    . "<img src=\"resources/grouped.png\" /></a>". " " );
             }
         }
         ?>
-- 
1.9.3 (Apple Git-50)


From 12c04b68a04a0d3cfe4b8193bfabc53189155e2d Mon Sep 17 00:00:00 2001
From: epinapala <epinapala@ebay.com>
Date: Tue, 14 Oct 2014 22:31:22 -0700
Subject: [PATCH 3/3] remove help button for now

---
 views/elements/managegroups_element.php | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/views/elements/managegroups_element.php b/views/elements/managegroups_element.php
index 3ebbc5f..dce2851 100755
--- a/views/elements/managegroups_element.php
+++ b/views/elements/managegroups_element.php
@@ -326,11 +326,7 @@ class ManagegroupsElement extends Element
                 ?> /></td><?php
                 if($addgroup) { ?>
                     <td>[<a href="<?php e($browse_url); ?>"><?php 
-                        e(tl('managegroups_element_browse')); ?></a>]
-                    <?php 
-                    e($this->renderHelpButton("browse_url", $data[CSRF_TOKEN],
-                            $_REQUEST['c']));
-                    ?></td>
+                        e(tl('managegroups_element_browse')); ?></a>]</td>
                 <?php
                 }
         ?></tr>
-- 
1.9.3 (Apple Git-50)

