Updated custompages documentation

skala
Yannick Warnier 13 years ago
parent f0f1809ed3
commit b277d15c60
  1. 27
      custompages/first_login.php
  2. 14
      custompages/index-logged.php
  3. 36
      custompages/index-unlogged.php
  4. 16
      custompages/jquery-1.5.1.min.js
  5. 33
      custompages/language.inc.php
  6. 15
      custompages/language.php
  7. 11
      custompages/loggedout.php
  8. 21
      custompages/lostpassword.php
  9. 12
      custompages/registration-feedback.php
  10. 21
      custompages/registration.php

@ -1,8 +1,18 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Quick page to react to first login cases
* @package chamilo.custompages
*/
/**
* Initialization
*/
require_once('language.php');
require_once(dirname(__FILE__).'/../main/inc/global.inc.php');
require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php');
/**
* Security checks
*/
if (! isset($_SESSION['conditional_login']['uid']))
die("Not Authorised");
@ -30,6 +40,9 @@ if ($_GET['invalid'] == 1) {
if ($_GET['invalid'] == 2) {
$error_message = get_lang('PassTwo');
}
/**
* HTML output
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
@ -43,7 +56,7 @@ if ($_GET['invalid'] == 2) {
<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" src="/main/inc/lib/javascript/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
if (top.location != location)
@ -66,23 +79,23 @@ if ($_GET['invalid'] == 2) {
<div id="header">
<img src="/custompages/images/header.png" alt="Logo" />
</div> <!-- #header -->
<h2> <?php echo cblue_get_lang('FirstLogin');?> </h2>
<h2> <?php echo custompages_get_lang('FirstLogin');?> </h2>
<div id="changepassword-form-box" class="form-box">
<div class="info"> <?php echo cblue_get_lang('FirstLoginChangePassword');?> </div>
<div class="info"> <?php echo custompages_get_lang('FirstLoginChangePassword');?> </div>
<?php if (isset($error_message)) {
echo '<div id="changepassword-form-error" class="form-error">'.$error_message.'</div>';
}?>
<form id="changepassword-form" class="form" method="post">
<div>
<label for="password">*<?php echo cblue_get_lang('langPass');?></label>
<label for="password">*<?php echo custompages_get_lang('langPass');?></label>
<input name="password" type="password" /><br />
<label for="password2">*<?php echo cblue_get_lang('langPass');?></label>
<label for="password2">*<?php echo custompages_get_lang('langPass');?></label>
<input name="password2" type="password" /><br />
</div>
</form>
<div id="changepassword-form-submit" class="form-submit" onclick="document.forms['changepassword-form'].submit();">
<span><?php echo cblue_get_lang('LoginEnter');?></span>
<span><?php echo custompages_get_lang('LoginEnter');?></span>
</div> <!-- #form-submit -->
</div> <!-- #form -->
<div id="footer">

@ -1,6 +1,16 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Redirect to normal Chamilo
* @package chamilo.custompages
*/
/**
* Initialization
*/
require_once(dirname(__FILE__).'/../main/inc/global.inc.php');
$www = api_get_path('WEB_PATH');
header("Location: $www/user_portal.php");
/**
* Redirect
*/
header("Location: $www/user_portal.php");

@ -1,23 +1,34 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Redirect script
* @package chamilo.custompages
*/
/**
* Initialization
*/
//require_once('main/inc/global.inc.php');
require_once('language.php');
/**
* Homemade micro-controller
*/
if (isset($_GET['loginFailed'])){
if (isset($_GET['error'])) {
switch ($_GET['error']) {
case 'account_expired':
$error_message = cblue_get_lang('AccountExpired');
$error_message = custompages_get_lang('AccountExpired');
break;
case 'account_inactive':
$error_message = cblue_get_lang('AccountInactive');
$error_message = custompages_get_lang('AccountInactive');
break;
case 'user_password_incorrect':
$error_message = cblue_get_lang('InvalidId');
$error_message = custompages_get_lang('InvalidId');
break;
case 'access_url_inactive':
$error_message = cblue_get_lang('AccountURLInactive');
$error_message = custompages_get_lang('AccountURLInactive');
break;
default :
$error_message = cblue_get_lang('InvalidId');
$error_message = custompages_get_lang('InvalidId');
}
} else {
$error_message = get_lang('InvalidId');
@ -25,6 +36,9 @@ if (isset($_GET['loginFailed'])){
}
$rootWeb = api_get_path('WEB_PATH');
/**
* HTML output
*/
?>
<html>
<head>
@ -37,7 +51,7 @@ if (isset($_GET['loginFailed'])){
<link rel="stylesheet" type="text/css" href="/custompages/style-ie6.css" />
<![endif]-->
<script type="text/javascript" src="<?php echo $rootWeb ?>custompages/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="<?php echo $rootWeb ?>main/inc/lib/javascript/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
@ -72,18 +86,18 @@ if (isset($_GET['loginFailed'])){
}?>
<form id="login-form" class="form" action="<?php echo api_get_path(WEB_PATH)?>index.php" method="post">
<div>
<label for="login">*<?php echo cblue_get_lang('User');?></label>
<label for="login">*<?php echo custompages_get_lang('User');?></label>
<input name="login" type="text" /><br />
<label for="password">*<?php echo cblue_get_lang('langPass');?></label>
<label for="password">*<?php echo custompages_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>
<span><?php echo custompages_get_lang('LoginEnter');?></span>
</div> <!-- #form-submit -->
<div id="links">
<a href="<?php echo api_get_path(WEB_PATH)?>main/auth/inscription.php"><?php echo cblue_get_lang('langReg')?></a><br />
<a href="<?php echo api_get_path(WEB_PATH)?>main/auth/lostPassword.php"><?php echo cblue_get_lang('langLostPassword')?></a>
<a href="<?php echo api_get_path(WEB_PATH)?>main/auth/inscription.php"><?php echo custompages_get_lang('langReg')?></a><br />
<a href="<?php echo api_get_path(WEB_PATH)?>main/auth/lostPassword.php"><?php echo custompages_get_lang('langLostPassword')?></a>
</div>
</div> <!-- #form -->
<div id="footer">

File diff suppressed because one or more lines are too long

@ -1,14 +1,17 @@
<?php
// CustomPages : Browser language detection
// Include this file in your custom page if you want to set the language variable of the Chamilo session to the best pick according to the visitor's browser's options.
// 2011, Jean-Karim Bockstael, CBlue <jeankarim@cblue.be>
// This requires the Chamilo system to be initialized
// (note that it's easier to do the following include in the parent page)
// require_once('path/to/main/inc/global.inc.php');
// Returns the best match between available languages and visitor preferences
// return the best match as 2-chars code, null when none match
/* For licensing terms, see /license.txt */
/**
* CustomPages : Browser language detection
* Include this file in your custom page if you want to set the language variable of the Chamilo session to the best pick according to the visitor's browser's options.
* 2011, Jean-Karim Bockstael, CBlue <jeankarim@cblue.be>
* This requires the Chamilo system to be initialized
* (note that it's easier to do the following include in the parent page)
* @package chamilo.custompages
*/
/**
* Returns the best match between available languages and visitor preferences
* @return string the best match as 2-chars code, null when none match
*/
function get_preferred_language($available_langs) {
// Parsing the Accept-languages HTTP header
$langs = array();
@ -36,12 +39,16 @@ function get_preferred_language($available_langs) {
return null;
}
// Wrapper function for the get_lang function
// use this if you want to avoid translation caching issues
/**
* Wrapper function for the get_lang function
* use this if you want to avoid translation caching issues
*/
function cp_get_lang($variable) {
return get_lang($variable, null, $_SESSION['user_language_choice']);
}
/**
* Code
*/
// Note that Chamilo languages are expressed as full english names, not 2-characters codes
// e.g. 'english' instead of 'en', 'french' instead of 'fr', ...
// We need a matching array. Note the value for the null key, which is the default language.

@ -1,4 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Definition of language-related functions for cases where th user isn't
* logged in yet
* @package chamilo.custompages
*/
/**
* Get the preferred language base on the browser headers
*/
function get_preferred_language($available_langs) {
$langs = array();
foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $httplang) {
@ -19,8 +28,10 @@ function get_preferred_language($available_langs) {
}
return null;
}
function cblue_get_lang($variable) {
/**
* Get a language variable in a specific language
*/
function custompages_get_lang($variable) {
return get_lang($variable, null, $_SESSION['user_language_choice']);
}

@ -1,8 +1,12 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Displayed after the user has been logged out.
* @package chamilo.custompages
*/
/**
* Init
*/
$called_direcly = !function_exists('api_get_path');
if ($called_direcly)
{
@ -12,6 +16,9 @@ if ($called_direcly)
require_once('language.php');
$www = api_get_path('WEB_PATH');
/**
* HTML output
*/
?>
<!DOCTYPE html>
<html>
@ -25,7 +32,7 @@ $www = api_get_path('WEB_PATH');
<link rel="stylesheet" type="text/css" href="/custompages/style-ie6.css" />
<![endif]-->
<script type="text/javascript" src="<?php echo $www ?>custompages/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="<?php echo $www ?>main/inc/lib/javascript/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {

@ -1,6 +1,17 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Quick form to ask for password reminder.
* @package chamilo.custompages
*/
/**
* Initialization
*/
require_once('../../main/inc/global.inc.php');
require_once('language.php');
/**
* HTML
*/
?>
<html>
<head>
@ -12,7 +23,7 @@ require_once('language.php');
<!--[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" src="../../main/inc/lib/javascript/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
// Handler pour la touche retour
@ -36,7 +47,7 @@ require_once('language.php');
<?php if(isset($content['error']) && !empty($content['error'])){
echo $content['info'];
} else {
echo cblue_get_lang('lang_enter_email_and_well_send_you_password');
echo custompages_get_lang('lang_enter_email_and_well_send_you_password');
}?>
</div>
<div id="lostpassword-form-box" class="form-box">
@ -45,14 +56,14 @@ require_once('language.php');
}?>
<form id="lostpassword-form" class="form" action="lostPassword.php" method="post">
<div>
<label for="user">*<?php echo cblue_get_lang('UserName');?></label>
<label for="user">*<?php echo custompages_get_lang('UserName');?></label>
<input name="user" type="text" /><br />
<label for="email">*<?php echo cblue_get_lang('Email');?></label>
<label for="email">*<?php echo custompages_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>
<span><?php echo custompages_get_lang('langSend'); ?> </span>
</div> <!-- #form-submit -->
</div> <!-- #form -->
<div id="footer">

@ -1,3 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Quick display for user registration
* @package chamilo.custompages
*/
/**
* HTML output
*/
?>
<html>
<head>
<title>Registration</title>
@ -8,7 +18,7 @@
<!--[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" src="../../main/inc/lib/javascript/jquery.min.js"></script>
</head>
<body>
<div id="backgroundimage">

@ -1,17 +1,24 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Licence: GPL
* This script allows for specific registration rules (see CustomPages feature of Chamilo)
* Please contact CBlue regarding any licences issues.
* Author: noel@cblue.be
* Copyright: CBlue SPRL, 20XX
* Copyright: CBlue SPRL, 20XX (GNU/GPLv3)
* @package chamilo.custompages
**/
/**
* Initialization
*/
require_once('language.php');
require_once('../inc/global.inc.php');
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(CONFIGURATION_PATH).'profile.conf.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
//Removes some unwanted elementend of the form object
/**
* Removes some unwanted elementend of the form object
*/
$content['form']->removeElement('extra_mail_notify_invitation');
$content['form']->removeElement('extra_mail_notify_message');
$content['form']->removeElement('extra_mail_notify_group_message');
@ -22,7 +29,7 @@ $content['form']->removeElement('status');
$content['form']->removeElement('status');
/**
* Code to change the way QuickForm render html
**/
*/
/*
$renderer = & $content['form']->defaultRenderer();
$form_template = <<<EOT
@ -83,7 +90,7 @@ EOT;
<!--[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" src="../../main/inc/lib/javascript/jquery.min.js"></script>
</head>
<body>
<div id="backgroundimage">
@ -101,10 +108,10 @@ EOT;
$content['form']->display();
?>
<div id="registration-form-submit" class="form-submit" onclick="document.forms['registration'].submit();">
<span><?php echo cblue_get_lang('Subscribe');?></span>
<span><?php echo custompages_get_lang('Subscribe');?></span>
</div> <!-- #form-submit -->
<div id="links">
<!--<a href="mailto: support@cblue.be"><?php echo cblue_get_lang('NeedContactAdmin')?></a><br />-->
<!--<a href="mailto: support@cblue.be"><?php echo custompages_get_lang('NeedContactAdmin')?></a><br />-->
</div>
</div> <!-- #form -->
<div id="footer">

Loading…
Cancel
Save