diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-09 00:52:52 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-09 00:52:52 +0000 |
commit | 4e2a58e02ae4fe55ebc801a816c6ddb304df4b18 (patch) | |
tree | f958306f06db27bc2182f30356bead605b2d4b93 /mod/sitepages/views | |
parent | 617ebb97d840cf77f3b483273f029732e8dc0db7 (diff) | |
download | elgg-4e2a58e02ae4fe55ebc801a816c6ddb304df4b18.tar.gz elgg-4e2a58e02ae4fe55ebc801a816c6ddb304df4b18.tar.bz2 |
Brought sitepages up to standards.
Added basic static keyword/view substitution support.
git-svn-id: http://code.elgg.org/elgg/trunk@5312 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/sitepages/views')
9 files changed, 197 insertions, 214 deletions
diff --git a/mod/sitepages/views/default/sitepages/analytics.php b/mod/sitepages/views/default/sitepages/analytics.php deleted file mode 100644 index 0a8e94b67..000000000 --- a/mod/sitepages/views/default/sitepages/analytics.php +++ /dev/null @@ -1,13 +0,0 @@ -<?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 deleted file mode 100644 index 5d7eabcd4..000000000 --- a/mod/sitepages/views/default/sitepages/css.php +++ /dev/null @@ -1,9 +0,0 @@ -<?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/custom_frontpage.php b/mod/sitepages/views/default/sitepages/custom_frontpage.php new file mode 100644 index 000000000..fb0b673cc --- /dev/null +++ b/mod/sitepages/views/default/sitepages/custom_frontpage.php @@ -0,0 +1,17 @@ +<?php +/** + * Custom front page. + * This is in a view so we can parse it for keywords. + * + * @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/ + */ + +$object = sitepages_get_sitepage_object('front'); + +if ($object) { + echo $object->description; +}
\ 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 index 94ec786b1..16100c10a 100644 --- a/mod/sitepages/views/default/sitepages/forms/edit.php +++ b/mod/sitepages/views/default/sitepages/forms/edit.php @@ -1,92 +1,51 @@ <?php +/** + * Edit non front or SEO site pages. + * + * @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/ + * + */ - /** - * 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 +$page_type = $vars['page_type']; +$action = 'sitepages/add'; - <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 +if ($sitepages_object = sitepages_get_sitepage_object($page_type)) { + $tags = $sitepages_object->tags; + $description = $sitepages_object->description; + $guid = $sitepages_object->getGUID(); +} else { + $tags = array(); + $description = ''; + $guid = ''; +} -EOT; -?> -<?php - //display the form - echo elgg_view('input/form', array('action' => "{$vars['url']}action/$action", 'body' => $form_body)); -?> +// set the required form variables +$input_area = elgg_view('input/longtext', array('internalname' => 'sitepages_content', 'value' => $description)); +$tag_input = elgg_view('input/tags', array('internalname' => 'sitepages_tags', 'value' => $tags)); + +$submit_input = elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('save'))); +$hidden_value = elgg_view('input/hidden', array('internalname' => 'page_type', 'value' => $page_type)); + +$tag_label = '<h3>' . elgg_echo('tags') . '</h3>'; +$external_page_title = elgg_echo("sitepages:$page_type"); + +$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; -<!-- 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 +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/editfront.php b/mod/sitepages/views/default/sitepages/forms/editfront.php index faea356f2..cc09b8cc8 100644 --- a/mod/sitepages/views/default/sitepages/forms/editfront.php +++ b/mod/sitepages/views/default/sitepages/forms/editfront.php @@ -1,52 +1,51 @@ <?php /** - * Elgg edit frontpage + * 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 -$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 = ""; + +$action = 'sitepages/addfront'; + +if ($sitepages_object = sitepages_get_sitepage_object('front')) { + $css = $sitepages_object->title; + $sitepages_content = $sitepages_object->description; + $guid = $sitepages_object->guid; +} else { + $css = ''; + $sitepages_content = ''; + $guid = ''; } - + // 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)); +$input_sitepages_content = elgg_view('input/plaintext', array('internalname' => 'sitepages_content', 'value' => $sitepages_content)); $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"); - + +$pageshell_title = elgg_echo("sitepages:front_content"); +$css_title = elgg_echo("sitepages:css"); + //preview link -$preview = "<div class=\"page_preview\"><a href=\"#preview\">" . elgg_echo('sitepages:preview') . "</a></div>"; - +// @todo this doesn't do anything. +//$preview = "<div class=\"page_preview\"><a href=\"#preview\">" . elgg_echo('sitepages:preview') . "</a></div>"; + //construct the form -$form_body = <<<EOT +$form_body = <<<___EOT - <h3 class='settings'>$css</h3> + <h3 class='settings'>$css_title</h3> <p class='longtext_editarea'>$input_css</p><br /> - <h3 class='settings'>$pageshell</h3> - <p class='longtext_editarea'>$input_pageshell</p> - + <h3 class='settings'>$pageshell_title</h3> + <p class='longtext_editarea'>$input_sitepages_content</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 +___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/forms/editmeta.php b/mod/sitepages/views/default/sitepages/forms/editmeta.php index 7eb731f76..d94f32114 100644 --- a/mod/sitepages/views/default/sitepages/forms/editmeta.php +++ b/mod/sitepages/views/default/sitepages/forms/editmeta.php @@ -1,48 +1,43 @@ <?php
/**
- * Elgg edit frontpage
+ * Edit form for the custom meta tags and desc
+ *
+ * @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
-$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 = "";
+
+$action = 'sitepages/addmeta';
+
+if ($sitepages_object = sitepages_get_sitepage_object('front')) {
+ $meta_tags = $sitepages_object->title;
+ $meta_description = $sitepages_object->description;
+} else {
+ $meta_tags = '';
+ $meta_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));
+
+$input_keywords = elgg_view('input/plaintext', array('internalname' => 'metatags', 'value' => $meta_tags));
+$input_description = elgg_view('input/plaintext', array('internalname' => 'description', 'value' => $meta_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
+
+$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 +___EOT;
+
+//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 index 2b4666256..e5348678a 100644 --- a/mod/sitepages/views/default/sitepages/keywords.php +++ b/mod/sitepages/views/default/sitepages/keywords.php @@ -1,14 +1,28 @@ <?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 + * Lists available keywords
+ *
+ * @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/
+ */
+
+$keywords = $vars['config']->sitepages_keywords;
+$title = elgg_echo('sitepages:keywords_title');
+$instructions = elgg_echo('sitepages:keywords_instructions');
+
+$keywords_html = '';
+foreach ($keywords as $keyword => $info) {
+ $desc = htmlentities($info['description']);
+ $keywords_html .= "<li><acronym title=\"$desc\">[[$keyword]]</acronym></li>";
+}
+
+echo "
+<h3>$title</h3>
+<p>$instructions</p>
+<ul>
+ $keywords_html
+</ul>
+";
\ No newline at end of file diff --git a/mod/sitepages/views/default/sitepages/menu.php b/mod/sitepages/views/default/sitepages/menu.php index 5f074f489..e676b6c96 100644 --- a/mod/sitepages/views/default/sitepages/menu.php +++ b/mod/sitepages/views/default/sitepages/menu.php @@ -1,22 +1,25 @@ <?php /** - * Elgg Site pages menu + * Displays the tabbed menu for editing site pages. + * + * @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/ */ - -//type -$type = $vars['type']; - -//set the url -$url = $vars['url'] . "pg/sitepages/index.php?type="; + +$page_type = $vars['page_type']; +$url = $vars['url'] . 'pg/sitepages/edit/'; ?> <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> + <li <?php if($page_type == 'front') echo "class = 'selected'"; ?>><a href="<?php echo $url; ?>front"><?php echo elgg_echo('sitepages:frontpage'); ?></a></li> + <li <?php if($page_type == 'about') echo "class = 'selected'"; ?>><a href="<?php echo $url; ?>about"><?php echo elgg_echo('sitepages:about'); ?></a></li> + <li <?php if($page_type == 'terms') echo "class = 'selected'"; ?>><a href="<?php echo $url; ?>terms"><?php echo elgg_echo('sitepages:terms'); ?></a></li> + <li <?php if($page_type == 'privacy') echo "class = 'selected'"; ?>><a href="<?php echo $url; ?>privacy"><?php echo elgg_echo('sitepages:privacy'); ?></a></li> + <li <?php if($page_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 index 73a7cd17f..c536dbe29 100644 --- a/mod/sitepages/views/default/sitepages/metatags.php +++ b/mod/sitepages/views/default/sitepages/metatags.php @@ -1,17 +1,35 @@ <?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;
- }
+ * Add any additional defined metatags or CSS.
+ *
+ * @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/
+ */
+
+$meta_details = sitepages_get_sitepage_object('seo');
+
+if ($meta_details) {
+ $metatags = $meta_details->title;
+ $description = $meta_details->description;
+
+ echo <<<___END
+ <meta name="description" content="$description" />
+ <meta name="keywords" content="$metatags" />
+___END;
}
-
-?>
-<meta name="description" content="<?php echo $description; ?>." />
-<meta name="keywords" content="<?php echo $metatags; ?>" />
\ No newline at end of file +// only show on the custom front page.
+if (get_context() == 'sitepages:front') {
+ $custom_css = sitepages_get_sitepage_object('front');
+
+ if ($custom_css && $custom_css->title) {
+ echo "
+ <style>
+ {$custom_css->title}
+ </style>
+ ";
+ }
+}
\ No newline at end of file |