Merge branch 'MDL-56849-master' of git://github.com/damyon/moodle

This commit is contained in:
Dan Poltawski 2016-11-21 08:36:27 +00:00
commit 05551a935a
6 changed files with 41 additions and 57 deletions

View File

@ -24,9 +24,10 @@ function wiki_print_editor_html($pageid, $content, $version = -1, $section = nul
$action .= "&section=".urlencode($section);
}
echo $OUTPUT->container_start('mdl-align');
echo $OUTPUT->container_start('container');
echo '<form method="post" action="'.$action.'">';
echo $OUTPUT->container(print_textarea(true, 20, 100, 0, 0, "newcontent", $content, 0, true, '', 'form-textarea-advanced'), 'wiki_editor');
$textarea = print_textarea(true, 20, 100, 0, 0, "newcontent", $content, 0, true, '', 'form-textarea-advanced');
echo $OUTPUT->container($textarea, 'wiki_editor');
wiki_print_edit_form_default_fields('html', $pageid, $version, $upload, $deleteuploads);
echo '</form>';
echo $OUTPUT->container_end();

View File

@ -64,7 +64,7 @@ function wiki_print_editor_wiki($pageid, $content, $editor, $version = -1, $sect
$PAGE->requires->js('/mod/wiki/editors/wiki/buttons.js');
echo $OUTPUT->container_start('mdl-align');
echo $OUTPUT->container_start();
foreach ($wiki_editor as $button) {
echo "<a href=\"javascript:insertTags";
echo "('" . $button[2] . "','" . $button[3] . "','" . $button[4] . "');\">";
@ -73,7 +73,7 @@ function wiki_print_editor_wiki($pageid, $content, $editor, $version = -1, $sect
}
echo $OUTPUT->container_end();
echo $OUTPUT->container_start('mdl-align');
echo $OUTPUT->container_start();
echo '<form method="post" id="mform1" action="' . $action . '">';
echo $OUTPUT->container(print_textarea(false, 20, 60, 0, 0, "newcontent", $content, 0, true), false, 'wiki_editor');
echo $OUTPUT->container_start();

View File

@ -53,8 +53,6 @@ class MoodleQuickForm_wikieditor extends MoodleQuickForm_textarea {
$this->files = $attributes['files'];
unset($attributes['files']);
}
parent::__construct($elementName, $elementLabel, $attributes);
$this->_type = 'wikieditor';
}
@ -144,7 +142,8 @@ class MoodleQuickForm_wikieditor extends MoodleQuickForm_textarea {
$html .= "</a>";
}
$html .= "<label class='accesshide' for='addtags'>" . get_string('insertimage', 'wiki') . "</label>";
$html .= "<select id='addtags' onchange=\"insertTags('{$imagetag[0]}', '{$imagetag[1]}', this.value)\">";
$html .= "<select id='addtags' class='custom-select m-x-1' " .
"onchange=\"insertTags('{$imagetag[0]}', '{$imagetag[1]}', this.value)\">";
$html .= "<option value='" . s(get_string('wikiimage', 'wiki')) . "'>" . get_string('insertimage', 'wiki') . '</option>';
foreach ($this->files as $filename) {
$html .= "<option value='".s($filename)."'>";
@ -178,7 +177,15 @@ class MoodleQuickForm_wikieditor extends MoodleQuickForm_textarea {
public function export_for_template(renderer_base $output) {
$context = $this->export_for_template_base($output);
// We do want the form-control class on the output from toHTML - but we dont' want it when calling export_for_template.
// This is because in this type of form element the export_for_template calls toHTML to get the html for the context.
// If we did both we would be duplicating the form-control which messes up the styles.
$saved = $this->getAttribute('class');
$this->updateAttributes(['class' => $saved . ' form-control']);
$context['html'] = $this->toHtml();
$this->updateAttributes(['class' => $saved]);
return $context;
}

View File

@ -1438,14 +1438,14 @@ function wiki_print_edit_form_default_fields($format, $pageid, $version = -1, $u
echo "<fieldset class=\"wiki-upload-section clearfix\"><legend class=\"ftoggler\">" . get_string("uploadtitle", 'wiki') . "</legend>";
echo $OUTPUT->container_start('mdl-align wiki-form-center aaaaa');
echo $OUTPUT->container_start('container');
print $filemanager->toHtml();
echo $OUTPUT->container_end();
$cm = $PAGE->cm;
$context = context_module::instance($cm->id);
echo $OUTPUT->container_start('mdl-align wiki-form-center wiki-upload-table');
echo $OUTPUT->container_start('container wiki-upload-table');
wiki_print_upload_table($context, 'wiki_upload', $pageid, $deleteuploads);
echo $OUTPUT->container_end();

View File

@ -1282,7 +1282,6 @@ class page_wiki_history extends page_wiki {
$table = new html_table();
$table->head = array('', get_string('version'), get_string('user'), get_string('modified'), '');
$table->data = $contents;
$table->attributes['class'] = 'mdl-align';
echo html_writer::table($table);
@ -1314,15 +1313,15 @@ class page_wiki_history extends page_wiki {
$table->head = array(get_string('diff', 'wiki') . $icon, get_string('version'), get_string('user'), get_string('modified'), '');
$table->data = $contents;
$table->attributes['class'] = 'generaltable mdl-align';
$table->attributes['class'] = 'table generaltable';
$table->rowclasses = $rowclass;
// Print the form.
echo html_writer::start_tag('form', array('action'=>new moodle_url('/mod/wiki/diff.php'), 'method'=>'get', 'id'=>'diff'));
echo html_writer::tag('div', html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'pageid', 'value'=>$pageid)));
echo html_writer::table($table);
echo html_writer::start_tag('div', array('class'=>'mdl-align'));
echo html_writer::empty_tag('input', array('type'=>'submit', 'class'=>'wiki_form-button', 'value'=>get_string('comparesel', 'wiki')));
echo html_writer::start_tag('div');
echo html_writer::empty_tag('input', array('type'=>'submit', 'class'=>'wiki_form-button btn btn-secondary', 'value'=>get_string('comparesel', 'wiki')));
echo html_writer::end_tag('div');
echo html_writer::end_tag('form');
}
@ -1336,11 +1335,11 @@ class page_wiki_history extends page_wiki {
//print_paging_bar($vcount, $paging, $rowsperpage,$CFG->wwwroot.'/mod/wiki/history.php?pageid='.$pageid.'&amp;','paging');
} else {
$link = new moodle_url('/mod/wiki/history.php', array('pageid' => $pageid));
$OUTPUT->container(html_writer::link($link->out(false), get_string('viewperpage', 'wiki', $this->rowsperpage)), 'mdl-align');
$OUTPUT->container(html_writer::link($link->out(false), get_string('viewperpage', 'wiki', $this->rowsperpage)));
}
if ($vcount > $this->rowsperpage && !$this->allversion) {
$link = new moodle_url('/mod/wiki/history.php', array('pageid' => $pageid, 'allversion' => 1));
$OUTPUT->container(html_writer::link($link->out(false), get_string('viewallhistory', 'wiki')), 'mdl-align');
$OUTPUT->container(html_writer::link($link->out(false), get_string('viewallhistory', 'wiki')));
}
}
@ -1484,7 +1483,7 @@ class page_wiki_map extends page_wiki {
$table = new html_table();
$table->head = array(get_string('contributions', 'wiki') . $OUTPUT->help_icon('contributions', 'wiki'));
$table->attributes['class'] = 'wiki_editor generalbox';
$table->attributes['class'] = 'generalbox table';
$table->data = array();
$table->rowclasses = array();
@ -1548,7 +1547,7 @@ class page_wiki_map extends page_wiki {
$fromlinks = wiki_get_linked_from_pages($page->id);
$table = new html_table();
$table->attributes['class'] = 'wiki_navigation_from';
$table->attributes['class'] = 'wiki_navigation_from table';
$table->head = array(get_string('navigationfrom', 'wiki') . $OUTPUT->help_icon('navigationfrom', 'wiki') . ':');
$table->data = array();
$table->rowclasses = array();
@ -1556,13 +1555,12 @@ class page_wiki_map extends page_wiki {
$lpage = wiki_get_page($link->frompageid);
$link = new moodle_url('/mod/wiki/view.php', array('pageid' => $lpage->id));
$table->data[] = array(html_writer::link($link->out(false), format_string($lpage->title)));
$table->rowclasses[] = 'mdl-align';
}
$table_left = html_writer::table($table);
$table_left = $OUTPUT->container(html_writer::table($table), 'col-md-6 span6');
$table = new html_table();
$table->attributes['class'] = 'wiki_navigation_to';
$table->attributes['class'] = 'wiki_navigation_to table';
$table->head = array(get_string('navigationto', 'wiki') . $OUTPUT->help_icon('navigationto', 'wiki') . ':');
$table->data = array();
$table->rowclasses = array();
@ -1575,10 +1573,9 @@ class page_wiki_map extends page_wiki {
$viewlink = new moodle_url('/mod/wiki/view.php', array('pageid' => $lpage->id));
$table->data[] = array(html_writer::link($viewlink->out(false), format_string($lpage->title)));
}
$table->rowclasses[] = 'mdl-align';
}
$table_right = html_writer::table($table);
echo $OUTPUT->container($table_left . $table_right, 'wiki_navigation_container');
$table_right = $OUTPUT->container(html_writer::table($table), 'col-md-6 span6');
echo $OUTPUT->container($table_left . $table_right, 'wiki_navigation_container row');
}
/**
@ -1604,7 +1601,7 @@ class page_wiki_map extends page_wiki {
$table = new html_table();
$table->head = array(get_string('pageindex', 'wiki') . $OUTPUT->help_icon('pageindex', 'wiki'));
$table->attributes['class'] = 'wiki_editor generalbox';
$table->attributes['class'] = 'generalbox table';
$table->data[] = array($this->render_navigation_node($tree));
echo html_writer::table($table);
@ -1643,8 +1640,7 @@ class page_wiki_map extends page_wiki {
$table = new html_table();
$table->head = array(get_string('pagelist', 'wiki') . $OUTPUT->help_icon('pagelist', 'wiki'));
$table->attributes['class'] = 'wiki_editor generalbox';
$table->align = array('center');
$table->attributes['class'] = 'generalbox table';
foreach ($stdaux as $key => $elem) {
$table->data[] = array($key);
foreach ($elem as $e) {
@ -1673,7 +1669,7 @@ class page_wiki_map extends page_wiki {
$table = new html_table();
$table->head = array(get_string('orphaned', 'wiki') . $OUTPUT->help_icon('orphaned', 'wiki'));
$table->attributes['class'] = 'wiki_editor generalbox';
$table->attributes['class'] = 'generalbox table';
$table->data = array();
$table->rowclasses = array();
@ -1709,7 +1705,7 @@ class page_wiki_map extends page_wiki {
$table = new html_table();
$table->head = array(get_string('updatedpages', 'wiki') . $OUTPUT->help_icon('updatedpages', 'wiki'));
$table->attributes['class'] = 'wiki_editor generalbox';
$table->attributes['class'] = 'generalbox table';
$table->data = array();
$table->rowclasses = array();
@ -1894,7 +1890,7 @@ class page_wiki_restoreversion extends page_wiki {
$restoreurl = new moodle_url('/mod/wiki/restoreversion.php', $optionsyes);
$return = new moodle_url('/mod/wiki/viewversion.php', array('pageid'=>$this->page->id, 'versionid'=>$version->id));
echo $OUTPUT->container_start('wiki-form-center');
echo $OUTPUT->container_start();
echo html_writer::tag('div', get_string('restoreconfirm', 'wiki', $version->version));
echo $OUTPUT->container_start(false, 'wiki_restoreform');
echo '<form class="wiki_restore_yes" action="' . $restoreurl . '" method="post" id="restoreversion">';
@ -1964,7 +1960,7 @@ class page_wiki_deletecomment extends page_wiki {
$deleteurl = new moodle_url('/mod/wiki/instancecomments.php', $optionsyes);
$return = new moodle_url('/mod/wiki/comments.php', array('pageid'=>$this->page->id));
echo $OUTPUT->container_start('wiki-form-center');
echo $OUTPUT->container_start();
echo html_writer::tag('p', $strdeletecheckfull);
echo $OUTPUT->container_start(false, 'wiki_deletecommentform');
echo '<form class="wiki_deletecomment_yes" action="' . $deleteurl . '" method="post" id="deletecomment">';
@ -2137,7 +2133,7 @@ class page_wiki_viewversion extends page_wiki {
$viewlink = new moodle_url('/user/view.php', array('id' => $userinfo->id));
$heading .= '&nbsp;&nbsp;&nbsp;<strong>' . get_string('user') . ':</strong>&nbsp;' . html_writer::link($viewlink->out(false), fullname($userinfo));
$heading .= '&nbsp;&nbsp;&rarr;&nbsp;' . $OUTPUT->user_picture(wiki_get_user_info($pageversion->userid), array('popup' => true)) . '</p>';
echo $OUTPUT->container($heading, 'wiki_headingtime', 'mdl-align wiki_modifieduser');
echo $OUTPUT->container($heading, 'wiki_headingtime', 'wiki_modifieduser');
$options = array('swid' => $this->subwiki->id, 'pretty_print' => true, 'pageid' => $this->page->id);
$pageversion->content = file_rewrite_pluginfile_urls($pageversion->content, 'pluginfile.php', $this->modcontext->id, 'mod_wiki', 'attachments', $this->subwiki->id);
@ -2509,7 +2505,7 @@ class page_wiki_admin extends page_wiki {
$contents = array();
$table = new html_table();
$table->head = array('', get_string('pagename','wiki'));
$table->attributes['class'] = 'generaltable mdl-align';
$table->attributes['class'] = 'table generaltable';
$swid = $this->subwiki->id;
if ($showorphan) {
if ($orphanedpages = wiki_get_orphaned_pages($swid)) {
@ -2536,7 +2532,7 @@ class page_wiki_admin extends page_wiki {
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'option', 'value' => $this->view));
echo html_writer::table($table);
echo html_writer::start_tag('div', array('class' => 'mdl-align'));
echo html_writer::start_tag('div');
if (!$showorphan) {
echo html_writer::empty_tag('input', array(
'type' => 'submit',
@ -2547,7 +2543,7 @@ class page_wiki_admin extends page_wiki {
echo html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'listall', 'value'=>'1'));
echo html_writer::empty_tag('input', array(
'type' => 'submit',
'class' => 'wiki_form-button',
'class' => 'wiki_form-button btn btn-secondary',
'value' => get_string('listall', 'wiki'),
'sesskey' => sesskey()));
}
@ -2629,7 +2625,6 @@ class page_wiki_admin extends page_wiki {
$table = new html_table();
$table->head = array('', get_string('version'), get_string('user'), get_string('modified'), '');
$table->data = $contents;
$table->attributes['class'] = 'mdl-align';
echo html_writer::table($table);
} else {
@ -2668,7 +2663,7 @@ class page_wiki_admin extends page_wiki {
$table = new html_table();
$table->head = array(get_string('deleteversions', 'wiki'), get_string('version'), get_string('user'), get_string('modified'), '');
$table->data = $contents;
$table->attributes['class'] = 'generaltable mdl-align';
$table->attributes['class'] = 'table generaltable';
$table->rowclasses = $rowclass;
///Print the form
@ -2677,8 +2672,8 @@ class page_wiki_admin extends page_wiki {
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'option', 'value' => $this->view));
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
echo html_writer::table($table);
echo html_writer::start_tag('div', array('class' => 'mdl-align'));
echo html_writer::empty_tag('input', array('type' => 'submit', 'class' => 'wiki_form-button', 'value' => get_string('deleteversions', 'wiki')));
echo html_writer::start_tag('div');
echo html_writer::empty_tag('input', array('type' => 'submit', 'class' => 'wiki_form-button btn btn-secondary', 'value' => get_string('deleteversions', 'wiki')));
echo html_writer::end_tag('div');
echo html_writer::end_tag('form');
}

View File

@ -35,13 +35,6 @@
min-height: 100px;
}
.wiki_editor {
width: 50%;
margin: auto;
margin-top: 10px;
margin-bottom: 10px;
}
.wiki_previewbox {
width: 50%;
margin: auto;
@ -92,12 +85,6 @@
margin-left: 0%;
}
.wiki-form-center {
text-align: center;
margin: auto;
width: 320px;
}
.wiki-upload-table {
margin: 8px auto;
clear: both;
@ -364,12 +351,6 @@ a.wiki_edit_section {
text-align: right;
}
.wikieditor-toolbar img {
width: 22px;
height: 22px;
vertical-align: middle;
}
.path-mod-wiki .printicon {
background: url([[pix:t/print]]) no-repeat scroll 2px center transparent;
padding-left: 20px;