From 385a7fbe6ee29a23a815985d0cb559d33e52d490 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 29 Jul 2014 17:21:29 +0200 Subject: [PATCH] Removing WCAG see #6713 --- main/admin/configure_homepage.php | 19 +- main/admin/system_announcements.php | 12 -- main/course_description/add.php | 13 +- .../course_description_controller.php | 12 +- main/course_description/edit.php | 20 +- main/course_description/index.php | 1 - main/inc/lib/WCAG/WCAG_rendering.php | 195 ------------------ main/inc/lib/WCAG/index.html | 6 - 8 files changed, 9 insertions(+), 269 deletions(-) delete mode 100644 main/inc/lib/WCAG/WCAG_rendering.php delete mode 100644 main/inc/lib/WCAG/index.html diff --git a/main/admin/configure_homepage.php b/main/admin/configure_homepage.php index b251716d19..2a801ce7fb 100644 --- a/main/admin/configure_homepage.php +++ b/main/admin/configure_homepage.php @@ -17,7 +17,6 @@ $this_page = ''; api_protect_admin_script(); -require_once api_get_path(LIBRARY_PATH).'WCAG/WCAG_rendering.php'; $action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : null; $tbl_category = Database::get_main_table(TABLE_MAIN_CATEGORY); @@ -129,11 +128,7 @@ if (api_is_multiple_url_enabled()) { $homePath = $homep_new; } -// 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 = ''; @@ -155,12 +150,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 (file_exists($homePath.$topf.'_'.$lang.$ext)) { @@ -231,12 +221,7 @@ 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($homePath.$newsf.'_'.$s_languages_news.$ext)) { diff --git a/main/admin/system_announcements.php b/main/admin/system_announcements.php index 0ec4f26a35..289a67a373 100644 --- a/main/admin/system_announcements.php +++ b/main/admin/system_announcements.php @@ -14,12 +14,6 @@ $language_file = array('admin', 'agenda', 'announcements'); // Resetting the course id. $cidReset = true; -// Including the global initialization file. -require_once '../inc/global.inc.php'; - -// Including additional libraries. -require_once api_get_path(LIBRARY_PATH).'WCAG/WCAG_rendering.php'; - // Setting the section (for the tabs). $this_section = SECTION_PLATFORM_ADMIN; $_SESSION['this_section']=$this_section; @@ -173,9 +167,6 @@ if ($action_todo) { } $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()) { $values = $form->exportValues(); @@ -191,9 +182,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']); - } switch ($values['action']) { case 'add': $announcement_id = SystemAnnouncementManager::add_announcement($values['title'],$values['content'],$values['start'],$values['end'],$values['visible_teacher'],$values['visible_student'],$values['visible_guest'], $values['lang'],$values['send_mail'], $values['add_to_calendar']); diff --git a/main/course_description/add.php b/main/course_description/add.php index 4ee6b6f4ac..12a7acb49d 100644 --- a/main/course_description/add.php +++ b/main/course_description/add.php @@ -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()); -} \ No newline at end of file diff --git a/main/course_description/course_description_controller.php b/main/course_description/course_description_controller.php index e642204b15..30ae265340 100644 --- a/main/course_description/course_description_controller.php +++ b/main/course_description/course_description_controller.php @@ -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); diff --git a/main/course_description/edit.php b/main/course_description/edit.php index a5ff08f3bf..9878e8ddef 100644 --- a/main/course_description/edit.php +++ b/main/course_description/edit.php @@ -2,7 +2,7 @@ /* For licensing terms, see /license.txt */ /** -* View (MVC patter) for editing a course description +* View (MVC patter) for editing a course description * @author Christian Fasanando * @package chamilo.course_description */ @@ -38,8 +38,8 @@ foreach ($categories as $id => $title) { echo ''; // error messages -if (isset($error) && intval($error) == 1) { - Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false); +if (isset($error) && intval($error) == 1) { + Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false); } // default header title form @@ -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 @@ -79,11 +74,4 @@ if (isset ($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()); -} \ No newline at end of file diff --git a/main/course_description/index.php b/main/course_description/index.php index 8d3183daa3..f697eb0b48 100644 --- a/main/course_description/index.php +++ b/main/course_description/index.php @@ -17,7 +17,6 @@ $current_course_tool = TOOL_COURSE_DESCRIPTION; require_once api_get_path(LIBRARY_PATH).'course_description.lib.php'; require_once api_get_path(LIBRARY_PATH).'app_view.php'; require_once 'course_description_controller.php'; -require_once api_get_path(LIBRARY_PATH).'WCAG/WCAG_rendering.php'; // defining constants define('ADD_BLOCK', 8); diff --git a/main/inc/lib/WCAG/WCAG_rendering.php b/main/inc/lib/WCAG/WCAG_rendering.php deleted file mode 100644 index 0be05f4dbb..0000000000 --- a/main/inc/lib/WCAG/WCAG_rendering.php +++ /dev/null @@ -1,195 +0,0 @@ - | -// | Bertrand Mansion | -// +----------------------------------------------------------------------+ -// -// $Id: wai_rendering.php,v 1.0 2006/10/07 20:12:17 avb Exp $ -/** - * @package chamilo.include - */ -/** - * Code - */ -include_once ('../inc/global.inc.php'); -include_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'); - -/** - * helper for WCAG rendering. - * - * @author Patrick Vandermaesen - * @version 1.0 - * @package chamilo.include - */ -class WCAG_Rendering { - - function editor_header() { - return '
'.get_lang('WCAGEditor').'
'; - } - - function editor_footer() { - return '
'; - } - - 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='
'.$imageLabel.''.'

'.$text.'

'; - if (strlen($link) > 0) { - $home_top = $home_top.''.$linkLabel.''; - } - $home_top=$home_top."
"; - 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(">", ">", $t); - $t = str_replace("<", "<", $t); - - $t = preg_replace("/(\015\012)|(\015)|(\012)/", "
\n", $t); - $t = str_replace(" ", "  ", $t); - return $t; -} - -function HTML_to_text ($xhtml) { - // convert HTML to text. - $text = str_replace("
", "", $xhtml); - $text = str_replace("
", "", $text); - $text = str_replace(" ", " ", $text); - return $text; -} - -function extract_data ($xhtml) { - $text = $xhtml; - if (stripos($xhtml, '

')) { - $startP = stripos ($xhtml, "

"); - $endP = stripos ($xhtml, "

"); - $text = substr ($xhtml, $startP+3, $endP-$startP-3 ); - } - - // convert HTML to text. - $text = WCAG_Rendering::HTML_to_text($text); - - $url=''; - if (stripos($xhtml, '"); - $link = substr ($subxhtml, $startLinkURL+5, $endLinkURL-$startLinkURL-5 ); - - $endLinkLabel = stripos ($subxhtml, ""); - $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 = '* {label}
- {error}
{element}
'; - $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').'
'; - $xhtml .= ''; - $xhtml .= get_lang('WCAGImage').'
'; - $xhtml .= ''; - $xhtml .= '
'; - $xhtml .= ''.get_lang('SelectPicture').''; - $xhtml .= '
'; - $xhtml .= get_lang('WCAGLabel').'
'; - $xhtml .= ''; - $xhtml .= get_lang('WCAGLink').'
'; - $xhtml .= ''; - $xhtml .= get_lang('WCAGLinkLabel').'
'; - $xhtml .= ''; - - $xhtml .= WCAG_Rendering::editor_footer();; - return $xhtml; -} -} // end class WAI_Rendering diff --git a/main/inc/lib/WCAG/index.html b/main/inc/lib/WCAG/index.html deleted file mode 100644 index aa7b9c934b..0000000000 --- a/main/inc/lib/WCAG/index.html +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file