diff options
Diffstat (limited to 'mod/sitepages')
20 files changed, 725 insertions, 0 deletions
diff --git a/mod/sitepages/actions/add.php b/mod/sitepages/actions/add.php new file mode 100644 index 000000000..3b7f4eb2d --- /dev/null +++ b/mod/sitepages/actions/add.php @@ -0,0 +1,64 @@ +<?php +/** + * Elgg external pages: add/edit + */ + +// Make sure we're logged as admin +admin_gatekeeper(); + +// Get input data +$contents = get_input('sitepagescontent', '', false); +$type = get_input('content_type'); +$tags = get_input('sitepagestags'); +$previous_guid = get_input('expage_guid'); + +// Cache to the session +$_SESSION['sitepages_content'] = $contents; +$_SESSION['sitepagestype'] = $type; +$_SESSION['sitepagestags'] = $tags; + +// Convert string of tags into a preformatted array +$tagarray = string_to_tag_array($tags); + +// Make sure the content exists +if (empty($contents)) { + register_error(elgg_echo("sitepages:blank")); + forward("mod/sitepages/add.php"); + +// Otherwise, save the new external page +} else { + //remove the old external page + if(get_entity($previous_guid)){ + delete_entity($previous_guid); + } + + // Initialise a new ElggObject + $sitepages = new ElggObject(); + // Tell the system what type of external page it is + $sitepages->subtype = $type; + // Set its owner to the current user + $sitepages->owner_guid = $_SESSION['user']->getGUID(); + // For now, set its access to public + $sitepages->access_id = 2; + // Set its title and description appropriately + $sitepages->title = $type; + $sitepages->description = $contents; + // Before we can set metadata, save + if (!$sitepages->save()) { + register_error(elgg_echo("sitepages:error")); + forward("mod/sitepages/add.php"); + } + // Now let's add tags. We can pass an array directly to the object property! Easy. + if (is_array($tagarray)) { + $sitepages->tags = $tagarray; + } + // Success message + system_message(elgg_echo("sitepages:posted")); + // add to river + add_to_river('river/sitepages/create','create',$_SESSION['user']->guid,$sitepages->guid); + // Remove the cache + unset($_SESSION['sitepages_content']); unset($_SESSION['sitepagestitle']); unset($_SESSION['sitepagestags']); + + // Forward back to the page + forward("pg/sitepages/index.php?type={$type}"); +} diff --git a/mod/sitepages/actions/addfront.php b/mod/sitepages/actions/addfront.php new file mode 100644 index 000000000..5a86189db --- /dev/null +++ b/mod/sitepages/actions/addfront.php @@ -0,0 +1,51 @@ +<?php +/** + * Elgg front page: add/edit + */ + +// Make sure we're logged as admin +admin_gatekeeper(); + +// Get input data +$frontContents = get_input('frontContents'); +$css = get_input('css'); +$previous_guid = get_input('front_guid'); + +//remove the old front page +if(get_entity($previous_guid)){ + delete_entity($previous_guid); +} + +//var_export($pageshell);exit; + +// Cache to the session +$_SESSION['pageshell'] = $pageshell; +$_SESSION['css'] = $css; + +// Initialise a new ElggObject +$frontpage = new ElggObject(); +// Tell the system what type of external page it is +$frontpage->subtype = "frontpage"; +// Set its owner to the current user +$frontpage->owner_guid = $_SESSION['user']->getGUID(); +// Set its access to public +$frontpage->access_id = 2; +// Set its title and description appropriately +$frontpage->title = $css; +$frontpage->description = $frontContents; + +// Before we can set metadata, save +if (!$frontpage->save()) { + register_error(elgg_echo("sitepages:error")); + forward("pg/sitepages/index.php?type=front"); +} + +// Success message +system_message(elgg_echo("sitepages:posted")); + +// Remove the cache +unset($_SESSION['css']); unset($_SESSION['pageshell']); + + +// Forward back to the page +forward("pg/sitepages/index.php?type=front"); diff --git a/mod/sitepages/actions/addmeta.php b/mod/sitepages/actions/addmeta.php new file mode 100644 index 000000000..432152ef1 --- /dev/null +++ b/mod/sitepages/actions/addmeta.php @@ -0,0 +1,49 @@ +<?php
+/**
+ * Elgg SEO: add/edit
+ */
+
+// Make sure we're logged as admin
+admin_gatekeeper();
+
+// Get input data
+$description = get_input('description', '', false);
+$metatags = get_input('metatags', '', false);
+$previous_guid = get_input('seo_guid');
+
+//remove the old front page
+if(get_entity($previous_guid)){
+ delete_entity($previous_guid);
+}
+
+// Cache to the session
+$_SESSION['description'] = $description;
+$_SESSION['metatags'] = $metatags;
+
+// Initialise a new ElggObject
+$seo = new ElggObject();
+// Tell the system what type of external page it is
+$seo->subtype = "sitemeta";
+// Set its owner to the current user
+$seo->owner_guid = $_SESSION['user']->getGUID();
+// Set its access to public
+$seo->access_id = 2;
+// Set its title and description appropriately
+$seo->title = $metatags;
+$seo->description = $description;
+
+// Before we can set metadata, save
+if (!$seo->save()) {
+ register_error(elgg_echo("sitepages:error"));
+ forward("pg/sitepages/index.php?type=seo");
+}
+
+// Success message
+system_message(elgg_echo("sitepages:seocreated"));
+
+// Remove the cache
+unset($_SESSION['description']); unset($_SESSION['metatags']);
+
+
+// Forward back to the page
+forward("pg/sitepages/index.php?type=seo");
diff --git a/mod/sitepages/frontpage.php b/mod/sitepages/frontpage.php new file mode 100644 index 000000000..4f5d02a90 --- /dev/null +++ b/mod/sitepages/frontpage.php @@ -0,0 +1,70 @@ +<?php
+/**
+ * Elgg custom frontpage
+ */
+
+// Load Elgg engine will not include plugins
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+global $CONFIG;
+
+$page_contents = elgg_get_entities(array('type' => 'object', 'subtype' => 'frontpage', 'limit' => 1));
+if($page_contents){
+ foreach($page_contents as $pc){
+ $css = "<style>" . $pc->title . "</style>";
+ $frontContents = $pc->description;
+ }
+}
+
+// Set title
+$title = $CONFIG->sitename;
+
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta name="ElggRelease" content="<?php echo $release; ?>" />
+ <meta name="ElggVersion" content="<?php echo $version; ?>" />
+ <title><?php echo $title; ?></title>
+ <link REL="SHORTCUT ICON" HREF="<?php echo $CONFIG->wwwroot; ?>_graphics/favicon.ico">
+
+ <script type="text/javascript" src="<?php echo $CONFIG->wwwroot; ?>vendors/jquery/jquery-1.4.min.js"></script>
+ <script type="text/javascript" src="<?php echo $CONFIG->wwwroot; ?>vendors/jquery/jquery-ui-1.7.2.min.js"></script>
+ <script type="text/javascript" src="<?php echo $CONFIG->wwwroot; ?>vendors/jquery/jquery.form.js"></script>
+ <script type="text/javascript" src="<?php echo $CONFIG->wwwroot; ?>vendors/jquery/custom-form-elements.js"></script>
+ <script type="text/javascript" src="<?php echo $CONFIG->wwwroot; ?>_css/js.php?lastcache=<?php echo $CONFIG->lastcache; ?>&js=initialise_elgg&viewtype=<?php echo $vars['view']; ?>"></script>
+
+ <?php
+ echo $feedref;
+ //custom css - need to cache this. It is here instead of extending the main css
+ //as we don't want it appearing anywhere else throughout the site, only the frontpage.
+ echo $css;
+ echo elgg_view('metatags',$vars);
+ ?>
+ <script type="text/javascript">
+ jQuery(document).ready(function($) {
+ });
+ </script>
+
+<?php
+ global $pickerinuse;
+ if (isset($pickerinuse) && $pickerinuse == true) {
+?>
+ <!-- only needed on pages where we have friends collections and/or the friends picker -->
+ <script type="text/javascript" src="<?php echo $CONFIG->wwwroot; ?>vendors/jquery/jquery.easing.1.3.packed.js"></script>
+ <script type="text/javascript" src="<?php echo $CONFIG->wwwroot; ?>_css/js.php?lastcache=<?php echo $vars['config']->lastcache; ?>&js=friendsPickerv1&viewtype=<?php echo $vars['view']; ?>"></script>
+<?php
+ }
+?>
+ <!-- include the default css file -->
+ <link rel="stylesheet" href="<?php echo $CONFIG->wwwroot; ?>_css/css.css?lastcache=<?php echo $CONFIG->lastcache; ?>&viewtype=<?php echo $CONFIG->view; ?>" type="text/css" />
+</head>
+<body>
+<?php echo elgg_view('page_elements/elgg_topbar', $vars); ?>
+<?php echo elgg_view('page_elements/elgg_header', $vars); ?>
+<?php
+ echo parse_frontpage($frontContents);
+?>
+<?php echo elgg_view('page_elements/elgg_footer', $vars); ?>
+<?php echo elgg_view('page_elements/html_end', $vars); ?>
\ No newline at end of file diff --git a/mod/sitepages/index.php b/mod/sitepages/index.php new file mode 100644 index 000000000..efc7371b7 --- /dev/null +++ b/mod/sitepages/index.php @@ -0,0 +1,37 @@ +<?php +/** + * Elgg Site pages + */ + +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + +admin_gatekeeper(); +set_context('admin'); +$type = get_input('type'); //the type of page e.g about, terms etc +if(!$type) + $type = "front"; //default to the frontpage + +// Set admin user for user block +set_page_owner($_SESSION['guid']); + +//display the title +$title = elgg_view_title(elgg_echo('sitepages')); + +// Display the correct form +if($type == "front") + $edit = elgg_view('sitepages/forms/editfront'); +elseif($type == "seo") + $edit = elgg_view('sitepages/forms/editmeta'); +else + $edit = elgg_view('sitepages/forms/edit', array('type' => $type)); + +if($type == "front") + $area3 = elgg_view('sitepages/keywords'); //available keywords for the user +else + $area3 = ""; + +// Display the menu +$body = elgg_view('page_elements/elgg_content',array('body' => elgg_view('sitepages/menu', array('type' => $type)).$edit)); + +// Display +page_draw(elgg_echo('sitepages'),elgg_view_layout("one_column_with_sidebar", '', $title . $body, $area3));
\ No newline at end of file diff --git a/mod/sitepages/languages/en.php b/mod/sitepages/languages/en.php new file mode 100644 index 000000000..2f4916ee5 --- /dev/null +++ b/mod/sitepages/languages/en.php @@ -0,0 +1,48 @@ +<?php + + $english = array( + + /** + * Menu items and titles + */ + + 'sitepages' => "Site pages", + 'sitepages:frontpage' => "Frontpage", + 'sitepages:about' => "About", + 'sitepages:terms' => "Terms", + 'sitepages:privacy' => "Privacy", + 'sitepages:analytics' => "Analytics", + 'sitepages:contact' => "Contact", + 'sitepages:nopreview' => "No preview yet available", + 'sitepages:preview' => "Preview", + 'sitepages:notset' => "This page has not been set up yet.", + 'sitepages:new' => "New page", + 'sitepages:css' => "Stylesheet", + 'sitepages:seo' => "Metatags", + 'sitepages:metadescription' => "Meta description for search engines", + 'sitepages:metatags' => "Meta tags for search engines (use a comma)", + 'sitepages:seocreated' => "Your search engine information has been added", + 'sitepages:frontContents' => "Frontpage contents", + 'sitepages:ownfront' => "Construct your own frontpage for this network. (Note:you will need to know html and css)", + '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', + + /** + * Status messages + */ + + 'sitepages:posted' => "Your page was successfully posted.", + 'sitepages:deleted' => "Your page was successfully deleted.", + + /** + * Error messages + */ + + 'sitepages:deleteerror' => "There was a problem deleting the old page", + 'sitepages:error' => "There has been an error, please try again and if the problem persists, contact the administrator", + + ); + + add_translation("en",$english); + +?>
\ No newline at end of file diff --git a/mod/sitepages/manifest.xml b/mod/sitepages/manifest.xml new file mode 100644 index 000000000..9714a47c5 --- /dev/null +++ b/mod/sitepages/manifest.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plugin_manifest> + <field key="author" value="Curverider" /> + <field key="version" value="1.0" /> + <field key="description" value="This is a very simple plugin that lets the site admin populate an about page, terms and privacy page. You can also edit the frontpage if you know a little html/css." /> + <field key="website" value="http://www.elgg.org/" /> + <field key="copyright" value="(C) Curverider 2008-2010" /> + <field key="licence" value="GNU Public License version 2" /> + <field key="elgg_version" value="2009030702" /> +</plugin_manifest> diff --git a/mod/sitepages/read.php b/mod/sitepages/read.php new file mode 100644 index 000000000..5621c486b --- /dev/null +++ b/mod/sitepages/read.php @@ -0,0 +1,31 @@ +<?php +/** + * Elgg read site page + */ + +// Load Elgg engine +define('externalpage',true); +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + +// set some variables +$type = get_input('sitepages'); + +// Set the title appropriately +$area1 = elgg_view_title(elgg_echo("sitepages:". strtolower($type))); + +//get contents +$contents = elgg_get_entities(array('type' => 'object', 'subtype' => $type, 'limit' => 1)); + +if($contents){ + foreach($contents as $c){ + $area1 .= elgg_view('page_elements/elgg_content',array('body' => $c->description)); + } +}else{ + $area1 .= elgg_view('page_elements/elgg_content',array('body' => elgg_echo("sitepages:notset"))); +} + +// Display through the correct canvas area +$body = elgg_view_layout("one_column_with_sidebar", "", $area1); + +// Display page +page_draw($title,$body);
\ No newline at end of file diff --git a/mod/sitepages/sitepages_functions.php b/mod/sitepages/sitepages_functions.php new file mode 100644 index 000000000..561aae97c --- /dev/null +++ b/mod/sitepages/sitepages_functions.php @@ -0,0 +1,8 @@ +<?php
+/**
+ * This will hold the required keyword functions to display frontpage content
+ **/
+
+function parse_frontpage($frontContents){
+ echo htmlspecialchars_decode($frontContents, ENT_NOQUOTES);
+}
\ No newline at end of file diff --git a/mod/sitepages/start.php b/mod/sitepages/start.php new file mode 100644 index 000000000..c6e119959 --- /dev/null +++ b/mod/sitepages/start.php @@ -0,0 +1,72 @@ +<?php +/** + * Elgg external pages editor + */ + +require_once(dirname(__FILE__) . '/sitepages_functions.php'); + +function sitepages_init() { + global $CONFIG; + // Register a page handler, so we can have nice URLs + register_page_handler('sitepages','sitepages_page_handler'); + + // Register a URL handler for external pages + register_entity_url_handler('sitepages_url','object','sitepages'); + + // extend views + elgg_extend_view('footer/links', 'sitepages/footer_menu'); + elgg_extend_view('metatags', 'sitepages/metatags'); + + // Replace the default index page if user has requested + if (get_plugin_setting('ownfrontpage', 'externalpages') == 'yes'){ + register_plugin_hook('index','system','custom_index'); + } + +} + +function custom_index() { + if (!@include_once(dirname(__FILE__) . "/frontpage.php")) return false; + return true; +} + +/** + * Page setup. Adds admin controls to the admin panel. + * + */ +function sitepages_pagesetup(){ + if (get_context() == 'admin' && isadminloggedin()) { + global $CONFIG; + add_submenu_item(elgg_echo('sitepages'), $CONFIG->wwwroot . 'pg/sitepages/'); + } +} + +function sitepages_url($expage) { + global $CONFIG; + return $CONFIG->url . "pg/sitepages/"; +} + +function sitepages_page_handler($page) { + global $CONFIG; + if ($page[0]){ + switch ($page[0]){ + case "read": set_input('sitepages',$page[1]); + include(dirname(__FILE__) . "/read.php"); + break; + default : include($CONFIG->pluginspath . "sitepages/index.php"); + } + }else{ + include($CONFIG->pluginspath . "sitepages/index.php"); + } +} + +// Initialise log browser +register_elgg_event_handler('init','system','sitepages_init'); +register_elgg_event_handler('pagesetup','system','sitepages_pagesetup'); + +// Register actions +global $CONFIG; +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/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");
\ No newline at end of file diff --git a/mod/sitepages/views/default/settings/sitepages/edit.php b/mod/sitepages/views/default/settings/sitepages/edit.php new file mode 100644 index 000000000..22f03abaf --- /dev/null +++ b/mod/sitepages/views/default/settings/sitepages/edit.php @@ -0,0 +1,7 @@ +<p>
+ <?php echo elgg_echo('sitepages:ownfront'); ?>
+ <select name="params[ownfrontpage]">
+ <option value="yes" <?php if ($vars['entity']->ownfrontpage == 'yes') echo " selected=\"yes\" "; ?>><?php echo elgg_echo('option:yes'); ?></option>
+ <option value="no" <?php if ($vars['entity']->ownfrontpage != 'yes') echo " selected=\"yes\" "; ?>><?php echo elgg_echo('option:no'); ?></option>
+ </select>
+</p>
\ No newline at end of file diff --git a/mod/sitepages/views/default/sitepages/analytics.php b/mod/sitepages/views/default/sitepages/analytics.php new file mode 100644 index 000000000..0a8e94b67 --- /dev/null +++ b/mod/sitepages/views/default/sitepages/analytics.php @@ -0,0 +1,13 @@ +<?php +/** + * Elgg Analytics view + */ + +//get analytics content +$contents = elgg_get_entities(array('type' => 'object', 'subtype' => 'analytics', 'limit' => 1)); +if($contents){ + foreach($contents as $c){ + echo $c->description; + } +} + diff --git a/mod/sitepages/views/default/sitepages/css.php b/mod/sitepages/views/default/sitepages/css.php new file mode 100644 index 000000000..5d7eabcd4 --- /dev/null +++ b/mod/sitepages/views/default/sitepages/css.php @@ -0,0 +1,9 @@ +<?php +/** + * Elgg sitepages CSS + */ +?> + +/* IE6 */ +* html #front_left_tbl { width:676px !important; } +* html #front_right_tbl { width:676px !important; }
\ No newline at end of file diff --git a/mod/sitepages/views/default/sitepages/footer_menu.php b/mod/sitepages/views/default/sitepages/footer_menu.php new file mode 100644 index 000000000..5137e0f21 --- /dev/null +++ b/mod/sitepages/views/default/sitepages/footer_menu.php @@ -0,0 +1,11 @@ +<?php +/** + * Elgg External pages footer menu + */ +?> + +<div class="footer_toolbar_links">| +<a href="<?php echo $vars['url']; ?>pg/sitepages/read/About/"><?php echo elgg_echo('sitepages:about'); ?></a> | +<a href="<?php echo $vars['url']; ?>pg/sitepages/read/Terms/"><?php echo elgg_echo('sitepages:terms'); ?></a> | +<a href="<?php echo $vars['url']; ?>pg/sitepages/read/Privacy/"><?php echo elgg_echo('sitepages:privacy'); ?></a> | +</div>
\ No newline at end of file diff --git a/mod/sitepages/views/default/sitepages/forms/edit.php b/mod/sitepages/views/default/sitepages/forms/edit.php new file mode 100644 index 000000000..94ec786b1 --- /dev/null +++ b/mod/sitepages/views/default/sitepages/forms/edit.php @@ -0,0 +1,92 @@ +<?php + + /** + * Elgg sitepages edit + * + * @package Elggsitepages + * @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/ + * + */ + + //get the page type + $type = $vars['type']; + + //action + $action = "sitepages/add"; + + //grab the required entity + $page_contents = elgg_get_entities(array('type' => 'object', 'subtype' => $type, 'limit' => 1)); + + if($page_contents){ + foreach($page_contents as $pc){ + $description = $pc->description; + $tags = $pc->tags; + $guid = $pc->guid; + } + }else { + $tags = ""; + $description = ""; + } + + // set the required form variables + $input_area = elgg_view('input/longtext', array('internalname' => 'sitepagescontent', 'value' => $description)); + $tag_input = elgg_view('input/tags', array('internalname' => 'sitepagestags', 'value' => $tags)); + $submit_input = elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('save'))); + $hidden_value = elgg_view('input/hidden', array('internalname' => 'content_type', 'value' => $type)); + $hidden_guid = elgg_view('input/hidden', array('internalname' => 'expage_guid', 'value' => $guid)); + $tag_label = elgg_echo('tags') . "<br/>"; + + //type + $type = $vars['type']; + //set the url + $url = $vars['url'] . "pg/sitepages/index.php?type="; + + if($type == 'about') { + $external_page_title = elgg_echo('sitepages:about'); + } + else if($type == 'terms') { + $external_page_title = elgg_echo('sitepages:terms'); + } + else if($type == 'privacy') { + $external_page_title = elgg_echo('sitepages:privacy'); + } + //preview link + // echo "<div class=\"page_preview\"><a href=\"#preview\">" . elgg_echo('sitepages:preview') . "</a></div>"; + + //construct the form + $form_body = <<<EOT + + <h3 class='settings'>$external_page_title</h3> + <p class='longtext_editarea'>$input_area</p> + <p> + $tag_label + $tag_input + </p> + $hidden_value + $hidden_guid + <br /> + $submit_input + +EOT; +?> +<?php + //display the form + echo elgg_view('input/form', array('action' => "{$vars['url']}action/$action", 'body' => $form_body)); +?> + +<!-- preview page contents --> +<!-- +<div class="expage_preview"> +<a name="preview"></a> +<h2>Preview</h2> +<?php + if($description) + echo $description; + else + echo elgg_echo('sitepages:nopreview'); +?> +</div> +-->
\ No newline at end of file diff --git a/mod/sitepages/views/default/sitepages/forms/editfront.php b/mod/sitepages/views/default/sitepages/forms/editfront.php new file mode 100644 index 000000000..faea356f2 --- /dev/null +++ b/mod/sitepages/views/default/sitepages/forms/editfront.php @@ -0,0 +1,52 @@ +<?php +/** + * Elgg edit frontpage + */ + +//action +$action = "sitepages/addfront"; + +//grab the required entity +$page_contents = elgg_get_entities(array('type' => 'object', 'subtype' => 'frontpage', 'limit' => 1)); + +if($page_contents){ + foreach($page_contents as $pc){ + $css = $pc->title; + $frontContents = $pc->description; + $guid = $pc->guid; + } +}else { + $tags = ""; + $description = ""; +} + +// set the required form variables +$input_css = elgg_view('input/plaintext', array('internalname' => 'css', 'value' => $css)); +$input_pageshell = elgg_view('input/plaintext', array('internalname' => 'frontContents', 'value' => $frontContents)); +$submit_input = elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('save'))); +$hidden_guid = elgg_view('input/hidden', array('internalname' => 'front_guid', 'value' => $guid)); +$pageshell = elgg_echo("sitepages:frontContents"); +$css = elgg_echo("sitepages:css"); + +//preview link +$preview = "<div class=\"page_preview\"><a href=\"#preview\">" . elgg_echo('sitepages:preview') . "</a></div>"; + +//construct the form +$form_body = <<<EOT + + <h3 class='settings'>$css</h3> + <p class='longtext_editarea'>$input_css</p><br /> + <h3 class='settings'>$pageshell</h3> + <p class='longtext_editarea'>$input_pageshell</p> + + $hidden_guid + <br /> + $submit_input + $preview + +EOT; +?> +<?php + //display the form + 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/forms/editmeta.php b/mod/sitepages/views/default/sitepages/forms/editmeta.php new file mode 100644 index 000000000..7eb731f76 --- /dev/null +++ b/mod/sitepages/views/default/sitepages/forms/editmeta.php @@ -0,0 +1,48 @@ +<?php
+/**
+ * Elgg edit frontpage
+ */
+
+//action
+$action = "sitepages/addmeta";
+
+//grab the required entity
+$page_contents = elgg_get_entities(array('type' => 'object', 'subtype' => 'sitemeta', 'limit' => 1));
+
+if($page_contents){
+ foreach($page_contents as $pc){
+ $metatags = $pc->title;
+ $description = $pc->description;
+ $guid = $pc->guid;
+ }
+}else {
+ $metatags = "";
+ $description = "";
+}
+
+// set the required form variables
+$input_keywords = elgg_view('input/plaintext', array('internalname' => 'metatags', 'value' => $metatags));
+$input_description = elgg_view('input/plaintext', array('internalname' => 'description', 'value' => $description));
+$submit_input = elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('save')));
+$hidden_guid = elgg_view('input/hidden', array('internalname' => 'seo_guid', 'value' => $guid));
+$description = elgg_echo("sitepages:metadescription");
+$metatags = elgg_echo("sitepages:metatags");
+
+//construct the form
+$form_body = <<<EOT
+
+ <h3 class='settings'>$description</h3>
+ <p class='longtext_editarea'>$input_description</p><br />
+ <h3 class='settings'>$metatags</h3>
+ <p class='longtext_editarea'>$input_keywords</p>
+
+ $hidden_guid
+ <br />
+ $submit_input
+
+EOT;
+?>
+<?php
+ //display the form
+ 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/keywords.php b/mod/sitepages/views/default/sitepages/keywords.php new file mode 100644 index 000000000..2b4666256 --- /dev/null +++ b/mod/sitepages/views/default/sitepages/keywords.php @@ -0,0 +1,14 @@ +<?php
+/**
+ * Available keywords, this will be pulled from activated plugin that expose a keyword function
+ **/
+?>
+<div class="contentWrapper">
+ <h3>Available keywords</h3>
+ <ul>
+ <li>{{element:loginbox}}</li>
+ <li>{{element:stats}}</li>
+ <li>{{object:blog}}</li>
+ <li>{{group:4}}</li>
+ </ul>
+</div>
\ No newline at end of file diff --git a/mod/sitepages/views/default/sitepages/menu.php b/mod/sitepages/views/default/sitepages/menu.php new file mode 100644 index 000000000..5f074f489 --- /dev/null +++ b/mod/sitepages/views/default/sitepages/menu.php @@ -0,0 +1,22 @@ +<?php +/** + * Elgg Site pages menu + */ + +//type +$type = $vars['type']; + +//set the url +$url = $vars['url'] . "pg/sitepages/index.php?type="; + +?> + +<div class="elgg_horizontal_tabbed_nav"> +<ul> + <li <?php if($type == 'front') echo "class = 'selected'"; ?>><a href="<?php echo $url; ?>front"><?php echo elgg_echo('sitepages:frontpage'); ?></a></li> + <li <?php if($type == 'about') echo "class = 'selected'"; ?>><a href="<?php echo $url; ?>about"><?php echo elgg_echo('sitepages:about'); ?></a></li> + <li <?php if($type == 'terms') echo "class = 'selected'"; ?>><a href="<?php echo $url; ?>terms"><?php echo elgg_echo('sitepages:terms'); ?></a></li> + <li <?php if($type == 'privacy') echo "class = 'selected'"; ?>><a href="<?php echo $url; ?>privacy"><?php echo elgg_echo('sitepages:privacy'); ?></a></li> + <li <?php if($type == 'seo') echo "class = 'selected'"; ?>><a href="<?php echo $url; ?>seo"><?php echo elgg_echo('sitepages:seo'); ?></a></li> +</ul> +</div>
\ No newline at end of file diff --git a/mod/sitepages/views/default/sitepages/metatags.php b/mod/sitepages/views/default/sitepages/metatags.php new file mode 100644 index 000000000..73a7cd17f --- /dev/null +++ b/mod/sitepages/views/default/sitepages/metatags.php @@ -0,0 +1,17 @@ +<?php
+/**
+ * Meta tags
+ **/
+
+$meta_details = elgg_get_entities(array('type' => 'object', 'subtype' => 'seo', 'limit' => 1));
+if($meta_details){
+ foreach($meta_details as $md){
+ $metatags = $md->title;
+ $description = $md->description;
+ }
+}
+
+?>
+
+<meta name="description" content="<?php echo $description; ?>." />
+<meta name="keywords" content="<?php echo $metatags; ?>" />
\ No newline at end of file |