// Get the Elgg engine
require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
-//grab the login form
-$login = elgg_view("account/forms/login");
-
-//temp message
-$area1 = "This site is running in walled garden mode. <br />
- Therefore you will need to be invited & logged in to see anything.";
+//grab the login form
+$login = elgg_view("account/forms/login_walledgarden");
+
//display the contents in our new canvas layout
-$body = elgg_view_layout('one_column_with_sidebar', $area1, $login);
-
-page_draw($title, $body);
\ No newline at end of file
+$body = elgg_view_layout('walled_garden',$login);
+
+page_draw_walledgarden($title, $body);
<?php
- /**
- * Walled garden support.
- *
- * @package ElggWalledGarden
- * @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.com/
- */
+/**
+ * Walled garden support.
+ */
- function walledgarden_init()
- {
- global $CONFIG;
+function walledgarden_init(){
+ global $CONFIG;
- $CONFIG->disable_registration = true;
+ $CONFIG->disable_registration = true;
- // elgg_set_viewtype('default');
- elgg_extend_view('pageshells/pageshell', 'walledgarden/walledgarden');
- elgg_extend_view('css','walledgarden/css');
-
- register_plugin_hook('new_twitter_user', 'twitter_service', 'walledgarden_new_twitter_user');
- }
+ // elgg_set_viewtype('default');
+ elgg_extend_view('pageshells/pageshell', 'walledgarden/walledgarden');
+ elgg_extend_view('css','walledgarden/css');
+
+ register_plugin_hook('new_twitter_user', 'twitter_service', 'walledgarden_new_twitter_user');
- function walledgarden_pagesetup() {
+ if(!isloggedin())
+ register_plugin_hook('index','system','walledgarden_index');
+}
+
+function walledgarden_pagesetup() {
- global $CONFIG;
- if (current_page_url() != $CONFIG->url
- && !defined('externalpage')
- && !isloggedin()) {
- forward();
- exit;
- }
+ global $CONFIG;
+ if (current_page_url() != $CONFIG->url
+ && !defined('externalpage')
+ && !isloggedin()) {
+ forward();
+ exit;
+ }
- }
+}
- function walledgarden_index() {
+function walledgarden_index() {
- if (!include_once(dirname(dirname(__FILE__))) . "/walledgarden/index.php") {
- return false;
- }
- return true;
+ if (!include_once(dirname(dirname(__FILE__))) . "/walledgarden/index.php") {
+ return false;
+ }
+ return true;
- }
+}
+
+function walledgarden_new_twitter_user($hook, $entity_type, $returnvalue, $params) {
+ // do not allow new users to be created within the walled-garden
+ register_error(elgg_echo('walledgarden:new_user:fail'));
+ return FALSE;
+}
+
+/**
+ * This is so the homepage can have its own pageshell
+ **/
+
+function page_draw_walledgarden($title, $body, $sidebar = "") {
+
+ // Draw the page
+ $output = elgg_view('page_shells/walled_garden_index', array(
+ 'title' => $title,
+ 'body' => $body,
+ 'sidebar' => $sidebar,
+ 'sysmessages' => system_messages(null,"")
+ )
+ );
+ $split_output = str_split($output, 1024);
- function walledgarden_new_twitter_user($hook, $entity_type, $returnvalue, $params) {
- // do not allow new users to be created within the walled-garden
- register_error(elgg_echo('walledgarden:new_user:fail'));
- return FALSE;
+ foreach($split_output as $chunk) {
+ echo $chunk;
}
+}
- register_elgg_event_handler('init','system','walledgarden_init');
- register_elgg_event_handler('pagesetup','system','walledgarden_pagesetup');
-?>
+register_elgg_event_handler('init','system','walledgarden_init');
+register_elgg_event_handler('pagesetup','system','walledgarden_pagesetup');
--- /dev/null
+<?php\r
+\r
+ /**\r
+ * Elgg login form for walled garden\r
+ */\r
+ \r
+ global $CONFIG;\r
+\r
+ //login form\r
+ $form_body = "<h2 class='master'>" . elgg_echo('login') . "</h2>";\r
+ $form_body .= "<label>".elgg_echo('username')."</label>".elgg_view('input/text', array('internalname' => 'username', 'class' => 'login-textarea username master'));\r
+ $form_body .= "<br /><label>".elgg_echo('password')."</label>".elgg_view('input/password', array('internalname' => 'password', 'class' => 'login-textarea password master' )); \r
+\r
+ \r
+ $form_body .= "<br />" . elgg_view('input/submit', array('value' => elgg_echo('login'))) . " <div id=\"persistent_login\"><label><input type=\"checkbox\" name=\"persistent\" value=\"true\" />".elgg_echo('user:persistent')."</label></div>";\r
+ $form_body .= "<p class=\"loginbox\">";\r
+ $form_body .= (!isset($CONFIG->disable_registration) || !($CONFIG->disable_registration)) ? "<a href=\"{$vars['url']}account/register.php\">" . elgg_echo('register') . "</a> | " : "";\r
+ $form_body .= "<a href='#forgotten_password' class='forgotten_password_link'>" . elgg_echo('user:password:lost') . "</a></p>"; \r
+\r
+\r
+ \r
+ $login_url = $vars['url'];\r
+ if ((isset($CONFIG->https_login)) && ($CONFIG->https_login))\r
+ $login_url = str_replace("http", "https", $vars['url']);\r
+?>\r
+ \r
+ <div id="login-box">\r
+ <?php \r
+ echo elgg_view('input/form', array('body' => $form_body, 'action' => "{$login_url}action/login"));\r
+ ?> \r
+ <div class="clearfloat"></div>\r
+ </div>\r
+\r
+ \r
+<script type="text/javascript"> \r
+ $(document).ready(function() { \r
+ \r
+ $('.login-textarea.username.master').focus(); // only put cursor in textfirld if master login\r
+ \r
+ $('.login-textarea.name').focus(function() {\r
+ if (this.value=='<?php echo elgg_echo('username'); ?>') {\r
+ this.value='';\r
+ }\r
+ });\r
+ $('.login-textarea.name').blur(function() {\r
+ if (this.value=='') {\r
+ this.value='<?php echo elgg_echo('username'); ?>';\r
+ }\r
+ });\r
+ $('.login-textarea.password').focus(function() {\r
+ if (this.value=='<?php echo elgg_echo('password'); ?>') {\r
+ this.value='';\r
+ }\r
+ });\r
+ \r
+ \r
+ //select all the a tag with name equal to modal\r
+ $('a.forgotten_password_link').click(function(e) {\r
+ //Cancel the link behavior\r
+ e.preventDefault();\r
+ \r
+ //Get the A tag\r
+ var id = $(this).attr('href');\r
+ \r
+ //Get the screen height and width\r
+ //var maskHeight = $(document).height();\r
+ //var maskWidth = $(window).width();\r
+ \r
+ //Set height and width to mask to fill up the whole screen\r
+ //$('#mask').css({'width':maskWidth,'height':maskHeight});\r
+ \r
+ //transition effect \r
+ $('#mask').fadeIn(500); \r
+ $('#mask').fadeTo("slow",0.8); \r
+ \r
+ //Get the window height and width\r
+ var winH = $(window).height();\r
+ var winW = $(window).width();\r
+ \r
+ //Set the popup window to center\r
+ $(id).css('top', winH/4-$(id).height()/2);\r
+ $(id).css('left', (winW-20)/2-$(id).width()/2);\r
+ \r
+ //transition effect\r
+ $(id).fadeIn(1000); \r
+ \r
+ });\r
+ \r
+ //if close button is clicked\r
+ $('.window .close').click(function (e) {\r
+ //Cancel the link behaviour\r
+ e.preventDefault();\r
+ \r
+ $('#mask').hide();\r
+ $('.window').hide();\r
+ }); \r
+ \r
+ //if mask is clicked\r
+ $('#mask').click(function () {\r
+ $(this).hide();\r
+ $('.window').hide();\r
+ }); \r
+ \r
+}); \r
+</script>\r
+ \r
+ \r
+ \r
+ \r
+
\ No newline at end of file
--- /dev/null
+<?php\r
+/**\r
+ * Elgg pageshell\r
+ * The standard HTML page shell that everything else fits into\r
+ *\r
+ * @package Elgg\r
+ * @subpackage Core\r
+ * @author Curverider Ltd\r
+ * @link http://elgg.org/\r
+ *\r
+ * @uses $vars['config'] The site configuration settings, imported\r
+ * @uses $vars['title'] The page title\r
+ * @uses $vars['body'] The main content of the page\r
+ * @uses $vars['messages'] A 2d array of various message registers, passed from system_messages()\r
+ */\r
+\r
+// Set the content type\r
+header("Content-type: text/html; charset=UTF-8");\r
+\r
+// Set title\r
+if (empty($vars['title'])) {\r
+ $title = $vars['config']->sitename;\r
+} else if (empty($vars['config']->sitename)) {\r
+ $title = $vars['title'];\r
+} else {\r
+ $title = $vars['config']->sitename . ": " . $vars['title'];\r
+}\r
+\r
+echo elgg_view('page_elements/html_begin', $vars);\r
+echo elgg_view('messages/list', array('object' => $vars['sysmessages']));\r
+?> \r
+ <style type="text/css">\r
+ /*\r
+body {background: white;}\r
+ #walledgardenlogin {\r
+ position:absolute;\r
+ bottom:0;\r
+ left:280px;\r
+ height:250px;\r
+ width:272px;\r
+ }\r
+ #walledgardenintro {\r
+ position: absolute;\r
+ bottom:15px;\r
+ left:25px;\r
+ height:215px;\r
+ width:232px;\r
+ padding:10px;\r
+ background-color: white;\r
+ -webkit-border-radius: 8px; \r
+ -moz-border-radius: 8px;\r
+ }\r
+ #walledgardenlogin #login-box {\r
+ background: none;\r
+ }\r
+ #walledgardenlogin #login-box h2 {\r
+ display:none;\r
+ }\r
+ #walledgardenlogin #login-box form {height:224px;padding:10px 10px 0;}\r
+ \r
+ .messages, .messages_error {\r
+ position: relative;\r
+ margin: auto;\r
+ }\r
+*/\r
+ \r
+ </style>\r
+<?php \r
+ echo "<div style='margin:20px auto;position:relative;padding:20px;width:523px;height:355px;background: url({$vars['url']}_graphics/login_back.gif) no-repeat top left;'>"; \r
+ echo "<div id='walledgardenintro'><h1>Welcome to:<br />" . $title . "</h1></div>";\r
+ echo "<div id='walledgardenlogin' class='whereamIused'>";\r
+ echo $vars['body'];\r
+ echo "</div></div>";\r
+ echo elgg_view('page_elements/html_end', $vars);\r
+?>\r
+\r