mod-wiki MDL-25003 Wiki history diff view now uses divs for layout rather than table...
authorSam Hemelryk <sam@moodle.com>
Thu, 11 Nov 2010 04:02:37 +0000 (04:02 +0000)
committerSam Hemelryk <sam@moodle.com>
Thu, 11 Nov 2010 04:02:37 +0000 (04:02 +0000)
mod/wiki/pagelib.php
mod/wiki/renderer.php
mod/wiki/styles.css
theme/standard/style/core.css

index b742f36..4b14a02 100644 (file)
@@ -1302,7 +1302,7 @@ 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'] = 'mdl-align';
+                $table->attributes['class'] = 'generaltable mdl-align';
                 $table->rowclasses = $rowclass;
 
                 /*$table = new StdClass();
@@ -1316,11 +1316,13 @@ class page_wiki_history extends page_wiki {
                  $table->rowclass = $rowclass;*/
 
                 ///Print the form
-                echo '<form action="' . $CFG->wwwroot . '/mod/wiki/diff.php" method="get" id="diff">';
-                echo '<div><input type="hidden" name="pageid" value="' . $pageid . '" /></div>';
+                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 '<div><input class="wiki_form-button" type="submit" value="' . get_string('comparesel', 'wiki') . '"/></div>';
-                echo '</form>';
+                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::end_tag('div');
+                echo html_writer::end_tag('form');
             }
         } else {
             print_string('nohistory', 'wiki');
index 1460ea5..03f6689 100644 (file)
@@ -78,8 +78,9 @@ class mod_wiki_renderer extends plugin_renderer_base {
         } else {
             $total = 0;
         }
-        $diff1 = format_text($old->diff, FORMAT_HTML);
-        $diff2 = format_text($new->diff, FORMAT_HTML);
+        $diff1 = format_text($old->diff, FORMAT_HTML, array('overflowdiv'=>true));
+        $diff2 = format_text($new->diff, FORMAT_HTML, array('overflowdiv'=>true));
+        $strdatetime = get_string('strftimedatetime', 'langconfig');
 
         $olduser = $old->user;
         $versionlink = new moodle_url('/mod/wiki/viewversion.php', array('pageid' => $pageid, 'versionid' => $old->id));
@@ -106,7 +107,7 @@ class mod_wiki_renderer extends plugin_renderer_base {
         $oldheading .= $this->output->container_end();
         // userdate container
         $oldheading .= $this->output->container_start('wiki_difftime');
-        $oldheading .= userdate($old->timecreated, get_string('strftimedatetime', 'langconfig'));
+        $oldheading .= userdate($old->timecreated, $strdatetime);
         $oldheading .= $this->output->container_end();
 
         $newuser = $new->user;
@@ -129,24 +130,17 @@ class mod_wiki_renderer extends plugin_renderer_base {
         $newheading .= $this->output->container_end();
         // userdate
         $newheading .= $this->output->container_start('wiki_difftime');
-        $newheading .= userdate($new->timecreated, get_string('strftimedatetime', 'langconfig'));
+        $newheading .= userdate($new->timecreated, $strdatetime);
         $newheading .= $this->output->container_end();
 
-        $table1 = new html_table();
-        $table1->head = array($oldheading);
-        $table1->width = '100%';
-        $table1->data = array(array($diff1));
+        $oldheading = html_writer::tag('div', $oldheading, array('class'=>'wiki-diff-heading header clearfix'));
+        $newheading = html_writer::tag('div', $newheading, array('class'=>'wiki-diff-heading header  clearfix'));
 
-        $table2 = new html_table();
-        $table2->head = array($newheading);
-        $table2->width = '100%';
-        $table2->data = array(array($diff2));
-        $output = '';
-
-        $box = new html_table();
-        $box->width = '95%';
-        $box->data = array(array(html_writer::table($table1), html_writer::table($table2)));
-        $output .= html_writer::table($box);
+        $output  = '';
+        $output .= html_writer::start_tag('div', array('class'=>'wiki-diff-container clearfix'));
+        $output .= html_writer::tag('div', $oldheading.$diff1, array('class'=>'wiki-diff-leftside'));
+        $output .= html_writer::tag('div', $newheading.$diff2, array('class'=>'wiki-diff-rightside'));
+        $output .= html_writer::end_tag('div');
 
         if (!empty($total)) {
             $output .= '<div class="wiki_diff_paging">';
index e1e7131..497c329 100644 (file)
@@ -341,3 +341,11 @@ a.wiki_edit_section {
     padding-left: 50px;
     padding-top: 20px;
 }
+
+.wiki-diff-container {width:95%;margin:10px auto;}
+.wiki-diff-container .wiki-diff-leftside,
+.wiki-diff-container .wiki-diff-rightside {width:49.5%;margin:0;padding:0;float:left;}
+.wiki-diff-container .wiki-diff-rightside {margin-left:1%;}
+.wiki-diff-container .wiki-diff-heading,
+.wiki-diff-container .no-overflow {padding:10px;border:1px solid #DDD;}
+.wiki-diff-container .wiki-diff-rightside .wiki_diffversion {text-align:right;}
\ No newline at end of file
index c3f8144..76895de 100644 (file)
@@ -56,6 +56,7 @@ h2.headingblock {font-size:1.1em;}
 .errorcode {font-size: 0.7em;}
 
 .generaltable {border:1px solid #DDD;border-collapse: collapse;background-color:#FFF;border-color:#EEEEEE;}
+.generaltable.mdl-align {margin:0 auto;}
 .generaltable td {border:1px solid #DDD;vertical-align:top;}
 .generaltable .cell {background-color:#FFFFFF;border-color:#EEEEEE;}