diff options
author | dave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-05-24 10:27:53 +0000 |
---|---|---|
committer | dave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-05-24 10:27:53 +0000 |
commit | fe236ea096f092f38ea4d3517fd25fd084d28c6f (patch) | |
tree | 4210535cd663daaef81aa9186ec2de5866ad33f2 | |
parent | 3b970491b7bc84e8f7408b5858e49b75ae7a7d6c (diff) | |
download | elgg-fe236ea096f092f38ea4d3517fd25fd084d28c6f.tar.gz elgg-fe236ea096f092f38ea4d3517fd25fd084d28c6f.tar.bz2 |
a simple version of the sitepages index - we will need to turn this into a basic and advance selection for admins.
git-svn-id: http://code.elgg.org/elgg/trunk@6153 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | mod/sitepages/actions/addfrontsimple.php | 45 | ||||
-rw-r--r-- | mod/sitepages/index.php | 37 | ||||
-rw-r--r-- | mod/sitepages/languages/en.php | 15 | ||||
-rw-r--r-- | mod/sitepages/sitepages_functions.php | 2 | ||||
-rw-r--r-- | mod/sitepages/start.php | 25 | ||||
-rw-r--r-- | mod/sitepages/views/default/canvas/layouts/frontpage.php | 17 | ||||
-rw-r--r-- | mod/sitepages/views/default/sitepages/css.php | 7 | ||||
-rw-r--r-- | mod/sitepages/views/default/sitepages/forms/editfrontsimple.php | 61 | ||||
-rw-r--r-- | mod/sitepages/views/default/sitepages/members.php | 9 | ||||
-rw-r--r-- | mod/sitepages/views/default/sitepages/sidebar.php | 13 | ||||
-rw-r--r-- | mod/sitepages/views/default/sitepages/welcome.php | 13 |
11 files changed, 232 insertions, 12 deletions
diff --git a/mod/sitepages/actions/addfrontsimple.php b/mod/sitepages/actions/addfrontsimple.php new file mode 100644 index 000000000..ee26723e8 --- /dev/null +++ b/mod/sitepages/actions/addfrontsimple.php @@ -0,0 +1,45 @@ +<?php
+/**
+ * Site pages front page save/edit
+ *
+ * @package SitePages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ *
+ */
+
+admin_gatekeeper();
+
+$logged_in_content = get_input('logged_in_content', '', FALSE);
+$logged_out_content = get_input('logged_out_content', '', FALSE);
+
+$welcometitle = get_input('welcometitle', '', FALSE);
+$welcomemessage = get_input('welcomemessage', '', FALSE);
+$sidebartitle = get_input('sidebartitle', '', FALSE);
+$sidebarmessage = get_input('sidebarmessage', '', FALSE);
+
+$loggedin_user_guid = get_loggedin_userid();
+
+// Cache to the session for sticky forms
+// @todo does nothing yet.
+$_SESSION['sitepages:content'] = $content;
+$_SESSION['sitepages:css'] = $css;
+
+if (!$sitepagesimple = sitepages_get_sitepage_object('frontsimple')) {
+ $sitepagesimple = sitepages_create_sitepage_object('frontsimple');
+}
+
+$sitepagesimple->welcometitle = $welcometitle;
+$sitepagesimple->welcomemessage = $welcomemessage;
+$sitepagesimple->sidebartitle = $sidebartitle;
+$sitepagesimple->sidebarmessage = $sidebarmessage;
+
+if ($sitepagesimple->save()) {
+ system_message(elgg_echo("sitepagessimple:posted"));
+} else {
+ register_error(elgg_echo("sitepages:error"));
+}
+
+forward($_SERVER['HTTP_REFERER']);
diff --git a/mod/sitepages/index.php b/mod/sitepages/index.php new file mode 100644 index 000000000..516763bd2 --- /dev/null +++ b/mod/sitepages/index.php @@ -0,0 +1,37 @@ +<?php
+/**
+ * Elgg index page
+ *
+ */
+
+/**
+ * Start the Elgg engine
+ */
+
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+//Load the front page
+$content = elgg_view('sitepages/welcome');
+$content .= elgg_view_title(elgg_echo('content:latest'));
+set_context('search');
+$offset = (int)get_input('offset', 0);
+if(is_plugin_enabled('riverdashboard'))
+ $content .= elgg_view_river_items(0, 0, "", "", "", '', 10, 0, 0, true, true);
+else
+ $content .= elgg_list_registered_entities(array('limit' => 10, 'offset' => $offset, 'full_view' => FALSE, 'allowed_types' => array('object','group')));
+set_context('main');
+global $autofeed;
+$autofeed = FALSE;
+
+$members = elgg_get_entities_from_metadata(array(
+ 'metadata_names' => 'icontime',
+ 'types' => 'user',
+ 'owner_guid' => 0,
+ 'limit' => 10
+));
+//include sidebar free text
+$sidebar = elgg_view('sitepages/sidebar');
+$sidebar .= elgg_view('sitepages/members', array('members' => $members));
+
+$content = elgg_view_layout('frontpage', $content, $sidebar);
+page_draw(null, $content);
diff --git a/mod/sitepages/languages/en.php b/mod/sitepages/languages/en.php index 4e009a4a5..c9fdb46a8 100644 --- a/mod/sitepages/languages/en.php +++ b/mod/sitepages/languages/en.php @@ -31,7 +31,7 @@ $english = array( 'sitepages:seocreated' => "Your search engine information has been added", 'sitepages:logged_in_front_content' => "Logged in front page content", 'sitepages:logged_out_front_content' => "Logged out front page content", - 'sitepages:ownfront' => "Construct your own frontpage for this network. (Note:you will need to know html and css)", + 'sitepages:ownfront' => "Turn on the custom frontpage for this network.", 'sitepages:addcontent' => "You can add content here via your admin tools. Look for the external pages link under admin.", 'item:object:front' => 'Front page items', @@ -42,6 +42,19 @@ $english = array( */ 'sitepages:posted' => "Your page was successfully posted.", 'sitepages:deleted' => "Your page was successfully deleted.", + + /** + * Frontpage form + **/ + + 'sitepages:welcometitle' => 'Welcome title', + 'sitepages:welcomemessage' => 'Welcome message.', + 'sitepages:welcomeintro' => 'Use the following fields to construct a welcome title and message for your users.', + 'sitepages:sidebarintro' => 'Use the following input boxes to set a title and some content for the sidebar freeform content area.', + 'sitepages:sidebartitle' => 'Title', + 'sitepages:sidebarmessage' => 'Message.', + 'sitepages:warning' => 'We recommend that you keep this to less than 300 characters.', + 'sitepagessimple:posted' => 'The frontpage has successfully updated.', /** * Error messages diff --git a/mod/sitepages/sitepages_functions.php b/mod/sitepages/sitepages_functions.php index ac1f7d9f1..5e9a4adc2 100644 --- a/mod/sitepages/sitepages_functions.php +++ b/mod/sitepages/sitepages_functions.php @@ -67,7 +67,7 @@ function sitepages_get_edit_section_content($page_type) { switch ($page_type) { case 'front': - $view = 'sitepages/forms/editfront'; + $view = 'sitepages/forms/editfrontsimple'; break; case 'seo': diff --git a/mod/sitepages/start.php b/mod/sitepages/start.php index 2ce1d3312..457ed583c 100644 --- a/mod/sitepages/start.php +++ b/mod/sitepages/start.php @@ -39,7 +39,7 @@ function sitepages_init() { elgg_extend_view('metatags', 'sitepages/metatags'); // Replace the default index page if user has requested and the site is not running walled garden - if ((get_plugin_setting('ownfrontpage', 'sitepages') == 'yes') && (!is_plugin_enabled('walledgarden'))) { + if (get_plugin_setting('ownfrontpage', 'sitepages') == 'yes') { register_plugin_hook('index', 'system', 'sitepages_custom_index'); } @@ -52,6 +52,7 @@ function sitepages_init() { register_action("sitepages/add", FALSE, $CONFIG->pluginspath . "sitepages/actions/add.php"); register_action("sitepages/addfront", FALSE, $CONFIG->pluginspath . "sitepages/actions/addfront.php"); + register_action("sitepages/addfrontsimple", FALSE, $CONFIG->pluginspath . "sitepages/actions/addfrontsimple.php"); register_action("sitepages/addmeta", FALSE, $CONFIG->pluginspath . "sitepages/actions/addmeta.php"); register_action("sitepages/edit", FALSE, $CONFIG->pluginspath . "sitepages/actions/edit.php"); register_action("sitepages/delete", FALSE, $CONFIG->pluginspath . "sitepages/actions/delete.php"); @@ -74,21 +75,25 @@ function sitepages_runonce() { */ function sitepages_custom_index() { // context is checked by the extended metatags view to print out its custom CSS - $context = get_context(); - set_context('sitepages:front'); + //$context = get_context(); + //set_context('sitepages:front'); - if ($contents = elgg_view('sitepages/custom_frontpage')) { - page_draw(FALSE, $contents); + //if ($contents = elgg_view('sitepages/custom_frontpage')) { + // page_draw(FALSE, $contents); - set_context($context); + // set_context($context); // return TRUE to tell index.php we've got its content right here. - return TRUE; - } + // return TRUE; + //} - set_context($context); + //set_context($context); // return NULL to pass this to next in chain, or back to standard index.php. - return NULL; + //return NULL; + if (!include_once(dirname(dirname(__FILE__))) . "/sitepages/index.php") { + return false; + } + return true; } /** diff --git a/mod/sitepages/views/default/canvas/layouts/frontpage.php b/mod/sitepages/views/default/canvas/layouts/frontpage.php new file mode 100644 index 000000000..04ae75504 --- /dev/null +++ b/mod/sitepages/views/default/canvas/layouts/frontpage.php @@ -0,0 +1,17 @@ +<?php
+
+?>
+<div id="elgg_content" class="clearfloat">
+ <div id="elgg_sidebar" class="frontpage">
+ <?php
+ if (isset($vars['area2'])) echo $vars['area2'];
+ if (isset($vars['area3'])) echo $vars['area3'];
+ ?>
+ </div>
+
+ <div id="elgg_page_contents" class="frontpage clearfloat">
+ <?php
+ if (isset($vars['area1'])) echo $vars['area1'];
+ ?>
+ </div>
+</div>
diff --git a/mod/sitepages/views/default/sitepages/css.php b/mod/sitepages/views/default/sitepages/css.php new file mode 100644 index 000000000..9a2b84166 --- /dev/null +++ b/mod/sitepages/views/default/sitepages/css.php @@ -0,0 +1,7 @@ +#elgg_sidebar.frontpage { /* elgg sidebar */
+ width:260px;
+}
+
+#elgg_page_contents.frontpage { /* main page contents */
+ width:680px;
+}
\ No newline at end of file diff --git a/mod/sitepages/views/default/sitepages/forms/editfrontsimple.php b/mod/sitepages/views/default/sitepages/forms/editfrontsimple.php new file mode 100644 index 000000000..89f4e5673 --- /dev/null +++ b/mod/sitepages/views/default/sitepages/forms/editfrontsimple.php @@ -0,0 +1,61 @@ +<?php
+/**
+ * Edit form for the custom front page
+ *
+ * @package SitePages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.org/
+ */
+
+$action = 'sitepages/addfrontsimple';
+
+if($sitepages_object = sitepages_get_sitepage_object('frontsimple')){
+ $welcometitle = $sitepages_object->welcometitle;
+ $welcomemessage = $sitepages_object->welcomemessage;
+ $sidebartitle = $sitepages_object->sidebartitle;
+ $sidebarmessage = $sitepages_object->sidebarmessage;
+}else{
+ $welcometitle = "";
+ $welcomemessage = "";
+ $sidebartitle = "";
+ $sidebarmessage = "";
+}
+
+
+// set the required form variables
+$welcometitle_form = elgg_view('input/text', array('internalname' => 'welcometitle', 'value' => $welcometitle));
+$welcomemessage_form = elgg_view('input/longtext', array('internalname' => 'welcomemessage', 'value' => $welcomemessage, 'class' => 'input_textarea monospace'));
+$sidebartitle_form = elgg_view('input/text', array('internalname' => 'sidebartitle', 'value' => $sidebartitle));
+$sidebarmessage_form = elgg_view('input/longtext', array('internalname' => 'sidebarmessage', 'value' => $sidebarmessage, 'class' => 'input_textarea monospace'));;
+$submit_input = elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('save')));
+
+$welcomemessage_title = elgg_echo("sitepages:welcomemessage");
+$sidebarmessage_title = elgg_echo("sitepages:sidebarmessage");
+$welcometitle_title = elgg_echo("sitepages:welcometitle");
+$sidebartitle_title = elgg_echo("sitepages:sidebartitle");
+$welcome_intro = elgg_echo("sitepages:welcomeintro");
+$sidebar_intro = elgg_echo("sitepages:sidebarintro");
+
+//construct the form
+$form_body = <<<___EOT
+
+ <h2>$welcome_intro</h2>
+ <p><label>$welcometitle_title
+ $welcometitle_form</label></p>
+ <p><label>$welcomemessage_title
+ $welcomemessage_form</label></p>
+
+ <h2>$sidebar_intro</h2>
+ <p><label>$sidebartitle_title
+ $sidebartitle_form</label></p>
+ <p><label>$sidebarmessage_title
+ $sidebarmessage_form</label></p>
+
+ $hidden_guid
+ $submit_input
+
+___EOT;
+
+echo elgg_view('input/form', array('action' => "{$vars['url']}action/$action", 'body' => $form_body));
\ No newline at end of file diff --git a/mod/sitepages/views/default/sitepages/members.php b/mod/sitepages/views/default/sitepages/members.php new file mode 100644 index 000000000..3559f493a --- /dev/null +++ b/mod/sitepages/views/default/sitepages/members.php @@ -0,0 +1,9 @@ +<?php
+ $newest_members = $vars['members'];
+?>
+<h3><?php echo elgg_echo('riverdashboard:recentmembers') ?></h3>
+<?php
+ foreach($newest_members as $mem){
+ echo "<div class='entity_listing_icon'>" . elgg_view("profile/icon",array('entity' => $mem, 'size' => 'small')) . "</div>";
+ }
+?>
\ No newline at end of file diff --git a/mod/sitepages/views/default/sitepages/sidebar.php b/mod/sitepages/views/default/sitepages/sidebar.php new file mode 100644 index 000000000..8ec177fd8 --- /dev/null +++ b/mod/sitepages/views/default/sitepages/sidebar.php @@ -0,0 +1,13 @@ +<?php
+/**
+ * Admin welcome message
+ **/
+
+$sitepages_object = sitepages_get_sitepage_object('frontsimple');
+$sidebartitle = $sitepages_object->sidebartitle;
+$sidebarmessage = $sitepages_object->sidebarmessage;
+
+if($sidebarmessage){
+ echo "<h3>" . $sidebartitle . "</h3>";
+ echo $sidebarmessage;
+}
\ No newline at end of file diff --git a/mod/sitepages/views/default/sitepages/welcome.php b/mod/sitepages/views/default/sitepages/welcome.php new file mode 100644 index 000000000..bf97eb81f --- /dev/null +++ b/mod/sitepages/views/default/sitepages/welcome.php @@ -0,0 +1,13 @@ +<?php
+/**
+ * Admin welcome message
+ **/
+
+$sitepages_object = sitepages_get_sitepage_object('frontsimple');
+$welcometitle = $sitepages_object->welcometitle;
+$welcomemessage = $sitepages_object->welcomemessage;
+
+if($welcomemessage){
+ echo "<h2>" . $welcometitle . "</h2>";
+ echo $welcomemessage;
+}
\ No newline at end of file |