Feature #272 - Help pages: Minor rework and code cleaning.

skala
Ivan Tcholakov 15 years ago
parent 19a0a732c2
commit d5b0a87c2f
  1. 81
      main/help/allowed_html_tags.php
  2. 107
      main/help/faq.php
  3. 116
      main/help/help.php

@ -1,90 +1,69 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
/* For licensing terms, see /license.txt */
Copyright (c) 2004-2005 Dokeos S.A.
Copyright (c) Bart Mollet, Hogeschool Gent
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
/**
* This script displays a help window with an overview of the allowed HTML-
* tags and their attributes.
*
* @package chamilo.help
*/
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
// Language file that needs to be included
$language_file = 'help';
See the GNU General Public License for more details.
require '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once api_get_path(LIBRARY_PATH).'formvalidator/Rule/HTML.php';
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/**
==============================================================================
* This script displays a help window with an overview of the allowed HTML-
* tags and their attributes.
*
* @package dokeos.help
==============================================================================
*/
// name of the language file that needs to be included
$language_file = 'help';
include ('../inc/global.inc.php');
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
require_once (api_get_path(LIBRARY_PATH).'formvalidator/Rule/HTML.php');
$language_code = api_get_language_isocode($language_interface);
header('Content-Type: text/html; charset='.$charset);
header('Content-Type: text/html; charset='.api_get_system_encoding());
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $language_code; ?>" lang="<?php echo $language_code; ?>">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo api_get_language_isocode(); ?>" lang="<?php echo api_get_language_isocode(); ?>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset ?>" />
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo api_get_system_encoding(); ?>" />
<title>
<?php echo get_lang('AllowedHTMLTags'); ?>
</title>
<style type="text/css" media="screen, projection">
/*<![CDATA[*/
@import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/public_admin/default.css";
@import "<?php echo api_get_path(WEB_CSS_PATH); ?>chamilo/default.css";
/*]]>*/
</style>
<?php
if(api_get_setting('stylesheets')<>'')
{
?>
if (api_get_setting('stylesheets') != '') {
?>
<style type="text/css" media="screen, projection">
/*<![CDATA[*/
@import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/<?php echo api_get_setting('stylesheets');?>/default.css";
@import "<?php echo api_get_path(WEB_CSS_PATH), api_get_setting('stylesheets'); ?>/default.css";
/*]]>*/
</style>
<?php
<?php
}
?>
</head>
<body>
<body dir="<?php echo api_get_text_direction(); ?>">
<div style="margin:10px;">
<div style="text-align:right;"><a href="javascript:window.close();"><?php echo get_lang('Close'); ?></a></div>
<div style="text-align:right;"><a href="javascript: window.close();"><?php echo get_lang('Close'); ?></a></div>
<h4>
<?php echo get_lang('AllowedHTMLTags'); ?>
</h4>
<?php
$html_type = $_SESSION['status'] == COURSEMANAGER ? TEACHER_HTML : STUDENT_HTML;
$fullpage = intval($_GET['fullpage']) == '0' ? false : true;
$tags = HTML_QuickForm_Rule_HTML :: get_allowed_tags($html_type,$fullpage);
$fullpage = intval($_GET['fullpage']) != 0;
$tags = HTML_QuickForm_Rule_HTML :: get_allowed_tags($html_type, $fullpage);
$table_header = array();
$table_header[]= array('tag',true);
$table_header[]= array('attributes',false);
foreach ($tags as $tag => $attributes)
{
$table_header[] = array('tag', true);
$table_header[] = array('attributes', false);
foreach ($tags as $tag => & $attributes) {
$row = array();
$row[] = '<kbd>'.$tag.'</kbd>';
$row[] = '<kbd>&nbsp;'.implode(', ',array_keys($attributes)).'</kbd>';
$row[] = '<kbd>&nbsp;'.implode(', ', array_keys($attributes)).'</kbd>';
$table_data[] = $row;
}
Display::display_sortable_table($table_header,$table_data,array(),array(),array('fullpage'=>intval($_GET['fullpage'])));
Display::display_sortable_table($table_header, $table_data, array(), array(), array('fullpage' => intval($_GET['fullpage'])));
?>
<div style="text-align:right;"><a href="javascript:window.close();"><?php echo get_lang('Close'); ?></a></div>
<div style="text-align:right;"><a href="javascript: window.close();"><?php echo get_lang('Close'); ?></a></div>
</div>
</body>
</html>

@ -1,117 +1,88 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
/* For licensing terms, see /license.txt */
Copyright (c) 2004-2008 Dokeos SPRL
Copyright (c) 2003-2005 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) Sally "Example" Programmer (sally@somewhere.net)
/**
* This script displays a help window.
*
* @package chamilo.help
*/
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
// Language file that needs to be included
$language_file = 'help';
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
require '../inc/global.inc.php';
include_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
See the GNU General Public License for more details.
$help_name = Security::remove_XSS($_GET['open']);
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/**
==============================================================================
* This script displays a help window.
*
* @package dokeos.help
==============================================================================
*/
// name of the language file that needs to be included
$language_file='help';
$helpName=$_GET['open'];
include('../inc/global.inc.php');
include_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
$language_code = api_get_language_isocode($language_interface);
header('Content-Type: text/html; charset='. $charset);
header('Content-Type: text/html; charset='. api_get_system_encoding());
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $language_code; ?>" lang="<?php echo $language_code; ?>">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo api_get_language_isocode(); ?>" lang="<?php echo api_get_language_isocode(); ?>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset ?>" />
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo api_get_system_encoding(); ?>" />
<title>
<?php echo get_lang('H'.$helpName); ?>
<?php echo get_lang('H'.$help_name); ?>
</title>
<style type="text/css" media="screen, projection">
/*<![CDATA[*/
@import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/public_admin/default.css";
@import "<?php echo api_get_path(WEB_CSS_PATH); ?>chamilo/default.css";
/*]]>*/
</style>
<?php
if(api_get_setting('stylesheets')<>'')
{
?>
if (api_get_setting('stylesheets') != '') {
?>
<style type="text/css" media="screen, projection">
/*<![CDATA[*/
@import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/<?php echo api_get_setting('stylesheets');?>/default.css";
@import "<?php echo api_get_path(WEB_CSS_PATH), api_get_setting('stylesheets'); ?>/default.css";
/*]]>*/
</style>
<?php
<?php
}
?>
</head>
<body>
<body dir="<?php echo api_get_text_direction(); ?>">
<div style="margin:10px;">
<div style="text-align:right;"><a href="javascript:window.close();"><?php echo get_lang('Close'); ?></a></div>
<div style="text-align:right;"><a href="javascript: window.close();"><?php echo get_lang('Close'); ?></a></div>
<h4>
<?php
echo get_lang('Faq');
if(api_is_platform_admin())
{
if (api_is_platform_admin()) {
echo '&nbsp;<a href="faq.php?edit=true"><img src="'.api_get_path(WEB_IMG_PATH).'edit.gif" /></a>';
}
?>
</h4>
<?php
$faq_file = 'faq.html';
if(!empty($_GET['edit']) && $_GET['edit']=='true' && api_is_platform_admin())
{
$form = new FormValidator('set_faq','post','faq.php?edit=true');
if (!empty($_GET['edit']) && $_GET['edit'] == 'true' && api_is_platform_admin()) {
$form = new FormValidator('set_faq', 'post', 'faq.php?edit=true');
$form -> add_html_editor('faq_content', null, false, false, array('ToolbarSet' => 'FAQ', 'Width' => '100%', 'Height' => '300'));
$form -> addElement('submit','faq_submit', get_lang('Ok'));
$form -> setDefaults(array('faq_content'=>file_get_contents(api_get_path(SYS_PATH).'home/faq.html')));
if($form -> validate())
{
$form -> addElement('submit', 'faq_submit', get_lang('Ok'));
$faq_content = @(string)file_get_contents(api_get_path(SYS_PATH).'home/faq.html');
$faq_content = api_to_system_encoding($faq_content, api_detect_encoding(strip_tags($faq_content)));
$form -> setDefaults(array('faq_content' => $faq_content));
if ($form -> validate()) {
$content = $form -> getSubmitValue('faq_content');
$fpath = api_get_path(SYS_PATH).'home/'.$faq_file;
if(is_file($fpath) && is_writeable($fpath))
{
$fp = fopen(api_get_path(SYS_PATH).'home/'.$faq_file,'w');
if (is_file($fpath) && is_writeable($fpath)) {
$fp = fopen(api_get_path(SYS_PATH).'home/'.$faq_file, 'w');
fwrite($fp, $content);
fclose($fp);
}
else
{
} else {
echo get_lang('WarningFaqFileNonWriteable').'<br />';
}
echo $content;
}
else
{
} else {
$form -> display();
}
}
else
{
echo file_get_contents(api_get_path(SYS_PATH).'home/'.$faq_file);
} else {
$faq_content = @(string)file_get_contents(api_get_path(SYS_PATH).'home/'.$faq_file);
$faq_content = api_to_system_encoding($faq_content, api_detect_encoding(strip_tags($faq_content)));
echo $faq_content;
}
?>
<div style="text-align:right;"><a href="javascript:window.close();"><?php echo get_lang('Close'); ?></a></div>
<div style="text-align:right;"><a href="javascript: window.close();"><?php echo get_lang('Close'); ?></a></div>
</div>
</body>
</html>

@ -1,127 +1,95 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2005 Dokeos S.A.
Copyright (c) 2003-2005 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) Sally "Example" Programmer (sally@somewhere.net)
/* For licensing terms, see /license.txt */
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
/**
* This script displays a help window.
*
* @package dokeos.help
*/
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
// Language file that needs to be included
$language_file = 'help';
See the GNU General Public License for more details.
require '../inc/global.inc.php';
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/**
==============================================================================
* This script displays a help window.
*
* @package dokeos.help
==============================================================================
*/
// name of the language file that needs to be included
$language_file='help';
$helpName=$_GET['open'];
include('../inc/global.inc.php');
$language_code = api_get_language_isocode($language_interface);
header('Content-Type: text/html; charset='. $charset);
$help_name = Security::remove_XSS($_GET['open']);
header('Content-Type: text/html; charset='. api_get_system_encoding());
/*
* Choose CSS style platform's, user's, course's, or Learning path CSS
*/
$platform_theme = api_get_setting('stylesheets'); // plataform's css
$my_style=$platform_theme;
if(api_get_setting('user_selected_theme') == 'true')
{
$my_style = $platform_theme;
if (api_get_setting('user_selected_theme') == 'true') {
$useri = api_get_user_info();
$user_theme = $useri['theme'];
if(!empty($user_theme) && $user_theme != $my_style)
{
if (!empty($user_theme) && $user_theme != $my_style) {
$my_style = $user_theme; // user's css
}
}
$mycourseid = api_get_course_id();
if (!empty($mycourseid) && $mycourseid != -1)
{
if (api_get_setting('allow_course_theme') == 'true')
{
$mycoursetheme=api_get_course_setting('course_theme');
if (!empty($mycoursetheme) && $mycoursetheme!=-1)
{
if(!empty($mycoursetheme) && $mycoursetheme != $my_style)
{
$my_style = $mycoursetheme; // course's css
if (!empty($mycourseid) && $mycourseid != -1) {
if (api_get_setting('allow_course_theme') == 'true') {
$mycoursetheme = api_get_course_setting('course_theme');
if (!empty($mycoursetheme) && $mycoursetheme != -1) {
if(!empty($mycoursetheme) && $mycoursetheme != $my_style) {
$my_style = $mycoursetheme; // course's css
}
}
$mycourselptheme=api_get_course_setting('allow_learning_path_theme');
if (!empty($mycourselptheme) && $mycourselptheme!=-1 && $mycourselptheme== 1)
{
$mycourselptheme = api_get_course_setting('allow_learning_path_theme');
if (!empty($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) {
global $lp_theme_css; // it comes from the lp_controller.php
global $lp_theme_config; // it comes from the lp_controller.php
if (!empty($lp_theme_css))
{
$theme=$lp_theme_css;
if(!empty($theme) && $theme != $my_style)
{
$my_style = $theme; // LP's css
}
if (!empty($lp_theme_css)) {
$theme = $lp_theme_css;
if (!empty($theme) && $theme != $my_style) {
$my_style = $theme; // LP's css
}
}
}
}
}
if ($lp_theme_log){
$my_style=$platform_theme;
if ($lp_theme_log) {
$my_style = $platform_theme;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $language_code; ?>" lang="<?php echo $language_code; ?>">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo api_get_language_isocode(); ?>" lang="<?php echo api_get_language_isocode(); ?>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset ?>" />
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo api_get_system_encoding(); ?>" />
<title>
<?php echo get_lang('H'.$helpName); ?>
<?php echo get_lang('H'.$help_name); ?>
</title>
<?php
if(api_get_setting('stylesheets')<>'')
{
?>
if (api_get_setting('stylesheets') != '') {
?>
<style type="text/css" media="screen, projection">
/*<![CDATA[*/
@import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/<?php echo $my_style;?>/default.css";
@import "<?php echo api_get_path(WEB_CSS_PATH), $my_style;?>/default.css";
/*]]>*/
</style>
<?php
<?php
}
?>
</head>
<body>
<body dir="<?php echo api_get_text_direction(); ?>">
<div style="margin:10px;">
<div style="text-align:right;"><a href="javascript:window.close();"><?php echo get_lang('Close'); ?></a></div>
<div style="text-align:right;"><a href="javascript: window.close();"><?php echo get_lang('Close'); ?></a></div>
<a href="faq.php"><?php echo get_lang('AccessToFaq') ?></a>
<h4>
<?php echo get_lang('H'.$helpName); ?>
<?php echo get_lang('H'.$help_name); ?>
</h4>
<?php echo get_lang($helpName.'Content'); ?>
<?php echo get_lang($help_name.'Content'); ?>
<br /><br />
<a href="faq.php"><?php echo get_lang('AccessToFaq') ?></a>
<div style="text-align:right;"><a href="javascript:window.close();"><?php echo get_lang('Close'); ?></a></div>
<a href="faq.php"><?php echo get_lang('AccessToFaq'); ?></a>
<div style="text-align:right;"><a href="javascript: window.close();"><?php echo get_lang('Close'); ?></a></div>
</div>
</body>
</html>
Loading…
Cancel
Save