aboutsummaryrefslogtreecommitdiff
path: root/mod/walledgarden
diff options
context:
space:
mode:
Diffstat (limited to 'mod/walledgarden')
-rw-r--r--mod/walledgarden/index.php16
-rw-r--r--mod/walledgarden/start.php98
-rw-r--r--mod/walledgarden/views/default/account/forms/login_walledgarden.php110
-rw-r--r--mod/walledgarden/views/default/page_shells/walled_garden_index.php76
4 files changed, 249 insertions, 51 deletions
diff --git a/mod/walledgarden/index.php b/mod/walledgarden/index.php
index b5b6e57c6..98ed8479f 100644
--- a/mod/walledgarden/index.php
+++ b/mod/walledgarden/index.php
@@ -11,15 +11,11 @@
// 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);
diff --git a/mod/walledgarden/start.php b/mod/walledgarden/start.php
index c64ca8b5b..260a8c1e4 100644
--- a/mod/walledgarden/start.php
+++ b/mod/walledgarden/start.php
@@ -1,55 +1,71 @@
<?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');
diff --git a/mod/walledgarden/views/default/account/forms/login_walledgarden.php b/mod/walledgarden/views/default/account/forms/login_walledgarden.php
new file mode 100644
index 000000000..3589209fe
--- /dev/null
+++ b/mod/walledgarden/views/default/account/forms/login_walledgarden.php
@@ -0,0 +1,110 @@
+<?php
+
+ /**
+ * Elgg login form for walled garden
+ */
+
+ global $CONFIG;
+
+ //login form
+ $form_body = "<h2 class='master'>" . elgg_echo('login') . "</h2>";
+ $form_body .= "<label>".elgg_echo('username')."</label>".elgg_view('input/text', array('internalname' => 'username', 'class' => 'login-textarea username master'));
+ $form_body .= "<br /><label>".elgg_echo('password')."</label>".elgg_view('input/password', array('internalname' => 'password', 'class' => 'login-textarea password master' ));
+
+
+ $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>";
+ $form_body .= "<p class=\"loginbox\">";
+ $form_body .= (!isset($CONFIG->disable_registration) || !($CONFIG->disable_registration)) ? "<a href=\"{$vars['url']}account/register.php\">" . elgg_echo('register') . "</a> | " : "";
+ $form_body .= "<a href='#forgotten_password' class='forgotten_password_link'>" . elgg_echo('user:password:lost') . "</a></p>";
+
+
+
+ $login_url = $vars['url'];
+ if ((isset($CONFIG->https_login)) && ($CONFIG->https_login))
+ $login_url = str_replace("http", "https", $vars['url']);
+?>
+
+ <div id="login-box">
+ <?php
+ echo elgg_view('input/form', array('body' => $form_body, 'action' => "{$login_url}action/login"));
+ ?>
+ <div class="clearfloat"></div>
+ </div>
+
+
+<script type="text/javascript">
+ $(document).ready(function() {
+
+ $('.login-textarea.username.master').focus(); // only put cursor in textfirld if master login
+
+ $('.login-textarea.name').focus(function() {
+ if (this.value=='<?php echo elgg_echo('username'); ?>') {
+ this.value='';
+ }
+ });
+ $('.login-textarea.name').blur(function() {
+ if (this.value=='') {
+ this.value='<?php echo elgg_echo('username'); ?>';
+ }
+ });
+ $('.login-textarea.password').focus(function() {
+ if (this.value=='<?php echo elgg_echo('password'); ?>') {
+ this.value='';
+ }
+ });
+
+
+ //select all the a tag with name equal to modal
+ $('a.forgotten_password_link').click(function(e) {
+ //Cancel the link behavior
+ e.preventDefault();
+
+ //Get the A tag
+ var id = $(this).attr('href');
+
+ //Get the screen height and width
+ //var maskHeight = $(document).height();
+ //var maskWidth = $(window).width();
+
+ //Set height and width to mask to fill up the whole screen
+ //$('#mask').css({'width':maskWidth,'height':maskHeight});
+
+ //transition effect
+ $('#mask').fadeIn(500);
+ $('#mask').fadeTo("slow",0.8);
+
+ //Get the window height and width
+ var winH = $(window).height();
+ var winW = $(window).width();
+
+ //Set the popup window to center
+ $(id).css('top', winH/4-$(id).height()/2);
+ $(id).css('left', (winW-20)/2-$(id).width()/2);
+
+ //transition effect
+ $(id).fadeIn(1000);
+
+ });
+
+ //if close button is clicked
+ $('.window .close').click(function (e) {
+ //Cancel the link behaviour
+ e.preventDefault();
+
+ $('#mask').hide();
+ $('.window').hide();
+ });
+
+ //if mask is clicked
+ $('#mask').click(function () {
+ $(this).hide();
+ $('.window').hide();
+ });
+
+});
+</script>
+
+
+
+
+ \ No newline at end of file
diff --git a/mod/walledgarden/views/default/page_shells/walled_garden_index.php b/mod/walledgarden/views/default/page_shells/walled_garden_index.php
new file mode 100644
index 000000000..33e3605a1
--- /dev/null
+++ b/mod/walledgarden/views/default/page_shells/walled_garden_index.php
@@ -0,0 +1,76 @@
+<?php
+/**
+ * Elgg pageshell
+ * The standard HTML page shell that everything else fits into
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ *
+ * @uses $vars['config'] The site configuration settings, imported
+ * @uses $vars['title'] The page title
+ * @uses $vars['body'] The main content of the page
+ * @uses $vars['messages'] A 2d array of various message registers, passed from system_messages()
+ */
+
+// Set the content type
+header("Content-type: text/html; charset=UTF-8");
+
+// Set title
+if (empty($vars['title'])) {
+ $title = $vars['config']->sitename;
+} else if (empty($vars['config']->sitename)) {
+ $title = $vars['title'];
+} else {
+ $title = $vars['config']->sitename . ": " . $vars['title'];
+}
+
+echo elgg_view('page_elements/html_begin', $vars);
+echo elgg_view('messages/list', array('object' => $vars['sysmessages']));
+?>
+ <style type="text/css">
+ /*
+body {background: white;}
+ #walledgardenlogin {
+ position:absolute;
+ bottom:0;
+ left:280px;
+ height:250px;
+ width:272px;
+ }
+ #walledgardenintro {
+ position: absolute;
+ bottom:15px;
+ left:25px;
+ height:215px;
+ width:232px;
+ padding:10px;
+ background-color: white;
+ -webkit-border-radius: 8px;
+ -moz-border-radius: 8px;
+ }
+ #walledgardenlogin #login-box {
+ background: none;
+ }
+ #walledgardenlogin #login-box h2 {
+ display:none;
+ }
+ #walledgardenlogin #login-box form {height:224px;padding:10px 10px 0;}
+
+ .messages, .messages_error {
+ position: relative;
+ margin: auto;
+ }
+*/
+
+ </style>
+<?php
+ 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;'>";
+ echo "<div id='walledgardenintro'><h1>Welcome to:<br />" . $title . "</h1></div>";
+ echo "<div id='walledgardenlogin' class='whereamIused'>";
+ echo $vars['body'];
+ echo "</div></div>";
+ echo elgg_view('page_elements/html_end', $vars);
+?>
+