Browse Source

Removing WCAG see #6713

Julio Montoya 10 years ago
parent
commit
385a7fbe6e

+ 2 - 17
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)) {

+ 0 - 12
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']);

+ 1 - 12
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());
-}

+ 2 - 10
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);

+ 4 - 16
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 <christian1827@gmail.com>
 * @package chamilo.course_description
 */
@@ -38,8 +38,8 @@ foreach ($categories as $id => $title) {
 echo '</div>';
 
 // 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());
-}

+ 0 - 1
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);

+ 0 - 195
main/inc/lib/WCAG/WCAG_rendering.php

@@ -1,195 +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
- */
-/**
- * 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 <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

+ 0 - 6
main/inc/lib/WCAG/index.html

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