Removes wcag_anysurfer_public_pages option see #7091

1.10.x
Julio Montoya 10 years ago
parent 209c00e310
commit 4517bf875d
  1. 57
      main/admin/configure_homepage.php
  2. 21
      main/admin/configure_inscription.php
  3. 20
      main/admin/system_announcements.php
  4. 13
      main/course_description/add.php
  5. 12
      main/course_description/course_description_controller.php
  6. 15
      main/course_description/edit.php
  7. 192
      main/inc/lib/WCAG/WCAG_rendering.php
  8. 6
      main/inc/lib/WCAG/index.html
  9. 1
      main/inc/lib/database.lib.php
  10. 5
      main/install/db_main.sql
  11. 2
      main/install/migrate-db-1.9.0-1.10.0-pre.sql

@ -200,9 +200,6 @@ if (api_is_multiple_url_enabled()) {
// Check WCAG settings and prepare edition using WCAG
$errorMsg = '';
if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
$errorMsg = WCAG_Rendering::request_validation();
}
// Filter link param
$link = '';
@ -224,12 +221,7 @@ if (!empty($action)) {
switch ($action) {
case 'edit_top':
// Filter
$home_top = '';
if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
$home_top = WCAG_Rendering::prepareXHTML();
} else {
$home_top = trim(stripslashes($_POST['home_top']));
}
$home_top = trim(stripslashes($_POST['home_top']));
// Write
if (is_writable($homep)) {
@ -334,12 +326,8 @@ if (!empty($action)) {
break;
case 'edit_news':
//Filter
//$s_languages_news=$_POST["news_languages"]; // TODO: Why this line has been disabled?
if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
$home_news = WCAG_rendering::prepareXHTML();
} else {
$home_news = trim(stripslashes($_POST['home_news']));
}
$home_news = trim(stripslashes($_POST['home_news']));
//Write
if ($s_languages_news != 'all') {
if (file_exists($homep.$newsf.'_'.$s_languages_news.$ext)) {
@ -387,14 +375,7 @@ if (!empty($action)) {
$link_name = trim(stripslashes($_POST['link_name']));
$link_url = trim(stripslashes($_POST['link_url']));
$add_in_tab = intval($_POST['add_in_tab']);
// WCAG
if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
$link_html = WCAG_Rendering::prepareXHTML();
} else {
$link_html = trim(stripslashes($_POST['link_html']));
}
$link_html = trim(stripslashes($_POST['link_html']));
$filename = trim(stripslashes($_POST['filename']));
$target_blank = $_POST['target_blank'] ? true : false;
@ -882,22 +863,13 @@ switch ($action) {
if (!empty($target_blank)) { $target_blank_checkbox->setChecked(true); }
if ($action == 'edit_link' && (empty($link_url) || $link_url == 'http://' || $link_url == 'https://')) {
if (api_get_setting('wcag_anysurfer_public_pages')=='true') {
$form->addElement('html', WCAG_Rendering::create_xhtml(isset($_POST['link_html'])?$_POST['link_html']:$link_html));
} else {
$default['link_html'] = isset($_POST['link_html']) ? $_POST['link_html'] : $link_html;
$form->add_html_editor('link_html', get_lang('Content'), false, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
}
$default['link_html'] = isset($_POST['link_html']) ? $_POST['link_html'] : $link_html;
$form->add_html_editor('link_html', get_lang('Content'), false, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
} else {
if (in_array($action, array('edit_tabs','insert_tabs'))) {
if (api_get_setting('wcag_anysurfer_public_pages')=='true') {
$form->addElement('html', get_lang('Content').' ('.get_lang('Optional').')');
$form->addElement('html', WCAG_Rendering::create_xhtml(isset($_POST['link_html'])?$_POST['link_html']:(!empty($link_html) ? $link_html : '')));
} else {
$default['link_html'] = isset($_POST['link_html']) ? $_POST['link_html'] : (!empty($link_html) ? $link_html : '');
$form->add_html_editor('link_html', get_lang('Content'), false, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
}
$default['link_html'] = isset($_POST['link_html']) ? $_POST['link_html'] : (!empty($link_html) ? $link_html : '');
$form->add_html_editor('link_html', get_lang('Content'), false, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
}
$form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'), array('id' => 'all_langs'));
$form->addElement('html','<table id="table_langs" style="margin-left:159px;"><tr>');
@ -968,17 +940,8 @@ switch ($action) {
$form->addElement('html', $html);
}
if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
//TODO: review these lines
// Print WCAG-specific HTML editor
$html = '<tr><td>';
$html .= WCAG_Rendering::create_xhtml($open);
$html .= '</td></tr>';
$form->addElement('html', $html);
} else {
$default[$name] = str_replace('{rel_path}', api_get_path(REL_PATH), $open);
$form->add_html_editor($name, '', true, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
}
$default[$name] = str_replace('{rel_path}', api_get_path(REL_PATH), $open);
$form->add_html_editor($name, '', true, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
$form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'),array('id' => 'all_langs'));
$form->addElement('html','<table id="table_langs" style="margin-left:5px;"><tr>');

@ -115,14 +115,8 @@ if (!empty($action)) {
switch ($action) {
case 'edit_top':
// Filter
$home_top = '';
if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
$home_top = WCAG_Rendering::prepareXHTML();
} else {
$home_top = trim(stripslashes($_POST['register_top']));
}
$home_top = trim(stripslashes($_POST['register_top']));
// Write
if (file_exists($homep.$topf.'_'.$lang.$ext)) {
if (is_writable($homep.$topf.'_'.$lang.$ext)) {
$fp = fopen($homep.$topf.'_'.$lang.$ext, 'w');
@ -361,17 +355,8 @@ switch ($action){
$renderer->setElementTemplate('<tr><td>{element}</td></tr>');
$renderer->setRequiredNoteTemplate('');
$form->addElement('hidden', 'formSent', '1');
if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
//TODO: review these lines
// Print WCAG-specific HTML editor
$html = '<tr><td>';
$html .= WCAG_Rendering::create_xhtml($open);
$html .= '</td></tr>';
$form->addElement('html', $html);
} else {
$default[$name] = str_replace('{rel_path}', api_get_path(REL_PATH), $open);
$form->add_html_editor($name, '', true, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
}
$default[$name] = str_replace('{rel_path}', api_get_path(REL_PATH), $open);
$form->add_html_editor($name, '', true, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
$form->setDefaults($default);
$form->display();

@ -142,11 +142,7 @@ if ($action_todo) {
}
$form->addElement('select', 'lang',get_lang('Language'), $language_list_with_keys);
if (api_get_setting('wcag_anysurfer_public_pages')=='true') {
$form->addElement('textarea', 'content', get_lang('Content'));
} else {
$form->add_html_editor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'PortalNews', 'Width' => '100%', 'Height' => '300'));
}
$form->add_html_editor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'PortalNews', 'Width' => '100%', 'Height' => '300'));
$form->addDateRangePicker('range', get_lang('StartTimeWindow'), true, array('id' => 'date_range'));
$group = array();
@ -182,13 +178,8 @@ if ($action_todo) {
$class='save';
$form->addElement('hidden', 'action', 'edit');
}
$form->addElement('checkbox', 'send_email_test', null, get_lang('SendOnlyAnEmailToMySelfToTest'));
$form->addElement('style_submit_button', 'submit', $text, 'class="'.$class.'"');
if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
$values['content'] = WCAG_Rendering::HTML_to_text($values['content']);
}
$form->setDefaults($values);
if ($form->validate()) {
@ -205,9 +196,6 @@ if ($action_todo) {
if ($values['lang'] == 'all') {
$values['lang'] = null;
}
if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
//$values['content'] = WCAG_Rendering::text_to_HTML($values['content']);
}
$sendMail = isset($values['send_mail']) ? $values['send_mail'] : null;
@ -262,13 +250,7 @@ if ($action_todo) {
}
$show_announcement_list = true;
} else {
if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
echo '<div class="WCAG-form">';
}
$form->display();
if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
echo '</div>';
}
$show_announcement_list = false;
}
}

@ -54,12 +54,7 @@ $form->addElement('hidden', 'description_type',$description_type);
$form->addElement('hidden', 'sec_token',$token);
$form->add_textfield('title', get_lang('Title'), true, array('size'=>'width: 350px;'));
$form->applyFilter('title','html_filter');
if (api_get_setting('wcag_anysurfer_public_pages')=='true') {
WCAG_rendering::prepare_admin_form($description_content, $form);
} else {
$form->add_html_editor('contentDescription', get_lang('Content'), true, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '100%', 'Height' => '200'));
}
$form->add_html_editor('contentDescription', get_lang('Content'), true, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '100%', 'Height' => '200'));
$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
// display default questions
@ -68,10 +63,4 @@ if (isset ($question[$description_type])) {
$message .= $question[$description_type];
Display::display_normal_message($message, false);
}
if (api_get_setting('wcag_anysurfer_public_pages')=='true') {
echo (WCAG_Rendering::editor_header());
}
$form->display();
if (api_get_setting('wcag_anysurfer_public_pages')=='true') {
echo (WCAG_Rendering::editor_footer());
}

@ -74,11 +74,7 @@ class CourseDescriptionController
$check = Security::check_token();
if ($check) {
$title = $_POST['title'];
if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
$content = WCAG_Rendering::prepareXHTML();
} else {
$content = $_POST['contentDescription'];
}
$content = $_POST['contentDescription'];
$description_type = $_POST['description_type'];
$id = $_POST['id'];
$progress = $_POST['progress'];
@ -166,11 +162,7 @@ class CourseDescriptionController
$check = Security::check_token();
if ($check) {
$title = $_POST['title'];
if (api_get_setting('wcag_anysurfer_public_pages')=='true') {
$content = WCAG_Rendering::prepareXHTML();
} else {
$content = $_POST['contentDescription'];
}
$content = $_POST['contentDescription'];
$description_type = $_POST['description_type'];
if ($description_type >= ADD_BLOCK) {
$course_description->set_description_type($description_type);

@ -58,12 +58,7 @@ $form->addElement('hidden', 'description_type',$description_type);
$form->addElement('hidden', 'sec_token',$token);
$form->add_textfield('title', get_lang('Title'), true, array('size'=>'50'));
$form->applyFilter('title','html_filter');
if (api_get_setting('wcag_anysurfer_public_pages')=='true') {
WCAG_rendering::prepare_admin_form($description_content, $form);
} else {
$form->add_html_editor('contentDescription', get_lang('Content'), true, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '100%', 'Height' => '200'));
}
$form->add_html_editor('contentDescription', get_lang('Content'), true, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '100%', 'Height' => '200'));
$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
// Set some default values
@ -82,12 +77,4 @@ if (isset ($question[$description_type])) {
$message .= $question[$description_type];
Display::display_normal_message($message, false);
}
if (api_get_setting('wcag_anysurfer_public_pages')=='true') {
echo (WCAG_Rendering::editor_header());
}
$form->display();
if (api_get_setting('wcag_anysurfer_public_pages')=='true') {
echo (WCAG_Rendering::editor_footer());
}

@ -1,192 +0,0 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP version 4.0 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Adam Daniel <adaniel1@eesus.jnj.com> |
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: wai_rendering.php,v 1.0 2006/10/07 20:12:17 avb Exp $
/**
* @package chamilo.include
*/
/**
* helper for WCAG rendering.
*
* @author Patrick Vandermaesen <pvandermaesen@noctis.be>
* @version 1.0
* @package chamilo.include
*/
class WCAG_Rendering
{
function editor_header() {
return '<div id="WCAG-editor"><div class="title">'.get_lang('WCAGEditor').'</div><div class="body">';
}
function editor_footer() {
return '</div></div>';
}
function prepareXHTML() {
$text = $_POST['text'];
$text = WCAG_Rendering::text_to_HTML ( $text );
$imageFile = $_POST['imagefile'];
$imageLabel = $_POST['imageLabel'];
$link = $_POST['link'];
$linkLabel = $_POST['linkLabel'];
if (strlen($linkLabel) == 0) {
$linkLabel = $link;
}
$home_top='<div id="WCAG-home"><img src="'.$imageFile.'" alt="'.$imageLabel.'" />'.'<p>'.$text.'</p>';
if (strlen($link) > 0) {
$home_top = $home_top.'<a href="'.$link.'">'.$linkLabel.'</a>';
}
$home_top=$home_top."<div style=\"clear:both;\"><span></span></div></div>";
return $home_top;
}
/**
* this method validate the content of current request (from WCAG editor).
* this function return the error msg.
*/
function request_validation() {
$imageFile = $_POST['imagefile'];
$imageLabel = $_POST['imageLabel'];
if ((strlen($imageFile) > 0) and (strlen($imageLabel) == 0)) {
return get_lang('ErrorNoLabel');
}
return '';
}
/**
* Converter Plaintext to (x)HTML
*/
function text_to_HTML ($Text)
{
$t = $Text;
$t = stripslashes($t);
$t = str_replace(">", "&gt;", $t);
$t = str_replace("<", "&lt;", $t);
$t = preg_replace("/(\015\012)|(\015)|(\012)/", "<br />\n", $t);
$t = str_replace(" ", " &nbsp;", $t);
return $t;
}
function HTML_to_text ($xhtml) {
// convert HTML to text.
$text = str_replace("<br />", "", $xhtml);
$text = str_replace("<br/>", "", $text);
$text = str_replace("&nbsp;", " ", $text);
return $text;
}
function extract_data ($xhtml) {
$text = $xhtml;
if (stripos($xhtml, '<p>')) {
$startP = stripos ($xhtml, "<p>");
$endP = stripos ($xhtml, "</p>");
$text = substr ($xhtml, $startP+3, $endP-$startP-3 );
}
// convert HTML to text.
$text = WCAG_Rendering::HTML_to_text($text);
$url='';
if (stripos($xhtml, '<img')) {
$startImgURL = stripos ($xhtml, "src=\"");
$endImgURL = stripos ($xhtml, "\" ");
$url = substr ($xhtml, $startImgURL+5, $endImgURL-$startImgURL-5 );
$subxhtml = substr ($xhtml, $endImgURL+2, $startP);
$startImgLabel = stripos ($subxhtml, "alt=\"");
$endImgLabel = stripos ($subxhtml, "\" ");
$label = substr ($subxhtml, $startImgLabel+5, $endImgLabel-$startImgLabel-5 );
}
$subxhtml = substr ($xhtml, $endImgURL+2, $startP);
$startImgLabel = stripos ($subxhtml, "alt=\"");
$endImgLabel = stripos ($subxhtml, "\" ");
$label = substr ($subxhtml, $startImgLabel+5, $endImgLabel-$startImgLabel-5 );
$subxhtml = substr ($xhtml, $endP+2, 9999999999);
$link="";
$linkLabel="";
if (stripos($subxhtml, '<a href')) {
$startLinkURL = stripos ($subxhtml, "ref=\"");
$endLinkURL = stripos ($subxhtml, "\">");
$link = substr ($subxhtml, $startLinkURL+5, $endLinkURL-$startLinkURL-5 );
$endLinkLabel = stripos ($subxhtml, "</a>");
$linkLabel = substr ( $subxhtml, $endLinkURL+2, $endLinkLabel-$endLinkURL-2 );
}
$values = array("text"=>$text,
"imagefile"=>$url,
"imageLabel"=>$label,
"link"=>$link,
"linkLabel"=>$linkLabel);
return $values;
}
/**
* add a form for set WCAG content (replace FCK)
* @version 1.1
*/
function &prepare_admin_form( $xhtml, &$form )
{
$values = WCAG_Rendering::extract_data($xhtml);
if ($form == null) {
$form = new FormValidator('waiForm');
}
$form->addElement('textarea','text',get_lang('WCAGContent'));
$file =& $form->addElement('text','imagefile',get_lang('WCAGImage'));
$form->addElement('text','imageLabel',get_lang('WCAGLabel'));
$form->addElement('text','link',get_lang('WCAGLink'));
$form->addElement('text','linkLabel',get_lang('WCAGLinkLabel'));
$form->setDefaults($values);
$renderer =& $form->defaultRenderer();
$element_template = '<!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->{label}<br />
<!-- BEGIN error --><span class="form_error">{error}</span><br /><!-- END error --> {element}<br />';
$renderer->setElementTemplate($element_template);
return $form;
}
function &create_xhtml($xhtml) {
$values = WCAG_Rendering::extract_data($xhtml);
$xhtml = WCAG_Rendering::editor_header();
$xhtml .= get_lang('WCAGContent').'<br />';
$xhtml .= '<textarea name="text">'.$values['text'].'</textarea>';
$xhtml .= get_lang('WCAGImage').'<br />';
$xhtml .= '<input type="text" name="imagefile" value="'.$values['imagefile'].'"/>';
$xhtml .= '<br />';
$xhtml .= '<a href="#" onclick="OpenFileBrowser (\''.api_get_path(WEB_PATH) . 'main/inc/lib/fckeditor/'.'editor/plugins/ImageManagerStandalone/genericManager.php?uploadPath=/\');">'.get_lang('SelectPicture').'</a>';
$xhtml .= '<br />';
$xhtml .= get_lang('WCAGLabel').'<br />';
$xhtml .= '<input type="text" name="imageLabel" value="'.$values['imageLabel'].'"/>';
$xhtml .= get_lang('WCAGLink').'<br />';
$xhtml .= '<input type="text" name="link" value="'.$values['link'].'"/>';
$xhtml .= get_lang('WCAGLinkLabel').'<br />';
$xhtml .= '<input type="text" name="linkLabel" value="'.$values['linkLabel'].'"/>';
$xhtml .= WCAG_Rendering::editor_footer();;
return $xhtml;
}
} // end class WAI_Rendering

@ -1,6 +0,0 @@
<html>
<head>
</head>
<body>
</body>
</html>

@ -769,7 +769,6 @@ class Database
strpos($query, 'static_') === false &&
strpos($query, 'public_admin') === false &&
strpos($query, 'chamilo_electric_blue') === false &&
strpos($query, 'wcag_anysurfer_public_pages') === false &&
strpos($query, 'specific_field') === false &&
strpos($query, 'down_doc_path') === false &&
strpos($query, 'INNER JOIN') === false &&

@ -670,7 +670,6 @@ VALUES
('service_ppt2lp', 'ftp_password', 'textfield', NULL, NULL, 'FtpPassword', NULL, NULL, NULL, 0),
('service_ppt2lp', 'path_to_lzx', 'textfield', NULL, NULL, '', NULL, NULL, NULL, 0),
('service_ppt2lp', 'size', 'radio', NULL, '720x540', '', NULL, NULL, NULL, 0),
('wcag_anysurfer_public_pages', NULL, 'radio','Editor','false','PublicPagesComplyToWAITitle','PublicPagesComplyToWAIComment', NULL, NULL, 0),
('stylesheets', NULL, 'textfield','stylesheets','chamilo','',NULL, NULL, NULL, 1),
('upload_extensions_list_type', NULL, 'radio', 'Security', 'blacklist', 'UploadExtensionsListType', 'UploadExtensionsListTypeComment', NULL, NULL, 0),
('upload_extensions_blacklist', NULL, 'textfield', 'Security', '', 'UploadExtensionsBlacklist', 'UploadExtensionsBlacklistComment', NULL, NULL, 0),
@ -884,7 +883,7 @@ VALUES
('tool_visible_by_default_at_creation','forums','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Forums', 1),
('tool_visible_by_default_at_creation','quiz','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Quiz', 1),
('tool_visible_by_default_at_creation','gradebook','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Gradebook', 1),
('chamilo_database_version', NULL, 'textfield',NULL, '1.10.0.9','DatabaseVersion','', NULL, NULL, 0);
('chamilo_database_version', NULL, 'textfield',NULL, '1.10.0.10','DatabaseVersion','', NULL, NULL, 0);
UNLOCK TABLES;
/*!40000 ALTER TABLE settings_current ENABLE KEYS */;
@ -984,8 +983,6 @@ VALUES
('allow_email_editor', 'false', 'No'),
('show_email_addresses','true','Yes'),
('show_email_addresses','false','No'),
('wcag_anysurfer_public_pages', 'true', 'Yes'),
('wcag_anysurfer_public_pages', 'false', 'No'),
('upload_extensions_list_type', 'blacklist', 'Blacklist'),
('upload_extensions_list_type', 'whitelist', 'Whitelist'),
('upload_extensions_skip', 'true', 'Remove'),

@ -49,6 +49,8 @@ ALTER TABLE track_e_course_access ADD COLUMN c_id int NOT NULL;
ALTER TABLE track_e_online ADD COLUMN c_id int NOT NULL;
ALTER TABLE track_e_attempt ADD COLUMN c_id int NOT NULL;
DELETE FROM settings_current WHERE variable = 'wcag_anysurfer_public_pages';
DELETE FROM settings_options WHERE variable = 'wcag_anysurfer_public_pages';
-- Do not move this query
UPDATE settings_current SET selected_value = '1.10.0.9' WHERE variable = 'chamilo_database_version';

Loading…
Cancel
Save