Skip to content

Commit

Permalink
MDL-7861 related problems for wiki. use_html_editor() call in ewiki.p…
Browse files Browse the repository at this point in the history
…hp is probably causing additional problems.
  • Loading branch information
toyomoyo committed Jan 9, 2007
1 parent c7b8ac3 commit beae179
Show file tree
Hide file tree
Showing 15 changed files with 65 additions and 28 deletions.
2 changes: 1 addition & 1 deletion lib/weblib.php
Expand Up @@ -3694,7 +3694,7 @@ function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $v
}
}
}
$str .= '<textarea class="form=textarea" id="'. $id .'" name="'. $name .'" rows="'. $rows .'" cols="'. $cols .'">';
$str .= '<textarea class="form-textarea" id="'. $id .'" name="'. $name .'" rows="'. $rows .'" cols="'. $cols .'">';
if ($usehtmleditor) {
$str .= htmlspecialchars($value); // needed for editing of cleaned text!
} else {
Expand Down
3 changes: 2 additions & 1 deletion mod/wiki/admin.php
Expand Up @@ -269,6 +269,7 @@
echo '<tr><td colspan="2">';

echo '<form id="otherwikis" action="'.$CFG->wwwroot.'/mod/wiki/admin.php">';
echo '<fieldset class="invisiblefieldset">';
echo '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>';
echo '<td class="sideblockheading">&nbsp;'
.$WIKI_TYPES[$wiki->wtype].' '
Expand All @@ -288,7 +289,7 @@
choose_from_menu($wiki_admin_list, "wikiselect", $selected, "choose", $script);
echo '</td>';
echo '</tr></table>';
echo '</form>';
echo '</fieldset></form>';

echo '</td>';
echo '</tr>';
Expand Down
3 changes: 2 additions & 1 deletion mod/wiki/checklinks.html
Expand Up @@ -3,6 +3,7 @@

?>
<form action="admin.php" method="post" enctype="multipart/form-data">
<fieldset class="invisiblefieldset">
<input type="hidden" name="userid" value="<?php print $userid; ?>" />
<input type="hidden" name="groupid" value="<?php print $groupid ?>" />
<input type="hidden" name="action" value="<?php print $action; ?>" />
Expand All @@ -13,4 +14,4 @@
choose_from_menu($pagelist, "pagetocheck", $wikipage, "");
?>
<input type="submit" name="proceed" value="<?php print get_string("checklinks","wiki"); ?>" />
</center></FORM>
</center></fieldset></form>
26 changes: 17 additions & 9 deletions mod/wiki/ewiki/ewiki.php
Expand Up @@ -1094,8 +1094,10 @@ function ewiki_page_search($id, &$data, $action) {
if (! ($q = @$_REQUEST["q"])) {

$o .= '<form action="' . ewiki_script("", $id) . '" method="post">';
$o .= '<fieldset class="invisiblefieldset">';
$o .= '<input name="q" size="30" /><br /><br />';
$o .= '<input type="submit" value="'.$id.'" />';
$o .= '</fieldset>';
$o .= '</form>';
}
else {
Expand Down Expand Up @@ -1269,7 +1271,7 @@ function ewiki_page_info($id, &$data, $action) {
}

##### BEGIN MOODLE ADDITION #####
$o .= '<tr class="page-'.$i.'"><td valign="top" align="right" nowrap="nowrap"><b>' .ewiki_t($i). ':</b></td>' .
$o .= '<tr class="page-'.$i.'"><td style="vertical-align:top;text-align:right;white-space: nowrap;"><b>' .ewiki_t($i). ':</b></td>' .
'<td>' . $value . "</td></tr>\n";
##### END MOODLE ADDITION #####

Expand Down Expand Up @@ -1537,11 +1539,12 @@ function ewiki_page_edit_form(&$id, &$data, &$hidden_postdata) {
$hidden_postdata["version"] = &$data["version"];

#-- edit textarea/form
// deleted name="ewiki", can not find the reference, and it's breaking xhtml
$o .= ewiki_t("EDIT_FORM_1")
. '<form method="post" enctype="multipart/form-data" action="'
. ewiki_script("edit", $id) . '" name="ewiki"'
. ewiki_script("edit", $id) . '" '
. ' accept-charset="'.EWIKI_CHARSET.'">' . "\n";

$o .= '<fieldset class="invisiblefieldset">';
#-- additional POST vars
foreach ($hidden_postdata as $name => $value) {
$o .= '<input type="hidden" name="'.$name.'" value="'.$value.'" />'."\n";
Expand All @@ -1564,11 +1567,14 @@ function ewiki_page_edit_form(&$id, &$data, &$hidden_postdata) {
}
print_textarea($usehtmleditor, $rows, $cols, 680, 400, "content", $oldtext);
echo '</td></tr></table>';

$o .= ob_get_contents();
//yu: this is causing problem and i don't know where to put it
if ($usehtmleditor) {
use_html_editor("content");
use_html_editor("content");
}
$o .= ob_get_contents();
ob_end_clean();
ob_end_clean();

} else {
##### END MOODLE ADDITION #####

Expand Down Expand Up @@ -1598,10 +1604,10 @@ function ewiki_page_edit_form(&$id, &$data, &$hidden_postdata) {
$o .= $pf($id, $data, $action);
}

$o .= "\n</form>\n";
$o .= "\n</fieldset></form>\n";
// . ewiki_t("EDIT_FORM_2"); // MOODLE DELETION

return('<div align="center" class="edit-box">'. $o .'</div>');
return('<div class="edit-box">'. $o .'</div>');
}


Expand All @@ -1613,13 +1619,14 @@ function ewiki_page_edit_form_final_imgupload(&$o, &$id, &$data, &$action) {
. '<form action='
. '"'. ewiki_script_binary("", EWIKI_IDF_INTERNAL, "", "_UPLOAD=1") .'"'
. ' method="post" enctype="multipart/form-data" target="_upload">'
. '<fieldset class="invisiblefieldset">'
. '<input type="hidden" name="MAX_FILE_SIZE" value="'.EWIKI_IMAGE_MAXSIZE.'" />'
. '<input type="file" name="'.EWIKI_UP_UPLOAD.'"'
. (defined("EWIKI_IMAGE_ACCEPT") ? ' accept="'.EWIKI_IMAGE_ACCEPT.'" />' : " />")
. '<input type="hidden" name="'.EWIKI_UP_BINARY.'" value="'.EWIKI_IDF_INTERNAL.'" />'
. '&nbsp;&nbsp;&nbsp;'
. '<input type="submit" value="'.ewiki_t("UPLOAD_PICTURE_BUTTON").'" />'
. '</form></div>'. "\n";
. '</fieldset></form></div>'. "\n";
}
}

Expand Down Expand Up @@ -1657,6 +1664,7 @@ function ewiki_control_links($id, &$data, $action) {
if (@$data["forced_version"]) {

$o .= '<form action="' . ewiki_script("edit", $id) . '" method="post">' .
'<fieldset class="invisiblefieldset">'.
'<input type="hidden" name="edit" value="old" />' .
'<input type="hidden" name="version" value="'.$data["forced_version"].'" />' .
'<input type="submit" value="' . ewiki_t("OLDVERCOMEBACK") . '" /></form> ';
Expand Down
3 changes: 2 additions & 1 deletion mod/wiki/ewiki/plugins/email_protect.php
Expand Up @@ -122,14 +122,15 @@ function ewiki_email_protect_form($id, $data=0, $action=0, $text="PROTE1", $url=

$html .= '<form action="' . $url .
'" method="POST" enctype="multipart/form-data" encoding="iso-8859-1">';
$html .= '<fieldset class="invisiblefieldset">';
$html .= '<input type="hidden" name="'.EWIKI_UP_ENCEMAIL.'" value="' . $email . '" />';
foreach (array_merge($_GET, $_POST) as $var=>$value) {
if (($var != "id") && ($var != EWIKI_UP_ENCEMAIL) && ($var != EWIKI_UP_NOSPAMBOT)) {
$html .= '<input type="hidden" name="' . s($var) . '" value="' . s($value) . '" />';
}
}
$html .= '<input type="checkbox" name="'.EWIKI_UP_NOSPAMBOT.'" value="true" /> ' . ewiki_t("PROTE4") . '<br /><br />';
$html .= '<input type="submit" name="go" /></form><br /><br />';
$html .= '<input type="submit" name="go" /></fieldset></form><br /><br />';

if (EWIKI_FAKE_EMAIL_LOOP) {
$html .= "\n" . ewiki_t("PROTE7") . "<br />\n";
Expand Down
3 changes: 2 additions & 1 deletion mod/wiki/ewiki/plugins/moodle/downloads.php
Expand Up @@ -105,6 +105,7 @@ function ewiki_page_fileupload($id, $data, $action, $def_sec="") {
'<form action="' .
ewiki_script( ($action!="view" ? $action : ""), $id).
'" method="POST" enctype="multipart/form-data">' ;
$o. = '<fieldset class="invisiblefieldset">';
require_once($CFG->dirroot.'/lib/uploadlib.php');
$o .= upload_print_form_fragment(1,array(EWIKI_UP_UPLOAD),array(ewiki_t("file")),false,null,0,0,true);
$o .= '<input type="submit" value="' . EWIKI_PAGE_UPLOAD . '" /><br /><br />'
Expand All @@ -126,7 +127,7 @@ function ewiki_page_fileupload($id, $data, $action, $def_sec="") {

$o .= '<b>'.ewiki_t("UPL_NEWNAM").'</b><br /><input type="text" name="new_filename" size="20" /><br /><br />';

$o .= '</form></div>';
$o .= '</fieldset></form></div>';

}
elseif ($upload_file["size"] > EWIKI_UPLOAD_MAXSIZE) {
Expand Down
6 changes: 4 additions & 2 deletions mod/wiki/lib.php
Expand Up @@ -1088,14 +1088,16 @@ function wiki_print_search_form($cmid, $search="", $userid, $groupid, $return=fa
global $CFG;
# TODO: Add Group and User !!!
$output = "<form id=\"search\" action=\"$CFG->wwwroot/mod/wiki/view.php\">";
$output .= "<font size=\"-1\">";
$output .="<fieldset class='invisiblefieldset'>";
$output .= "<span style='font-size:0.6em;'>";
$output .= "<input value=\"".get_string("searchwiki", "wiki").":\" type=\"submit\" />";
$output .= "<input name=\"id\" type=\"hidden\" value=\"$cmid\" />";
$output = $output.($groupid?"<input name=\"groupid\" type=\"hidden\" value=\"$groupid\" />":"");
$output = $output.($userid?"<input name=\"userid\" type=\"hidden\" value=\"$userid\" />":"");
$output .= "<input name=\"q\" type=\"text\" size=\"20\" value=\"".s($search)."\" />".' ';
$output .= "</font>";
$output .= "</span>";
$output .= "<input name=\"page\" type=\"hidden\" value=\"SearchPages\" />";
$output .= "</fieldset>";
$output .= "</form>";

if ($return) {
Expand Down
2 changes: 2 additions & 0 deletions mod/wiki/mod.html
Expand Up @@ -61,6 +61,7 @@
?>

<form id="form" method="post" action="mod.php">
<fieldset class="invisiblefieldset">
<center>
<table cellpadding="5">
<tr valign="top">
Expand Down Expand Up @@ -214,4 +215,5 @@
<input type="hidden" name="mode" value="<?php p($form->mode) ?>" />
<input type="submit" value="<?php print_string('savechanges') ?>" />
</center>
</fieldset>
</form>
3 changes: 2 additions & 1 deletion mod/wiki/removepages.html
Expand Up @@ -6,6 +6,7 @@

?>
<form action="admin.php" method="post" enctype="multipart/form-data">
<fieldset class="invisiblefieldset">
<input type="hidden" name="userid" value="<?php print $userid; ?>" />
<input type="hidden" name="groupid" value="<?php print $groupid ?>" />
<input type="hidden" name="action" value="<?php print $action; ?>" />
Expand All @@ -29,4 +30,4 @@
}
?>
<input type="submit" name="proceed" value="<?php print get_string("removeselectedpages","wiki"); ?>" />
</center></FORM>
</center></field></form>
3 changes: 2 additions & 1 deletion mod/wiki/revertpages.html
Expand Up @@ -9,6 +9,7 @@

?>
<form action="admin.php" method="post" enctype="multipart/form-data">
<fieldset class="invisiblefieldset">
<input type="hidden" name="userid" value="<?php print $userid; ?>" />
<input type="hidden" name="groupid" value="<?php print $groupid ?>" />
<input type="hidden" name="action" value="<?php print $action; ?>" />
Expand Down Expand Up @@ -59,4 +60,4 @@
</tr>
</table>
<input type="submit" name="proceed" value="<?php print get_string("revertchanges","wiki"); ?>" />
</center></form>
</center></fieldset></form>
3 changes: 2 additions & 1 deletion mod/wiki/setpageflags.html
Expand Up @@ -3,6 +3,7 @@

?>
<form action="admin.php" method="post" enctype="multipart/form-data">
<fieldset class="invisiblefieldset">
<input type="hidden" name="userid" value="<?php print $userid; ?>" />
<input type="hidden" name="groupid" value="<?php print $groupid ?>" />
<input type="hidden" name="action" value="<?php print $action; ?>" />
Expand All @@ -15,4 +16,4 @@
<br />
<center>
<input type="submit" name="proceed" value="<?php print get_string("setpageflags","wiki"); ?>" />
</center></FORM>
</center></fieldset></form>
3 changes: 2 additions & 1 deletion mod/wiki/strippages.html
Expand Up @@ -3,6 +3,7 @@

?>
<form action="admin.php" method="post" enctype="multipart/form-data">
<fieldset class="invisiblefieldset">
<input type="hidden" name="userid" value="<?php print $userid; ?>" />
<input type="hidden" name="groupid" value="<?php print $groupid ?>" />
<input type="hidden" name="action" value="<?php print $action; ?>" />
Expand All @@ -19,4 +20,4 @@
}
?>
<input type="submit" name="proceed" value="<?php print get_string("strippages","wiki"); ?>" />
</center></FORM>
</center></fieldset></form>
18 changes: 10 additions & 8 deletions mod/wiki/view.php
Expand Up @@ -252,7 +252,7 @@
}
else {
$content = '';
$content2 = '<div align="center">'.get_string('nowikicreated', 'wiki').'</div>';
$content2 = '<div class="boxaligncenter">'.get_string('nowikicreated', 'wiki').'</div>';

}

Expand Down Expand Up @@ -307,7 +307,7 @@
.get_string('modulename', 'wiki')." ".get_string('for',"wiki")." "
.wiki_get_owner($wiki_entry).':</td>';

echo '<td class="sideblockheading" align="right">'
echo '<td class="sideblockheading">'
.get_string('otherwikis', 'wiki').':&nbsp;&nbsp;';
$script = 'self.location=getElementById(\'otherwikis\').wikiselect.options[getElementById(\'otherwikis\').wikiselect.selectedIndex].value';
choose_from_menu($wiki_list, "wikiselect", $selected, "choose", $script);
Expand All @@ -326,24 +326,24 @@
echo '<tr>';

/// Searchform
echo '<td align="center">';
echo '<td class="wikisearchform">';
wiki_print_search_form($cm->id, $q, $userid, $groupid, false);
echo '</td>';

/// Internal Wikilinks
echo '<td align="center">';
echo '<td class="wikilinksblock">';
wiki_print_wikilinks_block($cm->id, $wiki->ewikiacceptbinary);
echo '</td>';

/// Administrative Links
if($canedit) {
echo '<td align="center">';
echo '<td class="wikiadminactions">';
wiki_print_administration_actions($wiki, $cm->id, $userid, $groupid, $ewiki_title, $wiki->htmlmode!=2, $course);
echo '</td>';
}

/// Formatting Rules
echo '<td align="right">';
echo '<td class="howtowiki">';
helpbutton('howtowiki', get_string('howtowiki', 'wiki'), 'wiki');
echo '</td>';

Expand Down Expand Up @@ -399,7 +399,7 @@
// Insert the link
$linkdesc = get_string('reloadlinkdescription', 'wiki');
$linktext = get_string('reloadlinktext', 'wiki');
echo "<div align='right' style='padding-bottom: 0.5em;'><a href='$me' title='$linkdesc'><input type='button' value='$linktext' /></a></div>";
echo "<div class='wikilinkright'><a href='$me' title='$linkdesc'><input type='button' value='$linktext' /></a></div>";

print_simple_box_start('center', '100%', '', '20');

Expand Down Expand Up @@ -434,11 +434,13 @@
$sesskey=sesskey();
print "
<form id='overridelock' method='post' action='overridelock.php'>
<fieldset class=\"invisiblefieldset\">
<input type='hidden' name='sesskey' value='$sesskey' />
<input type='hidden' name='id' value='$id' />
<input type='hidden' name='page' value='$pageesc' />
$stroverrideinfo
<input type='submit' value='$stroverridebutton' />
</fieldset>
</form>
";
}
Expand Down Expand Up @@ -480,7 +482,7 @@ function handleFailure(o) {
}
print $content2;
print_simple_box_end();
echo "<br clear=\"all\" />";
echo "<br />";

/// Finish the page
echo '
Expand Down
1 change: 1 addition & 0 deletions mod/wiki/wiki_styles.php
Expand Up @@ -84,6 +84,7 @@

<!-- Defines the <div> used for the edit box -->
.edit-box {
text-align:center;
}

<!-- Defines the <div> used for the image upload form -->
Expand Down
14 changes: 14 additions & 0 deletions theme/standard/styles_layout.css
Expand Up @@ -2652,7 +2652,21 @@ body#question-preview .quemodname, body#question-preview .controls {
/***
*** Modules: Wiki
***/
.sideblockheading,
.howtowiki {
text-align:right;
}

.wikisearchform,
.wikilinksblock,
wikiadminactions {
text-align:center;
}

.wikilinkright{
text-align:right;
padding-bottom: 0.5em;
}
/***
*** Modules: Workshop
***/

0 comments on commit beae179

Please sign in to comment.