]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-7861 xhtml strict fixes for wiki
authortoyomoyo <toyomoyo>
Wed, 10 Jan 2007 03:07:24 +0000 (03:07 +0000)
committertoyomoyo <toyomoyo>
Wed, 10 Jan 2007 03:07:24 +0000 (03:07 +0000)
course/mod.php
mod/wiki/ewiki/plugins/moodle/moodle_wikidump.php
mod/wiki/ewiki/plugins/moodle/wantedpages.php
mod/wiki/lib.php
mod/wiki/mod.html
mod/wiki/removepages.html
mod/wiki/revertpages.html
mod/wiki/setpageflags.html
mod/wiki/strippages.html
theme/standard/styles_layout.css

index 8d24ef4297a8c02b3028c4d9f2678029fe1699d1..78134941bfa091f909f532d2192146606c061d8f 100644 (file)
             $defaultformat = FORMAT_MOODLE;
         }
 
-        $icon = '<img class="icon" src="'.$CFG->modpixpath.'/'.$module->name.'/icon.gif" />';
+        $icon = '<img class="icon" src="'.$CFG->modpixpath.'/'.$module->name.'/icon.gif" alt="'.get_string('modulename',$module->name).'"/>';
 
         print_heading_with_help($pageheading, "mods", $module->name, $icon);
         print_simple_box_start('center', '', '', 5, 'generalbox', $module->name);
index ce2098b2fb51897794dee3211a5b773436bc333d..460cabc06b079240af60b2cc12b9725e60d21ceb 100644 (file)
@@ -64,44 +64,47 @@ function moodle_ewiki_page_wiki_dump($id=0, $data=0, $action=0) {
   $ret  = ewiki_make_title($id, $id, 2);
   $ret .= ($cont&&$cont!==true)?$cont."<br /><br />\n":"";
   $ret .= get_string("wikiexportcomment","wiki");
+  // removing name="form" from the following form as it does not validate
+  // and is not referenced. MDL-7861
   $ret .= "<br /><br />\n".
-    '<FORM name="form" method="post" action="'.$url.'">'."\n".
-    '<INPUT TYPE="HIDDEN" NAME="userid" VALUE="'.$userid.'" />'."\n".
-    '<INPUT TYPE="HIDDEN" NAME="groupid" VALUE="'.$groupid.'" />'."\n".
-    '<INPUT TYPE="HIDDEN" NAME="id" VALUE="'.$cm->id.'" />'."\n".
-    '<INPUT TYPE="HIDDEN" NAME="wikipage" VALUE="'.$wikipage.'" />'."\n".
-    "<CENTER>\n";
+    '<FORM method="post" action="'.$url.'">'."\n".
+    "<div class=\"wikiexportbox\">\n".
+    '<INPUT type="hidden" name="userid" value="'.$userid.'" />'."\n".
+    '<INPUT type="hidden" name="groupid" value="'.$groupid.'" />'."\n".
+    '<INPUT type="hidden" name="id" value="'.$cm->id.'" />'."\n".
+    '<INPUT type="hidden" name="wikipage" value="'.$wikipage.'" />'."\n";
+    
   
   // Export binaries too ?
   if(!$wiki->ewikiacceptbinary) {
-    $ret.='<INPUT TYPE="HIDDEN" NAME="exportbinaries" VALUE="0" />'.$exportdestinations[0]."\n";
+    $ret.='<INPUT type="hidden" name="exportbinaries" value="0" />'.$exportdestinations[0]."\n";
   } else {
-    $ret.='<INPUT TYPE="HIDDEN" NAME="exportbinaries" VALUE="0" />'."\n";
+    $ret.='<INPUT type="hidden" name="exportbinaries" value="0" />'."\n";
   }
-  $ret.="<TABLE cellpadding=5>\n";
+  $ret.="<TABLE cellpadding=\"5\">\n";
   if($wiki->ewikiacceptbinary) {
-    $ret.="  <TR valign=top>\n".
-        '    <TD align=right>'.get_string("withbinaries","wiki").":</TD>\n".
+    $ret.="  <TR valign=\"top\">\n".
+        '    <TD align="right">'.get_string("withbinaries","wiki").":</TD>\n".
         "    <TD>\n".
         '      <input type="checkbox" name="exportbinaries" value="1"'.($_REQUEST["exportbinaries"]==1?" checked":"")." />\n".
         "    </TD>\n".
         "  </TR>\n";
   }
-  $ret.="  <TR valign=top>\n".
-      '    <TD align=right>'.get_string("withvirtualpages","wiki").":</TD>\n".
+  $ret.="  <TR valign=\"top\">\n".
+      '    <TD align="right">'.get_string("withvirtualpages","wiki").":</TD>\n".
       "    <TD>\n".
       '      <input type="checkbox" name="withvirtualpages" value="1"'.($_REQUEST["withvirtualpages"]==1?" checked":"")." />\n".
       "    </TD>\n".
       "  </TR>\n";
   $exportformats=array( "0" => get_string("plaintext","wiki") , "1" => get_string("html","wiki"));
   /// Formats
-  $ret.="  <TR valign=top>\n".
-        '    <TD align=right>'.get_string("exportformats","wiki").":</TD>\n".
+  $ret.="  <TR valign=\"top\">\n".
+        '    <TD align="right">'.get_string("exportformats","wiki").":</TD>\n".
         "    <TD>\n";
   if($wiki->htmlmode!=2) {
     $ret.= choose_from_menu($exportformats, "exportformats", $_REQUEST["exportformats"], "", "", "", true)."\n";
   } else {
-    $ret.= '<INPUT TYPE="HIDDEN" NAME="exportformats" VALUE="1" />'.
+    $ret.= '<INPUT type="hidden" name="exportformats" value="1" />'.
            get_string("html","wiki");
   }
   $ret.="    </TD>\n".
@@ -117,11 +120,11 @@ function moodle_ewiki_page_wiki_dump($id=0, $data=0, $action=0) {
     }
   }
   
-  $ret.="  <TR valign=top>\n".
-        '    <TD align=right>'.get_string("exportto","wiki").":</TD>\n".
+  $ret.="  <TR valign=\"top\">\n".
+        '    <TD align="right">'.get_string("exportto","wiki").":</TD>\n".
         "    <TD>\n";
   if(count($exportdestinations)==1) {
-    $ret.='<INPUT TYPE="HIDDEN" NAME="exportdestinations" VALUE="0" />'.$exportdestinations[0]."\n";
+    $ret.='<INPUT type="hidden" name="exportdestinations" value="0" />'.$exportdestinations[0]."\n";
   } else {
     $ret.=choose_from_menu($exportdestinations, "exportdestinations", $_REQUEST["exportdestinations"], "", "", "", true)."\n";
   }
@@ -129,7 +132,7 @@ function moodle_ewiki_page_wiki_dump($id=0, $data=0, $action=0) {
       "  </TR>\n".      
       "</TABLE>\n".
       '  <input type="submit" name="wikiexport" value= "'.get_string("export","wiki").'" />'."\n".
-      "</CENTER>\n";
+      "</div>\n";
       "</FORM>\n";
   return $ret;
 }
index 6bb25f27056f944af48c3de9e29e30f4259c5e90..dc3869da4fc3cd984be0188e86b66c2267d06309 100644 (file)
@@ -19,11 +19,11 @@ function ewiki_page_wantedpages($id, $data, $action) {
         $refs .= $row["refs"];
     }
 
-   #-- build array
-   $refs = array_unique(explode("\n", $refs));
+    #-- build array
+    $refs = array_unique(explode("\n", $refs));
 
-   #-- strip existing pages from array
-   $refs = ewiki_database("FIND", $refs);
+    #-- strip existing pages from array
+    $refs = ewiki_database("FIND", $refs);
     foreach ($refs as $id=>$exists) {
         if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $uu, "view")) {
             continue;
@@ -33,21 +33,33 @@ function ewiki_page_wantedpages($id, $data, $action) {
         }
     }
 
-   #-- print out
-   $o .= "<ul>";   
-   foreach ($wanted as $page) {
-
-      $link = ewiki_link_regex_callback(array($page, $page));
+    // to prevent empty <ul></ul> getting printed out, we have to interate twice.
+    // once to make sure the <ul></ul> is needed at all. 
+    // MDL-7861, <ul></ul> does not validate.
+   
+    $printul = false; 
+    foreach ($wanted as $page) {
+        $link = ewiki_link_regex_callback(array($page, $page));
+        if (strstr($link, "?</a>")) {
+            $printul = true;
+        }
+    }
+    #-- print out
+   
+    if ($printul) {
+        $o .= "<ul>";   
+        foreach ($wanted as $page) {
 
-      if (strstr($link, "?</a>")) {
-         $o .= "<li>" . $link . "</li>";
-      }
+            $link = ewiki_link_regex_callback(array($page, $page));
 
-   }
-   $o .= "<ul>";
+            if (strstr($link, "?</a>")) {
+                $o .= "<li>" . $link . "</li>";
+            }
 
-   return($o);
+        }
+        $o .= "</ul>";
+    }
+    return($o);
 }
 
-
 ?>
index 38a94e3a6f9d79ed60eadd0bb2938bf326e912be..2a84cd2d3446950c96187f73d96031884121fd26 100644 (file)
@@ -1225,7 +1225,7 @@ function wiki_admin_setpageflags_list($pageflagstatus) {
     foreach ($FD as $n=>$str) {
         $cell_flags .='<input type="checkbox" name="flags['. rawurlencode($id)
             . '][' . $n . ']" value="1" '
-            . (($data["flags"] & $n) ? "CHECKED=\"checked\"" : "")
+            . (($data["flags"] & $n) ? "checked=\"checked\"" : "")
             . ' />'.$str. ' ';
     }
     if($pageflagstatus) {
@@ -1408,7 +1408,7 @@ function wiki_admin_strip_list($pagestostrip="",$version="",$err="") {
         }
         $checked="";
         if($pagestostrip=="" || $pagestostrip[$i]) {
-          $checked=" CHECKED";
+          $checked=" checked=\"checked\"";
         }
         if($version=="") {
           $versiondefault="1-".($row["version"]-1);
index bdc2924d1bf9dedc1273741ae40ac47b6fcb3f62..3dfa17c9a27895bec602117c8109d35ac5bd3a7b 100644 (file)
@@ -62,7 +62,7 @@
 
 <form id="form" method="post" action="mod.php">
 <fieldset class="invisiblefieldset">
-<center>
+<div class="boxaligncenter">
 <table cellpadding="5">
 <tr valign="top">
     <td align="right"><b><?php  print_string('name') ?>:</b></td>
     <td align="right">
     <b> <?php print_string('wikilinkoptions', 'wiki') ?>:</b></td>
     <td>
-        <input type="checkbox" name="disablecamelcase" value="1" <?php echo $form->disablecamelcase?"CHECKED":""; ?> alt="<?php print_string('disablecamel', 'wiki') ?>" />
+        <input type="checkbox" name="disablecamelcase" value="1" <?php echo $form->disablecamelcase?"checked=\"checked\"":""; ?> alt="<?php print_string('disablecamel', 'wiki') ?>" />
         <?php print_string('disablecamel', 'wiki') ?><br />
         <?php helpbutton('wikilinkoptions', get_string('wikilinkoptions', 'wiki'), 'wiki') ?>
     </td>
     <b> <?php print_string('studentadminoptions', 'wiki') ?>:</b></td>
     <td>
         <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr>
-        <td width="50%">
-        <input type="checkbox" name="setpageflags" value="1" <?php echo $form->setpageflags?"CHECKED":""; ?> alt="<?php print_string('allowsetpage', 'wiki') ?>" />
+        <td style="width:50%">
+        <input type="checkbox" name="setpageflags" value="1" <?php echo $form->setpageflags?"checked=\"checked\"":""; ?> alt="<?php print_string('allowsetpage', 'wiki') ?>" />
         <?php print_string('allowsetpage', 'wiki') ?><br />
-        <input type="checkbox" name="strippages" value="1" <?php echo $form->strippages?"CHECKED":""; ?> alt="<?php print_string('allowstrippages', 'wiki') ?>" />
+        <input type="checkbox" name="strippages" value="1" <?php echo $form->strippages?"checked=\"checked\"":""; ?> alt="<?php print_string('allowstrippages', 'wiki') ?>" />
         <?php print_string('allowstrippages', 'wiki') ?><br />
         </td>
-        <td width="50%">
-        <input type="checkbox" name="removepages" value="1" <?php echo $form->removepages?"CHECKED":""; ?> alt="<?php print_string('allowremovepages', 'wiki') ?>" />
+        <td style="width:50%">
+        <input type="checkbox" name="removepages" value="1" <?php echo $form->removepages?"checked=\"checked\"":""; ?> alt="<?php print_string('allowremovepages', 'wiki') ?>" />
         <?php print_string('allowremovepages', 'wiki') ?>
         <?php helpbutton('studentadminoptions', get_string('studentadminoptions', 'wiki'), 'wiki') ?>
         <br />
-        <input type="checkbox" name="revertchanges" value="1" <?php echo $form->revertchanges?"CHECKED":""; ?> alt="<?php print_string('allowrevertchanges', 'wiki') ?>" />
+        <input type="checkbox" name="revertchanges" value="1" <?php echo $form->revertchanges?"checked=\"checked\"":""; ?> alt="<?php print_string('allowrevertchanges', 'wiki') ?>" />
         <?php print_string('allowrevertchanges', 'wiki') ?><br />
         </td>
         </tr></table>
 </tr>
 
 <tr valign="top">
-    <td align="right" nowrap="nowrap">
+    <td style="text-align:right;white-space:nowrap;">
         <b><?php echo get_string("initialcontent", "wiki") ?>:</b>
     </td>
     <td>
 <input type="hidden" name="id"            value="<?php  p($form->instance) ?>" />
 <input type="hidden" name="mode"          value="<?php  p($form->mode) ?>" />
 <input type="submit" value="<?php  print_string('savechanges') ?>" />
-</center>
+</div>
 </fieldset>
 </form>
index ad1ac51541d87585867b9f6afdb412b06743f62e..98d8b3b31029cbfd00b87992158c9620ad2a37ce 100644 (file)
@@ -16,7 +16,7 @@
   $remove_table=wiki_admin_remove_list($form->listall);
   print_table($remove_table);
 ?>
-<center>
+<div class="boxaligncenter">
 <?php
   if(!count($remove_table->data)) {
     print get_string("nocandidatestoremove","wiki",get_string("listall","wiki"))."<br /><br />";
@@ -30,4 +30,4 @@
   }
 ?>
   <input type="submit" name="proceed" value="<?php print get_string("removeselectedpages","wiki"); ?>" />
-</center></field></form>
+</div></fieldset></form>
index e94ba8220b0ae88a09858d2f8dfbd4f3f691c25d..afef5eb1c9dfa1adda4c5ec55aa99bcfd1284f96 100644 (file)
@@ -16,32 +16,32 @@ if (!isset($form->changesfield)) {
 <input type="hidden" name="id" value="<?php print $cm->id ?>" />
 <input type="hidden" name="wikipage" value="<?php print $wikipage?>" />
 
-<center>
+<div class="boxaligncenter">
 <?php
 if($err->remark) {
   formerr($err->remark);
 }
 ?>
-<table cellpadding=5>
-<tr valign=top>
-    <td align=right><p><b><?php print_string('authorfieldpattern','wiki') ?>:</b></p></td>
+<table cellpadding="5">
+<tr valign="top">
+    <td align="right"><p><b><?php print_string('authorfieldpattern','wiki') ?>:</b></p></td>
     <td>
-        <input type="text" name="authorfieldpattern" size=30 value="<?php p($form->authorfieldpattern) ?>" />
+        <input type="text" name="authorfieldpattern" size="30" value="<?php p($form->authorfieldpattern) ?>" />
 <?php
         helpbutton('revertauthorfieldpattern', get_string('authorfieldpattern', 'wiki'), 'wiki');
         if (!empty($err->authorfieldpattern)) { formerr($err->authorfieldpattern); }
 ?>
     </td>
 </tr>
-<tr valign=top>
-    <td align=right><p><b><?php print_string('changesfield','wiki') ?>:</b></p></td>
+<tr valign="top">
+    <td align="right"><p><b><?php print_string('changesfield','wiki') ?>:</b></p></td>
     <td>
-        <input type="text" name="changesfield" size=30 value="<?php p($form->changesfield) ?>" />
+        <input type="text" name="changesfield" size="30" value="<?php p($form->changesfield) ?>" />
         <?php if (!empty($err->changesfield)) { formerr($err->changesfield); } ?>
     </td>
 </tr>
-<tr valign=top>
-    <td align=right><p><b><?php print_string('howtooperate', 'wiki') ?>:</b></p></td>
+<tr valign="top">
+    <td align="right"><p><b><?php print_string('howtooperate', 'wiki') ?>:</b></p></td>
     <td>
         <?php
         $operations=array( "lastonly" => get_string("revertlastonly","wiki"),
@@ -51,13 +51,13 @@ if($err->remark) {
         ?>
     </td>
 </tr>
-<tr valign=top>
-    <td align=right><p><b><?php print_string('deleteversions','wiki') ?>:</b></p></td>
+<tr valign="top">
+    <td align="right"><p><b><?php print_string('deleteversions','wiki') ?>:</b></p></td>
     <td>
-        <input type="text" name="deleteversions" size=2 value="<?php p($form->deleteversions) ?>" />
+        <input type="text" name="deleteversions" size="2" value="<?php p($form->deleteversions) ?>" />
         <?php if (!empty($err->deleteversions)) { formerr($err->deleteversions); } ?>
     </td>
 </tr>
 </table>
   <input type="submit" name="proceed" value="<?php print get_string("revertchanges","wiki"); ?>" />
-</center></fieldset></form>
+</div></fieldset></form>
index 019327b4f31cbe572b15cc6d74eb279f634c4e48..340f3895a88a9e58d6604cc29b6ce743ff660587 100644 (file)
@@ -14,6 +14,6 @@
   print_table($pageflags_table);
 ?>
 <br />
-<center>
+<div class="boxaligncenter">
   <input type="submit" name="proceed" value="<?php print get_string("setpageflags","wiki"); ?>" />
-</center></fieldset></form>
+</div></fieldset></form>
index 9a7a2c317054a4f88963a9704969c07aaf259bd5..9167f87866450298d51f8937941124b001971ff7 100644 (file)
   $strip_table=wiki_admin_strip_list($form->pagestostrip, $form->version, $err);
   print_table($strip_table);
 ?>
-<center>
+<div class="boxaligncenter">
 <?php
   if(!count($strip_table->data)) {
     print get_string("nothingtostrip","wiki")."<br /><br />";
   }
 ?>
   <input type="submit" name="proceed" value="<?php print get_string("strippages","wiki"); ?>" />
-</center></fieldset></form>
\ No newline at end of file
+</div></fieldset></form>
\ No newline at end of file
index 6789ff47caba1a2a2eb6a4d18958405befc26919..006118847f5397b952e0ea6a39cd587de7ad0215 100644 (file)
@@ -2673,6 +2673,11 @@ wikiadminactions {
   text-align:right;
   padding-bottom: 0.5em;
 }
+
+.wikiexportbox{
+  margin-left:auto;
+  margin-right:auto;
+}
 /***
  *** Modules: Workshop
  ***/