]> git.mjollnir.org Git - moodle.git/commitdiff
Fixing some of the standard notice functions, adding styles and buttons
authormoodler <moodler>
Tue, 8 Feb 2005 17:09:41 +0000 (17:09 +0000)
committermoodler <moodler>
Tue, 8 Feb 2005 17:09:41 +0000 (17:09 +0000)
lib/adminlib.php
lib/datalib.php
lib/weblib.php

index 647f15ee22e2292982aa1772b098d61d442c0eba..acf54058bddc795f8e05c22f543d66229da92937 100644 (file)
@@ -84,7 +84,7 @@ function upgrade_enrol_plugins($return) {
                     $db->debug=false;
                     // OK so far, now update the modules record
                     set_config($moduleversion, $module->version);
-                    notify(get_string('modulesuccess', '', $module->name), 'green');
+                    notify(get_string('modulesuccess', '', $module->name), 'notifysuccess');
                     echo '<hr />';
                 } else {
                     $db->debug=false;
@@ -180,7 +180,7 @@ function upgrade_activity_modules($return) {
                         if (! update_record('modules', $module)) {
                             error('Could not update '. $module->name .' record in modules table!');
                         }
-                        notify(get_string('modulesuccess', '', $module->name), 'green');
+                        notify(get_string('modulesuccess', '', $module->name), 'notifysuccess');
                         echo '<hr />';
                     } else {
                         $db->debug=false;
@@ -204,7 +204,7 @@ function upgrade_activity_modules($return) {
             if (modify_database($fullmod .'/db/'. $CFG->dbtype .'.sql')) {
                 $db->debug = false;
                 if ($module->id = insert_record('modules', $module)) {
-                    notify(get_string('modulesuccess', '', $module->name), 'green');
+                    notify(get_string('modulesuccess', '', $module->name), 'notifysuccess');
                     echo '<hr />';
                 } else {
                     error($module->name .' module could not be added to the module list!');
index d5da7e54785bf7ca5c7163143ee44f212d6e97ed..113c17f73b3d083320bcd5e5a1fe4d996a72fce2 100644 (file)
@@ -56,7 +56,7 @@ function execute_sql($command, $feedback=true) {
 
     if ($result) {
         if ($feedback) {
-            echo '<p><font color="green"><strong>'. get_string('success') .'</strong></font></p>';
+            notify(get_string('success'), 'notifysuccess');
         }
         return true;
     } else {
index 81e734df02df24ec7cac04d6efb9216910b5fdb7..7014470c19e3e87c6fdeb6885cb5660e89e18bfa 100644 (file)
@@ -1944,7 +1944,9 @@ function print_continue($link) {
         $link = $_SERVER['HTTP_REFERER'];
     }
 
-    print_heading('<a target="'. $CFG->framename .'" href="'. $link .'">'. get_string('continue').'</a>');
+    echo '<div class="continuebutton">';
+    print_single_button($link, NULL, get_string('continue'), 'post', $CFG->framename);
+    echo '</div>'."\n";
 }
 
 /**
@@ -3234,7 +3236,7 @@ function notice ($message, $link='') {
 
     echo '<br />';
     print_simple_box($message, 'center', '50%', '', '20', 'noticebox');
-    print_heading('<a href="'. $link .'">'. get_string('continue') .'</a>');
+    print_continue($link);
     print_footer(get_site());
     die;
 }
@@ -3248,17 +3250,19 @@ function notice ($message, $link='') {
  */
 function notice_yesno ($message, $linkyes, $linkno) {
 
+    global $CFG;
+
     $message = clean_text($message);
     $linkyes = clean_text($linkyes);
     $linkno = clean_text($linkno);
 
-    print_simple_box_start('center', '60%');
-    echo '<p align="center"><font size="3">'. $message .'</font></p>';
-    echo '<p align="center"><font size="3"><strong>';
-    echo '<a href="'. $linkyes .'">'. get_string('yes') .'</a>';
-    echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
-    echo '<a href="'. $linkno .'">'. get_string('no') .'</a>';
-    echo '</strong></font></p>';
+    print_simple_box_start('center', '60%', '', 5, 'noticebox', 'notice');
+    echo '<p align="center">'. $message .'</p>';
+    echo '<table align="center" cellpadding="20"><tr><td>';
+    print_single_button($linkyes, NULL, get_string('yes'), 'post', $CFG->framename);
+    echo '</td><td>';
+    print_single_button($linkno, NULL, get_string('no'), 'post', $CFG->framename);
+    echo '</td></tr></table>';
     print_simple_box_end();
 }
 
@@ -3305,14 +3309,18 @@ function redirect($url, $message='', $delay='0') {
  * Print a bold message in an optional color.
  *
  * @param string $message The message to print out
- * @param string $color Optional color to display message text in
- * @param string $align Paragraph alignment option
+ * @param string $style Optional style to display message text in
+ * @param string $align Alignment option
  */
-function notify ($message, $color='red', $align='center') {
+function notify ($message, $style='notifyproblem', $align='center') {
+
+    if ($style == 'green') {
+        $style = 'notifysuccess';  // backward compatible with old color system
+    }
 
     $message = clean_text($message);
 
-    echo '<p align="'. $align .'"><strong><font color="'. $color .'">'. $message .'</font></strong></p>' . "\n";
+    echo '<div class="'.$style.'" align="'. $align .'">'. $message .'</div>' . "\n";
 }