Browse Source

Generic custompages

Noel Dieschburg 13 years ago
parent
commit
6163dbd0b3

BIN
custompages/images/footer.png


BIN
custompages/images/header.png


BIN
custompages/images/login-form-submit-bg.jpg


BIN
custompages/images/page-background.png


+ 4 - 0
custompages/index-logged.php

@@ -0,0 +1,4 @@
+<?php require_once('main/inc/global.inc.php');
+//require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
+
+header("Location: /user_portal.php");

+ 89 - 0
custompages/index-unlogged.php

@@ -0,0 +1,89 @@
+<?php 
+//require_once('main/inc/global.inc.php'); 
+require_once('language.php');
+if (isset($_GET['loginFailed'])){
+  if (isset($_GET['error'])) {
+    switch ($_GET['error']) {
+    case 'account_expired':
+      $error_message = cblue_get_lang('AccountExpired');
+      break;
+    case 'account_inactive':
+      $error_message = cblue_get_lang('AccountInactive');
+      break;
+    case 'user_password_incorrect':
+      $error_message = cblue_get_lang('InvalidId');
+      break;
+    case 'access_url_inactive':
+      $error_message = cblue_get_lang('AccountURLInactive');
+      break;
+    default : 
+      $error_message = cblue_get_lang('InvalidId');
+    }
+  } else { 
+    $error_message = get_lang('InvalidId');
+  }
+}
+?>
+<html>
+<head>
+	<title>Custompage - login</title>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+	<!--[if !IE 6]><!-->
+	<link rel="stylesheet" type="text/css" href="/custompages/style.css" />
+	<!--<![endif]-->
+	<!--[if IE 6]>
+	<link rel="stylesheet" type="text/css" href="/custompages/style-ie6.css" />
+	<![endif]-->
+
+	<script type="text/javascript" src="/custompages/jquery-1.5.1.min.js"></script>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			if (top.location != location) 
+				top.location.href = document.location.href ;
+
+			// Handler pour la touche retour
+			$('input').keyup(function(e) { 
+				if (e.keyCode == 13) {
+					$('#login-form').submit();
+				}
+			});
+		});
+	</script>
+</head>
+<body>
+	<div id="backgroundimage">
+		<img src="/custompages/images/page-background.png" class="backgroundimage" />
+	</div>
+	<div id="wrapper">
+		<div id="header">
+			<img src="/custompages/images/header.png" alt="Logo" />
+		</div> <!-- #header -->
+		<div id="login-form-box" class="form-box">
+		<?php if ($values['reset_password']) {
+			echo '<div id="login-form-info" class="form-info">'.cblue_get_lang('your_password_has_been_reset').'</div>';
+		}?> 
+		<?php if (isset($error_message)) {
+			echo '<div id="login-form-info" class="form-error">'.$error_message.'</div>';
+		}?> 
+			<form id="login-form" class="form" action="/index.php" method="post">
+				<div>
+        <label for="login">*<?php echo cblue_get_lang('Username');?></label>
+					<input name="login" type="text" /><br />
+          <label for="password">*<?php echo cblue_get_lang('langPass');?></label>
+					<input name="password" type="password" /><br />
+				</div>
+			</form>
+			<div id="login-form-submit" class="form-submit" onclick="document.forms['login-form'].submit();">
+      <span><?php echo cblue_get_lang('LoginEnter');?></span>
+			</div> <!-- #form-submit -->
+			<div id="links">
+      <a href="main/auth/inscription.php"><?php echo cblue_get_lang('langReg')?></a><br />
+      <a href="main/auth/lostPassword.php"><?php echo cblue_get_lang('langLostPassword')?></a>
+			</div>
+		</div> <!-- #form -->
+		<div id="footer">
+			<img src="/custompages/images/footer.png" />
+		</div> <!-- #footer -->
+	</div> <!-- #wrapper -->
+</body>
+</html>

File diff suppressed because it is too large
+ 15 - 0
custompages/jquery-1.5.1.min.js


+ 45 - 0
custompages/language.php

@@ -0,0 +1,45 @@
+<?php
+function get_preferred_language($available_langs) {
+	$langs = array();
+	foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $httplang) {
+		$rawlang = explode(';q=', $httplang);
+		if (strpos($rawlang[0], '-') !== FALSE) {
+			$rawlang[0] = substr($rawlang[0], 0, strpos($rawlang[0], '-'));
+		}
+		if (count($rawlang) == 1) {
+			$rawlang[1] = 1.0;
+		}
+		$langs[$rawlang[1]] = $rawlang[0];
+	}
+	krsort($langs, SORT_NUMERIC);
+	foreach($langs as $weight => $code) {
+		if (in_array($code, $available_langs)) {
+			return $code;
+		}
+	}
+	return null;
+}
+
+function cblue_get_lang($variable) {
+	return get_lang($variable, null, $_SESSION['user_language_choice']);
+}
+
+$language_file = array('courses', 'index', 'registration', 'admin','userInfo');
+$available_langs = array('en','fr');
+$chamilo_langs = array(null => 'english', 'en' => 'english', 'fr' => 'french', 'nl' => 'dutch', 'de' => 'german', 'es' => 'spanish');
+$lang_match = $chamilo_langs[get_preferred_language($available_langs)];
+// recover previous value ... 
+if (isset($_SESSION['user_language_choice']))
+	$lang_match = $_SESSION['user_language_choice'];
+
+// Chamilo parameter, on logout
+if (isset($_REQUEST['language']) && !empty($_REQUEST['language']) && in_array($_REQUEST['language'], $chamilo_langs)) {
+	$lang_match = $_REQUEST['language'];
+}
+// Incoming link parameter
+if (isset($_REQUEST['lang']) && !empty($_REQUEST['lang']) && in_array($_REQUEST['lang'], $available_langs)) {
+	$lang_match = $chamilo_langs[$_REQUEST['lang']];
+}
+$_user['language'] = $lang_match;
+$_SESSION['user_language_choice'] = $lang_match;
+?>

+ 57 - 0
custompages/lostpassword.php

@@ -0,0 +1,57 @@
+<?php
+require_once('../../main/inc/global.inc.php'); 
+require_once('language.php');
+?>
+<html>
+<head>
+	<title>Password recovery</title>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+	<!--[if !IE 6]><!-->
+	<link rel="stylesheet" type="text/css" href="../../custompages/style.css" />
+	<!--<![endif]-->
+	<!--[if IE 6]>
+	<link rel="stylesheet" type="text/css" href="../../custompages/style-ie6.css" />
+	<![endif]-->
+	<script type="text/javascript" src="../../custompages/jquery-1.5.1.min.js"></script>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			// Handler pour la touche retour
+			$('input').keyup(function(e) { 
+				if (e.keyCode == 13) {
+					$('#lostpassword-form').submit();
+				}
+			});
+		});
+	</script>
+</head>
+<body>
+	<div id="backgroundimage">
+		<img src="/custompages/images/page-background.png" class="backgroundimage" />
+	</div>
+	<div id="wrapper">
+		<div id="header">
+			<img src="../../custompages/images/header.png" alt="Ambassador logo" />
+		</div> <!-- #header -->
+<?php echo '<div id="registration-form-info" class="form-info">'.cblue_get_lang('lang_enter_email_and_well_send_you_password').'</div>'; ?>
+		<div id="lostpassword-form-box">
+		<?php if (isset($form_error) && !empty($form_error)) {
+			echo '<div id="registration-form-error" class="form-error"><ul>'.$form_error.'</ul></div>';
+		}?>
+			<form id="lostpassword-form" class="form" action="lostPassword.php" method="post">
+				<div>
+        <label for="user">*<?php echo cblue_get_lang('UserName');?></label>
+					<input name="user" type="text" /><br />
+          <label for="email">*<?php echo cblue_get_lang('Email');?></label>
+					<input name="email" type="text" /><br />
+				</div>
+			</form>
+			<div id="lostpassword-form-submit" class="form-submit" onclick="document.forms['lostpassword-form'].submit();">
+      <span><?php echo cblue_get_lang('langSend'); ?> </span>
+			</div> <!-- #form-submit -->
+		</div> <!-- #form -->
+		<div id="footer">
+			<img src="../../custompages/images/footer.png" />
+		</div> <!-- #footer -->
+	</div> <!-- #wrapper -->
+</body>
+</html>

+ 3 - 0
custompages/registration-feedback.php

@@ -0,0 +1,3 @@
+<?php require_once('../inc/global.inc.php');
+header("Location: /user_portal.php");
+exit();

+ 61 - 0
custompages/registration.php

@@ -0,0 +1,61 @@
+<?php 
+require_once('../inc/global.inc.php');
+require_once('../inc/lib/group_portal_manager.lib.php');
+require_once('language.php');
+?>
+<html>
+<head>
+	<title>Registration</title>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+	<!--[if !IE 6]><!-->
+	<link rel="stylesheet" type="text/css" href="../../custompages/style.css" />
+	<!--<![endif]-->
+	<!--[if IE 6]>
+	<link rel="stylesheet" type="text/css" href="../../custompages/style-ie6.css" />
+	<![endif]-->
+	<script type="text/javascript" src="../../custompages/jquery-1.5.1.min.js"></script>
+</head>
+<body>
+	<div id="backgroundimage">
+		<img src="/custompages/images/page-background.png" class="backgroundimage" />
+	</div>
+	<div id="wrapper">
+		<div id="header">
+			<img src="../../custompages/images/header.png" alt="Ambassador logo" />
+		</div> <!-- #header -->
+		<div id="registration-form-box" class="form-box">
+		<?php if (isset($form_error) && !empty($form_error)) {
+			echo '<div id="registration-form-error" class="form-error"><ul>'.$form_error.'</ul></div>';
+		}?>
+			<form id="registration-form" class="form" action="inscription.php" method="post">
+				<div>
+        <label for="email"><?php echo cblue_get_lang('langEmail');?>*</label>
+					<input name="email" type="text"  value="<?php echo $values['email']?>" /><br />
+					<label for="username"><?php echo cblue_get_lang('Username');?>*</label>
+					<input name="username" type="text" value="<?php echo $values['username']?>" /><br />
+          <p class="forminfo"><?php echo cblue_get_lang('UsernameWrong')?></p>
+					<label for="pass1"><?php echo cblue_get_lang('Pass');?>*</label>
+					<input name="pass1" type="password" value="<?php echo $values['pass1']?>" /><br />
+					<label for="pass2"><?php echo cblue_get_lang('Confirmation');?>*</label>
+					<input name="pass2" type="password"  value="<?php echo $values['pass2']?>" /><br />
+					<!--
+					<label for="phone">*Phone number</label>
+					<input name="phone" type="text" /><br />
+					-->
+          <input name="language" type="hidden" value="<?php echo $_SESSION['user_language_choice']?>" />
+					<input name="status" type="hidden" value="5" /> <!-- learner -->
+				</div>
+			</form>
+			<div id="registration-form-submit" class="form-submit" onclick="document.forms['registration-form'].submit();">
+				<span><?php echo cblue_get_lang('Subscribe');?></span>
+			</div> <!-- #form-submit -->
+			<div id="links">
+      <!--<a href="mailto: support@cblue.be"><?php echo cblue_get_lang('NeedContactAdmin')?></a><br />-->
+			</div>
+		</div> <!-- #form -->
+		<div id="footer">
+			<img src="../../custompages/images/footer.png" />
+		</div> <!-- #footer -->
+	</div> <!-- #wrapper -->
+</body>
+</html>

+ 168 - 0
custompages/style-ie6.css

@@ -0,0 +1,168 @@
+html, body {
+	margin: 0;
+	padding: 0;
+}
+
+body {
+	font-family: "Arial Black",sans-serif;
+	font-size: 10pt;
+	width: 100%;
+	text-align: center;
+	/*
+	background-image: url(images/page-background.png);
+	background-repeat: no-repeat;
+	background-size: 100%;
+	*/
+}
+
+#backgroundimage {
+	background-attachment:fixed;
+	width: 100%
+	height: 100%
+	position: absolute;
+	left: 0;
+	top: 30px;
+	z-index:-1;
+}
+
+.backgroundimage {
+	width: 100%;
+	height: auto;
+}
+
+#wrapper {
+	position: absolute;
+	top: 0;
+	left: 0;
+	width: 100%;
+	z-index: 1;
+	text-align: center;
+}
+
+#header {
+	width: 520px;
+	margin-left: auto;
+	margin-right: auto;
+	margin-top: 30px;
+}
+
+#footer {
+	position: relative;
+	/*margin-top: 50px;*/
+	text-align: center;
+}
+
+#login-form-box, #registration-form-box, #lostpassword-form-box {
+	width: 310px;
+	margin-left: auto;
+	margin-right: auto;
+	margin-top: 50px;
+	border: solid 1px #CCCCCC;
+	text-align: left;
+	/*background-color: white;*/
+}
+
+#login-form, #registration-form, #lostpassword-form {
+	margin-left: 15px;
+	margin-right: 15px;
+	margin-top: 30px;
+	color: #1F3660;
+	/*position: relative;*/
+	text-align: left;
+}
+
+#login-form-submit, #registration-form-submit, #lostpassword-form-submit {
+	margin: 0;
+	padding: 0;
+	width: 310px;
+	height: 27px;
+	background-color: #1F3660;
+	background-image: url(/custompages/images/login-form-submit-bg.jpg);
+	color: white;
+	cursor: pointer;
+	cursor: hand;
+}
+
+label {
+	width: 100px;
+	float: left;
+	margin-right: 1em;
+	display: block;
+	text-align: right;
+	line-height: 2ex;
+}
+
+input {
+	text-align: left;
+	vertical-align: baseline;
+	margin-bottom: 2em;
+	width: 150px;
+	color: white;
+       background-color: #1F3660;
+	border: none;
+}
+
+.radiobutton {
+	width: 20px;
+	background-color: white;
+	margin: 0;
+}
+
+.radiogroup {
+	margin-bottom: 2em;
+}
+
+select {
+	margin-bottom: 2em;
+	width: 150px;
+}
+
+label {
+	clear: both;
+}
+
+input, select, .radiogroup {
+	float: right;
+	clear: both;
+}
+
+.radiogroup input, .radiogroup label {
+	float: none;
+}
+
+
+#links {
+	margin-left: 15px;
+	margin-right: 15px;
+	margin-top: 10px;
+	margin-bottom: 50px;
+	color: #1F3660;
+}
+
+#links a, #links a:hover, #links a:active, #links a:visited {
+	color: #1F3660;
+}
+
+#links a {
+	text-decoration: none;
+}
+
+#links a:hover {
+	text-decoration: underline;
+}
+
+span {
+	margin-right: 30px;
+	margin-top: 3px;
+	float: right;
+}
+
+.form-info {
+	color: #1F3660;
+	font-size: 9pt;
+}
+
+.form-error {
+	color: red;
+	font-size: 9pt;
+}

+ 143 - 0
custompages/style.css

@@ -0,0 +1,143 @@
+html, body {
+	margin: 0;
+	padding: 0;
+}
+
+body {
+	font-family: "Arial Black",sans-serif;
+	font-size: 10pt;
+	width: 100%;
+	text-align: center;
+	/*background-image: url(images/page-background.png);
+	background-repeat: no-repeat;
+	background-size: 100%;
+	*/
+}
+
+#backgroundimage {
+	background-attachment:fixed;
+	width: 100%
+	height: 100%
+	position: absolute;
+	left: 0;
+	top: 30px;
+	z-index:-1;
+}
+
+.backgroundimage {
+	width: 100%;
+	height: auto;
+}
+
+#wrapper {
+	position: absolute;
+	top: 0;
+	left: 0;
+	width: 100%;
+	z-index: 1;
+}
+
+#header {
+	width: 520px;
+	margin-left: auto;
+	margin-right: auto;
+	margin-top: 30px;
+}
+
+#footer {
+	position: relative;
+	margin-top: 50px;
+	text-align: center;
+}
+
+#login-form-box, #registration-form-box, #lostpassword-form-box {
+	width: 310px;
+	margin-left: auto;
+	margin-right: auto;
+	margin-top: 50px;
+	border: solid 1px #CCCCCC;
+	text-align: left;
+	background-color: white;
+}
+
+#login-form, #registration-form, #lostpassword-form {
+	margin-left: 15px;
+	margin-right: 15px;
+	margin-top: 30px;
+	color: #1F3660;
+	position: relative;
+	text-align: left;
+}
+
+#login-form-submit, #registration-form-submit, #lostpassword-form-submit {
+	margin: 0;
+	padding: 0;
+	width: 310px;
+	height: 27px;
+	background-color: #1F3660;
+	background-image: url(/custompages/images/login-form-submit-bg.jpg);
+	color: white;
+	cursor: pointer;
+	cursor: hand;
+}
+
+label {
+	width: 100px;
+	float: left;
+	margin-right: 1em;
+	display: block;
+	text-align: right;
+	line-height: 2ex;
+}
+
+input {
+	text-align: left;
+	vertical-align: baseline;
+	margin-bottom: 2em;
+	width: 150px;
+	color: white;
+	background-color: #1F3660;
+	border: none;
+}
+
+select {
+	width: 150px;
+	color: white;
+	background-color: #1F3660;
+	border: none;
+	margin-bottom: 2em;
+}
+#links {
+	margin-left: 15px;
+	margin-right: 15px;
+	margin-top: 10px;
+	margin-bottom: 50px;
+	color: #1F3660;
+}
+
+#links a, #links a:hover, #links a:active, #links a:visited {
+	color: #1F3660;
+}
+
+#links a {
+	text-decoration: none;
+}
+
+#links a:hover {
+	text-decoration: underline;
+}
+
+span {
+	margin-right: 30px;
+	margin-top: 3px;
+	float: right;
+}
+
+.form-info {
+	color: #1F3660;
+	font-size: 9pt;
+}
+.form-error {
+	color: red;
+	font-size: 9pt;
+}

+ 6 - 1
index.php

@@ -31,7 +31,6 @@ require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
 require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
 require_once 'main/chat/chat_functions.lib.php';
 
-require_once api_get_path(LIBRARY_PATH).'custompages.lib.php';
 
 $loginFailed = isset($_GET['loginFailed']) ? true : isset($loginFailed);
 $setting_show_also_closed_courses = api_get_setting('show_closed_courses') == 'true';
@@ -87,6 +86,12 @@ if (api_get_setting('allow_terms_conditions') == 'true') {
     unset($_SESSION['update_term_and_condition']);
     unset($_SESSION['info_current_user']);
 }
+//If we are not logged in and customapages activated
+if (!api_get_user_id() && api_get_setting('use_custom_pages') == 'true' ){
+  require_once api_get_path(LIBRARY_PATH).'custompages.lib.php';
+  CustomPages::displayPage('index-unlogged');
+}
+
 
 /**
  * @todo This piece of code should probably move to local.inc.php where the actual login procedure is handled.

+ 2 - 7
main/inc/lib/loginredirection.lib.php

@@ -7,7 +7,7 @@ Class LoginRedirection {
 
 	//checks user status and redirect him through custom page if setting is enabled
 	public function redirect(){
-		
+
 		global $param;
 
 		if ( api_is_student() && !api_get_setting('student_page_after_login') == '' ){
@@ -46,12 +46,7 @@ Class LoginRedirection {
 
 		// Custom pages
 		if (api_get_setting('use_custom_pages') == 'true') {
-			if (api_get_user_id()) {
-				CustomPages::displayPage('index-logged');
-			}
-			else {
-				CustomPages::displayPage('index-unlogged');
-			}
+			CustomPages::displayPage('index-unlogged');
 		}
 		if (!empty($_SESSION['request_uri'])) {
 			$req = $_SESSION['request_uri'];

Some files were not shown because too many files changed in this diff