]> git.mjollnir.org Git - moodle.git/commitdiff
Some changes to event editing. HTML editor now supported, plus some
authormoodler <moodler>
Tue, 27 Apr 2004 17:01:48 +0000 (17:01 +0000)
committermoodler <moodler>
Tue, 27 Apr 2004 17:01:48 +0000 (17:01 +0000)
other reformatting ... more to come.  :o)

calendar/event.php
calendar/event_edit.html
calendar/event_new.html

index c35c4e3e07e3d78ad59fd4906125dd488e051333..80aefeb2531b6c10292c7b68f898800e104bc50f 100644 (file)
     calendar_session_vars();
     $now = usergetdate(time());
     $nav = calendar_get_link_tag(get_string('calendar', 'calendar'), CALENDAR_URL.'view.php?view=upcoming&amp;', $now['mday'], $now['mon'], $now['year']);
+    $day = intval($now['mday']);
+    $mon = intval($now['mon']);
+    $yr = intval($now['year']);
 
-    // Minor hack to default to FORMAT_MOODLE and no html editor for now
-    // maybe in the future...
-
-    if ($usehtmleditor = can_use_richtext_editor() && false) {
+    if ($usehtmleditor = can_use_richtext_editor()) {
         $defaultformat = FORMAT_HTML;
     } else {
         $defaultformat = FORMAT_MOODLE;
@@ -99,8 +99,7 @@
             if($form = data_submitted()) {
 
                 $form->name = strip_tags($form->name);  // Strip all tags
-                $form->description = strip_tags($form->description);  // Strip all tags
-                //$form->description = clean_text($form->description , $form->format);   // Clean up any bad tags
+                $form->description = clean_text($form->description , $form->format);   // Clean up any bad tags
 
                 $form->timestart = make_timestamp($form->startyr, $form->startmon, $form->startday, $form->starthr, $form->startmin);
                 if($form->duration == 1) {
             if(!empty($form) && $form->type == 'defined') {
 
                 $form->name = strip_tags($form->name);  // Strip all tags
-                $form->description = strip_tags($form->description);  // Strip all tags
-                //$form->description = clean_text($form->description , $form->format);   // Clean up any bad tags
+                $form->description = clean_text($form->description , $form->format);   // Clean up any bad tags
 
                 $form->timestart = make_timestamp($form->startyr, $form->startmon, $form->startday, $form->starthr, $form->startmin);
                 if($form->duration == 1) {
 
     /// Layout the whole page as three big columns.
     echo '<table border="0" cellpadding="3" cellspacing="0" width="100%"><tr valign="top">';
-
-    $sections = get_all_sections($site->id);
-
-    if ($site->newsitems > 0 or $sections[0]->sequence or isediting($site->id) or isadmin()) {
-        echo "<td width=\"$side\" valign='top nowrap'>";
-        $firstcolumn=true;
-
-        if ($sections[0]->sequence or isediting($site->id)) {
-            get_all_mods($site->id, $mods, $modnames, $modnamesplural, $modnamesused);
-            print_section_block(get_string("mainmenu"), $site, $sections[0],
-                                 $mods, $modnames, $modnamesused, true, $side);
-        }
-
-    print_courses_sideblock(0, $side);
-        if ($site->newsitems) {
-            if ($news = forum_get_course_forum($site->id, "news")) {
-                print_side_block_start(get_string("latestnews"), $side, "sideblocklatestnews");
-                echo "<font size=\"-2\">";
-                forum_print_latest_discussions($news->id, $site->newsitems, "minimal", "", false);
-                echo "</font>";
-                print_side_block_end();
-            }
-        }
-        print_spacer(1,$side);
-    }
-
-    if (iscreator()) {
-        if (!$firstcolumn) {
-            echo "<td width=\"$side\" valign=top nowrap>";
-            $firstcolumn=true;
-        }
-        print_admin_links($site->id, $side);
-    }
-
-    if ($firstcolumn) {
-        echo '</td>';
-        echo '<td valign="top\">';
-    }
-    else {
-        echo '<td valign="top">';
-    }
-
-    $text = '<div style="float: left;">'.get_string('calendarheading', 'calendar', strip_tags($site->shortname)).'</div><div style="float: right;">';
-    $text.= calendar_get_preferences_menu();
-    $text.= '</div>';
-    print_heading_block($text);
-    print_spacer(8, 1);
+    echo '<td valign="top" width="100%">';
 
     switch($_REQUEST['action']) {
         case 'delete':
             print_side_block_end();
         break;
     }
-
-
-    echo '</td></table>';
+    echo '</td>';
+
+    // START: Last column (3-month display)
+    echo '<td valign="top" width="'.$side.'">';
+    print_side_block_start(get_string('monthlyview', 'calendar'), '', 'sideblockmain');
+    list($prevmon, $prevyr) = calendar_sub_month($mon, $yr);
+    list($nextmon, $nextyr) = calendar_add_month($mon, $yr);
+    echo calendar_filter_controls($_GET['view']);
+    echo '<p>';
+    echo calendar_top_controls('display', array('m' => $prevmon, 'y' => $prevyr));
+    echo calendar_get_mini($courses, $groups, $users, $prevmon, $prevyr);
+    echo '</p><p>';
+    echo calendar_top_controls('display', array('m' => $mon, 'y' => $yr));
+    echo calendar_get_mini($courses, $groups, $users, $mon, $yr);
+    echo '</p><p>';
+    echo calendar_top_controls('display', array('m' => $nextmon, 'y' => $nextyr));
+    echo calendar_get_mini($courses, $groups, $users, $nextmon, $nextyr);
+    echo '</p>';
+    print_side_block_end();
+    print_spacer(1, $side);
+    echo '</td>';
+
+    echo '</tr></table>';
 
     if ($usehtmleditor) {
         use_html_editor();
index 4560b2c4b74f64ee53f60a7ebdf4e81073f5a3fe..d5e41bc30275e29ef2a62f636010c7a0b52e9292 100644 (file)
@@ -1,5 +1,5 @@
 <form method="post" action="event.php" name="edit">\r
-<table class="formtable">\r
+<table cellpadding=5>\r
   <tr>\r
     <td style="vertical-align: top; text-align: right;"><?php print_string('eventname', 'calendar'); ?>:</td>\r
     <td><input type="text" name="name" size="67" value="<?php p($form->name); ?>" /> <?php if (isset($err['name'])) formerr($err['name']); ?></td>\r
@@ -7,8 +7,10 @@
   <tr>\r
     <td style="vertical-align: top; text-align: right;"><?php print_string('eventdescription', 'calendar'); ?>:</td>\r
     <td>\r
-      <textarea name="description" rows="10" cols="50" wrap="virtual"><?php p($form->description); ?></textarea><br />\r
-      <?php if (isset($err['description'])) formerr($err['description']); ?>\r
+    <?php \r
+        print_textarea($usehtmleditor, 25, 65, 630, 400, "description", $form->description);\r
+        if (isset($err['description'])) formerr($err['description']); \r
+    ?>\r
     </td>\r
   </tr>\r
   <tr>\r
     </td>\r
   </tr>\r
   <tr>\r
-    <td>&nbsp;</td>\r
-    <td><p><input type="submit" value=" <?php print_string('ok') ?> "></p></td>\r
+    <td align="center" colspan="2"><p><input type="submit" value="<?php print_string('savechanges') ?>"></p></td>\r
   </tr>\r
 </table>\r
 <p>\r
 <input type="hidden" name="id" value="<?php echo $form->id; ?>" />\r
 <input type="hidden" name="courseid" value="<?php echo $form->courseid; ?>" />\r
-<!--<input type="hidden" name="format" value="<?php echo $form->format; ?>" />-->\r
+<input type="hidden" name="format" value="<?php echo $form->format; ?>" />\r
 <input type="hidden" name="action" value="edit" />\r
 </p>\r
 </form>\r
index bc6222e6d1259ad17107481224c36749911fc32c..0ffab15a9ee25134f5b780532919a21b388e11bf 100644 (file)
@@ -1,5 +1,5 @@
 <form method="post" action="event.php" name="new">\r
-<table class="formtable">\r
+<table cellpadding=5>\r
   <tr>\r
     <td style="vertical-align: top; text-align: right;"><?php print_string('eventname', 'calendar'); ?>:</td>\r
     <td><input type="text" name="name" size="67" value="<?php p($form->name); ?>" /> <?php if (isset($err['name'])) formerr($err['name']); ?></td>\r
@@ -7,8 +7,10 @@
   <tr>\r
     <td style="vertical-align: top; text-align: right;"><?php print_string('eventdescription', 'calendar'); ?>:</td>\r
     <td>\r
-      <textarea name="description" rows="10" cols="50" wrap="virtual"><?php p($form->description); ?></textarea><br />\r
-      <?php if (isset($err['description'])) formerr($err['description']); ?>\r
+    <?php \r
+        print_textarea($usehtmleditor, 10, 65, 630, 200, "description", $form->description);\r
+        if (isset($err['description'])) formerr($err['description']); \r
+    ?>\r
     </td>\r
   </tr>\r
   <tr>\r
@@ -25,8 +27,7 @@
     </td>\r
   </tr>\r
   <tr>\r
-    <td>&nbsp;</td>\r
-    <td><p><input type="submit" value="<?php print_string('ok') ?>"></p></td>\r
+    <td align="center" colspan="2"><p><input type="submit" value="<?php print_string('savechanges') ?>"></p></td>\r
   </tr>\r
 </table>\r
 <p>\r
@@ -36,7 +37,7 @@
 <input type="hidden" name="modulename" value="<?php echo $form->modulename?>" />\r
 <input type="hidden" name="eventtype" value="<?php echo $form->eventtype?>" />\r
 <input type="hidden" name="instance" value="<?php echo $form->instance?>" />\r
-<!--<input type="hidden" name="format" value="<?php echo $form->format; ?>" />-->\r
+<input type="hidden" name="format" value="<?php echo $form->format; ?>" />\r
 <input type="hidden" name="action" value="new" />\r
 <input type="hidden" name="type" value="defined" />\r
 </p>\r