made a copy
[atutor.git] / include / html / editor_tabs / accessibility.inc.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton*/
6 /* Adaptive Technology Resource Centre / University of Toronto                  */
7 /* http://atutor.ca                                                                                                             */
8 /*                                                                                                                                              */
9 /* This program is free software. You can redistribute it and/or                */
10 /* modify it under the terms of the GNU General Public License                  */
11 /* as published by the Free Software Foundation.                                                */
12 /************************************************************************/
13 // $Id$
14
15 if (!defined('AT_INCLUDE_PATH')) { exit; }
16
17 //make decisions
18 if ($_POST['make_decision']) 
19 {
20         //get list of decisions 
21         $desc_query = '';
22         if (is_array($_POST['d'])) {
23                 foreach ($_POST['d'] as $sequenceID => $decision) {
24                         $desc_query .= '&'.$sequenceID.'='.$decision;
25                 }
26         }
27
28         $checker_url = AT_ACHECKER_URL. 'decisions.php?'
29                                 .'uri='.urlencode($_POST['pg_url']).'&id='.AT_ACHECKER_WEB_SERVICE_ID
30                                 .'&session='.$_POST['sessionid'].'&output=html'.$desc_query;
31
32         if (@file_get_contents($checker_url) === false) {
33                 $msg->addInfo('DECISION_NOT_SAVED');
34         }
35
36 else if (isset($_POST['reverse'])) 
37 {
38         $reverse_url = AT_ACHECKER_URL. 'decisions.php?'
39                                 .'uri='.urlencode($_POST['pg_url']).'&id='.AT_ACHECKER_WEB_SERVICE_ID
40                                 .'&session='.$_POST['sessionid'].'&output=html&reverse=true&'.key($_POST['reverse']).'=N';
41         
42         if (@file_get_contents($reverse_url) === false) {
43                 $msg->addInfo('DECISION_NOT_REVERSED');
44         } else {
45                 $msg->addInfo('DECISION_REVERSED');
46         }
47 }
48
49 ?>
50         <div class="row">
51                 <?php                                   
52                         echo '<input type="hidden" name="body_text" value="'.htmlspecialchars(stripslashes($_POST['body_text'])).'" />';
53
54                         if (!$cid) {
55                                 $msg->printInfos('SAVE_CONTENT');
56
57                                 echo '</div>';
58
59                                 return;
60                         }
61
62                 $msg->printInfos();
63                 if ($_POST['body_text'] != '') {
64                         //save temp file
65                         $_POST['content_path'] = $content_row['content_path'];
66                         write_temp_file();
67
68                         $pg_url = AT_BASE_HREF.'get_acheck.php/'.$_POST['cid'] . '.html';
69
70                         $checker_url = AT_ACHECKER_URL.'checkacc.php?uri='.urlencode($pg_url).'&id='.AT_ACHECKER_WEB_SERVICE_ID
71                                                         . '&guide=WCAG2-L2&output=html';
72
73                         $report = @file_get_contents($checker_url);
74
75                         if (stristr($report, '<div id="error">')) {
76                                 $msg->printErrors('INVALID_URL');
77                         } else if ($report === false) {
78                                 $msg->printInfos('SERVICE_UNAVAILABLE');
79                         } else {
80                                 echo '<input type="hidden" name="pg_url" value="'.$pg_url.'" />';
81                                 echo $report;   
82
83                                 echo '<p>'._AT('access_credit').'</p>';
84                         }
85                         //delete file
86                         @unlink(AT_CONTENT_DIR . $_POST['cid'] . '.html');
87                 
88                 } else {
89                         $msg->printInfos('NO_PAGE_CONTENT');
90                 } 
91
92         ?>
93         </div>