MDL-7861 xhtml strict fixes for wiki

This commit is contained in:
toyomoyo
2007-01-10 03:07:24 +00:00
parent f40c91dc70
commit 82056f6735
10 changed files with 89 additions and 69 deletions
+1 -1
View File
@@ -695,7 +695,7 @@
$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);
@@ -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;
}
+28 -16
View 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) {
// 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) {
$link = ewiki_link_regex_callback(array($page, $page));
$link = ewiki_link_regex_callback(array($page, $page));
if (strstr($link, "?</a>")) {
$o .= "<li>" . $link . "</li>";
}
if (strstr($link, "?</a>")) {
$o .= "<li>" . $link . "</li>";
}
}
$o .= "<ul>";
return($o);
}
$o .= "</ul>";
}
return($o);
}
?>
+2 -2
View 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);
+10 -10
View 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>
@@ -128,7 +128,7 @@
<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>
@@ -139,18 +139,18 @@
<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>
@@ -183,7 +183,7 @@
</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>
@@ -214,6 +214,6 @@
<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>
+2 -2
View 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>
+14 -14
View 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>
+2 -2
View 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>
+2 -2
View File
@@ -13,11 +13,11 @@
$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>
</div></fieldset></form>
+5
View File
@@ -2673,6 +2673,11 @@ wikiadminactions {
text-align:right;
padding-bottom: 0.5em;
}
.wikiexportbox{
margin-left:auto;
margin-right:auto;
}
/***
*** Modules: Workshop
***/