From: urs_hunkler <urs_hunkler>
Date: Wed, 9 May 2007 15:03:01 +0000 (+0000)
Subject: added/changed custom corners lib and calls to add the necessary divs
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=f145c2482d9ddc73f89eecc47fa47f7f9c8a7168;p=moodle.git

added/changed custom corners lib and calls to add the necessary divs
---

diff --git a/course/format/social/format.php b/course/format/social/format.php
index 4a3566b3a6..1662888d43 100644
--- a/course/format/social/format.php
+++ b/course/format/social/format.php
@@ -2,6 +2,10 @@
       // format.php - course format featuring social forum
       //              included from view.php
 
+    if (!empty($THEME->customcorners)) {
+        require_once($CFG->dirroot.'/lib/custom_corners_lib.php');
+    }
+    
     // Bounds for block widths
     // more flexible for theme designers taken from theme config.php
     $lmin = (empty($THEME->block_l_min_width)) ? 100 : $THEME->block_l_min_width;
@@ -28,11 +32,15 @@
 
     if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) {
         echo '<td style="width:'.$preferred_width_left.'px" id="left-column">';
+        if (!empty($THEME->customcorners)) print_custom_corners_start();
         blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
+        if (!empty($THEME->customcorners)) print_custom_corners_end();
         echo '</td>';
     }
 
-    echo '<td id="middle-column"><a name="startofcontent"></a>';
+    echo '<td id="middle-column">';
+    if (!empty($THEME->customcorners)) print_custom_corners_start();
+    echo '<a name="startofcontent"></a>';
     if ($forum = forum_get_course_forum($course->id, 'social')) {
         print_heading_block(get_string('socialheadline'));
         if (forum_is_forcesubscribed($forum->id)) {
@@ -48,12 +56,15 @@
     } else {
         notify('Could not find or create a social forum here');
     }
+    if (!empty($THEME->customcorners)) print_custom_corners_end();
     echo '</td>';
 
     // The right column
     if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) {
         echo '<td style="width:'.$preferred_width_right.'px" id="right-column">';
+        if (!empty($THEME->customcorners)) print_custom_corners_start();
         blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
+        if (!empty($THEME->customcorners)) print_custom_corners_end();
         echo '</td>';
     }
 
diff --git a/course/format/topics/format.php b/course/format/topics/format.php
index 5076827596..514f91a78a 100644
--- a/course/format/topics/format.php
+++ b/course/format/topics/format.php
@@ -8,6 +8,10 @@
       
 
     require_once($CFG->libdir.'/ajax/ajaxlib.php');
+    
+    if (!empty($THEME->customcorners)) {
+        require_once($CFG->dirroot.'/lib/custom_corners_lib.php');
+    }
   
     $topic = optional_param('topic', -1, PARAM_INT);
 
@@ -78,15 +82,9 @@
 
     if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) {
         echo '<td style="width:'.$preferred_width_left.'px" id="left-column">';
-        if (!empty($THEME->roundcorners)) {
-            echo '<div class="bt"><div></div></div>';
-            echo '<div class="i1"><div class="i2"><div class="i3">';
-        }
+        if (!empty($THEME->customcorners)) print_custom_corners_start();
         blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
-        if (!empty($THEME->roundcorners)) {
-            echo '</div></div></div>';
-            echo '<div class="bb"><div></div></div>';
-        }
+        if (!empty($THEME->customcorners)) print_custom_corners_end();
         echo '</td>';
     }
 
@@ -94,10 +92,7 @@
             case 'middle':
 /// Start main column
     echo '<td id="middle-column">';
-    if (!empty($THEME->roundcorners)) {
-        echo '<div class="bt"><div></div></div>';
-        echo '<div class="i1"><div class="i2"><div class="i3">';
-    }
+    if (!empty($THEME->customcorners)) print_custom_corners_start();
     echo '<a name="startofcontent"></a>';
 
     print_heading_block(get_string('topicoutline'), 'outline');
@@ -279,10 +274,7 @@
         echo '</div>';
     }
 
-    if (!empty($THEME->roundcorners)) {
-        echo '</div></div></div>';
-        echo '<div class="bb"><div></div></div>';
-    }
+    if (!empty($THEME->customcorners)) print_custom_corners_end();
     echo '</td>';
 
             break;
@@ -290,15 +282,9 @@
     // The right column
     if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) {
         echo '<td style="width:'.$preferred_width_right.'px" id="right-column">';
-        if (!empty($THEME->roundcorners)) {
-            echo '<div class="bt"><div></div></div>';
-            echo '<div class="i1"><div class="i2"><div class="i3">';
-        }
+        if (!empty($THEME->customcorners)) print_custom_corners_start();
         blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
-        if (!empty($THEME->roundcorners)) {
-            echo '</div></div></div>';
-            echo '<div class="bb"><div></div></div>';
-        }
+        if (!empty($THEME->customcorners)) print_custom_corners_end();
         echo '</td>';
     }
 
diff --git a/course/format/weeks/format.php b/course/format/weeks/format.php
index 7d7480db71..d551508198 100644
--- a/course/format/weeks/format.php
+++ b/course/format/weeks/format.php
@@ -3,6 +3,10 @@
       // Included from "view.php"
 
     require_once($CFG->libdir.'/ajax/ajaxlib.php');
+    
+    if (!empty($THEME->customcorners)) {
+        require_once($CFG->dirroot.'/lib/custom_corners_lib.php');
+    }
 
     $week = optional_param('week', -1, PARAM_INT);
 
@@ -63,17 +67,9 @@
     if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) {
         echo '<td style="width:'.$preferred_width_left.'px" id="left-column">';
 
-        if (!empty($THEME->roundcorners)) {
-            echo '<div class="bt"><div></div></div>';
-            echo '<div class="i1"><div class="i2"><div class="i3">';
-        }
-        
+        if (!empty($THEME->customcorners)) print_custom_corners_start();
         blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
-
-        if (!empty($THEME->roundcorners)) {
-            echo '</div></div></div>';
-            echo '<div class="bb"><div></div></div>';
-        }
+        if (!empty($THEME->customcorners)) print_custom_corners_end();
 
         echo '</td>';
     }
@@ -82,10 +78,7 @@
 /// Start main column
     echo '<td id="middle-column">';
 
-    if (!empty($THEME->roundcorners)) {
-       echo '<div class="bt"><div></div></div>';
-       echo '<div class="i1"><div class="i2"><div class="i3">';
-    }
+    if (!empty($THEME->customcorners)) print_custom_corners_start();
         
     echo '<a name="startofcontent"></a>';
 
@@ -281,10 +274,7 @@
         echo '</div>';
     }
 
-    if (!empty($THEME->roundcorners)) {
-        echo '</div></div></div>';
-        echo '<div class="bb"><div></div></div>';
-    }
+    if (!empty($THEME->customcorners)) print_custom_corners_end();
 
     echo '</td>';
 
@@ -294,17 +284,9 @@
     if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) {
         echo '<td style="width: '.$preferred_width_right.'px;" id="right-column">';
 
-        if (!empty($THEME->roundcorners)) {
-            echo '<div class="bt"><div></div></div>';
-            echo '<div class="i1"><div class="i2"><div class="i3">';
-        }
-
+        if (!empty($THEME->customcorners)) print_custom_corners_start();
         blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
-
-        if (!empty($THEME->roundcorners)) {
-            echo '</div></div></div>';
-            echo '<div class="bb"><div></div></div>';
-        }
+        if (!empty($THEME->customcorners)) print_custom_corners_end();
 
         echo '</td>';
     }
diff --git a/lib/adminlib.php b/lib/adminlib.php
index 5cef9f04e1..4392c8d785 100644
--- a/lib/adminlib.php
+++ b/lib/adminlib.php
@@ -2685,6 +2685,10 @@ function admin_externalpage_setup($section) {
 function admin_externalpage_print_header() {
 
     global $CFG, $PAGE, $SITE, $THEME;
+    
+    if (!empty($THEME->customcorners)) {
+        require_once($CFG->dirroot.'/lib/custom_corners_lib.php');
+    }
 
     define('ADMIN_EXT_HEADER_PRINTED', 'true');
 
@@ -2697,21 +2701,12 @@ function admin_externalpage_print_header() {
         $PAGE->print_header();
         echo '<table id="layout-table" summary=""><tr>';
         echo '<td style="width: ' . $preferred_width_left . 'px;" id="left-column">';
-        if (!empty($THEME->roundcorners)) {
-            echo '<div class="bt"><div></div></div>';
-            echo '<div class="i1"><div class="i2"><div class="i3">';
-        }
+        if (!empty($THEME->customcorners)) print_custom_corners_start();
         blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
-        if (!empty($THEME->roundcorners)) {
-            echo '</div></div></div>';
-            echo '<div class="bb"><div></div></div>';
-        }
+        if (!empty($THEME->customcorners)) print_custom_corners_end();
         echo '</td>';
         echo '<td id="middle-column">';
-        if (!empty($THEME->roundcorners)) {
-            echo '<div class="bt"><div></div></div>';
-            echo '<div class="i1"><div class="i2"><div class="i3">';
-        }
+        if (!empty($THEME->customcorners)) print_custom_corners_start();
     } else {
         print_header();
     }
@@ -2720,7 +2715,11 @@ function admin_externalpage_print_header() {
 function admin_externalpage_print_footer() {
 
     global $CFG, $PAGE, $SITE, $THEME;
-
+    
+    if (!empty($THEME->customcorners)) {
+        require_once($CFG->dirroot.'/lib/custom_corners_lib.php');
+    }
+    
     define('ADMIN_EXT_FOOTER_PRINTED', 'true');
 
     if (!empty($SITE->fullname)) {
@@ -2728,22 +2727,13 @@ function admin_externalpage_print_footer() {
         $preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH,
                                                 blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]),
                                                 BLOCK_R_MAX_WIDTH);
-        if (!empty($THEME->roundcorners)) {
-            echo '</div></div></div>';
-            echo '<div class="bb"><div></div></div>';
-        }
+        if (!empty($THEME->customcorners)) print_custom_corners_end();
         echo '</td>';
         if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT)) {
             echo '<td style="width: ' . $preferred_width_right . 'px;" id="right-column">';
-            if (!empty($THEME->roundcorners)) {
-                echo '<div class="bt"><div></div></div>';
-                echo '<div class="i1"><div class="i2"><div class="i3">';
-            }
+            if (!empty($THEME->customcorners)) print_custom_corners_start();
             blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
-            if (!empty($THEME->roundcorners)) {
-                echo '</div></div></div>';
-                echo '<div class="bb"><div></div></div>';
-            }
+            if (!empty($THEME->customcorners)) print_custom_corners_end();
             echo '</td>';
         }
         echo '</tr></table>';
diff --git a/lib/weblib.php b/lib/weblib.php
index 6cb9edfd9c..ae44db4391 100644
--- a/lib/weblib.php
+++ b/lib/weblib.php
@@ -5667,7 +5667,11 @@ function print_side_block($heading='', $content='', $list=NULL, $icons=NULL, $fo
 function print_side_block_start($heading='', $attributes = array()) {
 
     global $CFG, $THEME;
-
+    
+    if (!empty($THEME->customcorners)) {
+        require_once($CFG->dirroot.'/lib/custom_corners_lib.php');
+    }
+    
     // If there are no special attributes, give a default CSS class
     if (empty($attributes) || !is_array($attributes)) {
         $attributes = array('class' => 'sideblock');
@@ -5703,22 +5707,19 @@ function print_side_block_start($heading='', $attributes = array()) {
         //Accessibility: replaced <div> with H2; no, H2 more appropriate in moodleblock.class.php: _title_html.
         // echo '<div class="header">'.$heading.'</div>';
         echo '<div class="header">';
-        if (!empty($THEME->roundcorners)) {
-            echo '<div class="bt"><div></div></div>';
-            echo '<div class="i1"><div class="i2"><div class="i3">';
-        }
+        if (!empty($THEME->customcorners)) print_custom_corners_start();
         echo $heading;
-        if (!empty($THEME->roundcorners)) {
+        if (!empty($THEME->customcorners)) {
             echo '</div></div></div>';
         }
         echo '</div>';
     } else {
-        if (!empty($THEME->roundcorners)) {
+        if (!empty($THEME->customcorners)) {
             echo '<div class="bt"><div></div></div>';
         }
     }
 
-    if (!empty($THEME->roundcorners)) {
+    if (!empty($THEME->customcorners)) {
         echo '<div class="i1"><div class="i2"><div class="i3">';
     }
     echo '<div class="content">';
@@ -5731,12 +5732,12 @@ function print_side_block_start($heading='', $attributes = array()) {
  */
 function print_side_block_end($attributes = array()) {
     global $CFG, $THEME;
-
+    
     echo '</div>';
 
-    if (!empty($THEME->roundcorners)) {
-        echo '</div></div></div>';
-        echo '<div class="bb"><div></div></div>';
+    if (!empty($THEME->customcorners)) {
+        require_once($CFG->dirroot.'/lib/custom_corners_lib.php');
+        print_custom_corners_end();
     }
 
     echo '</div>';
@@ -6148,5 +6149,6 @@ function print_location_comment($file, $line, $return = false)
         echo "<!-- $file at line $line -->\n";
     }
 }
+
 // vim:autoindent:expandtab:shiftwidth=4:tabstop=4:tw=140:
 ?>
\ No newline at end of file
diff --git a/mod/chat/view.php b/mod/chat/view.php
index 412e9342cb..8d1f0deae9 100644
--- a/mod/chat/view.php
+++ b/mod/chat/view.php
@@ -6,6 +6,10 @@
     require_once('lib.php');
     require_once($CFG->libdir.'/blocklib.php');
     require_once('pagelib.php');
+    
+    if (!empty($THEME->customcorners)) {
+        require_once($CFG->dirroot.'/lib/custom_corners_lib.php');
+    }
 
     $id   = optional_param('id', 0, PARAM_INT);
     $c    = optional_param('c', 0, PARAM_INT);
@@ -70,11 +74,14 @@
 
     if(!empty($CFG->showblocksonmodpages) && (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing())) {
         echo '<td style="width: '.$blocks_preferred_width.'px;" id="left-column">';
+        if (!empty($THEME->customcorners)) print_custom_corners_start();
         blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
+        if (!empty($THEME->customcorners)) print_custom_corners_end();
         echo '</td>';
     }
 
     echo '<td id="middle-column">';
+    if (!empty($THEME->customcorners)) print_custom_corners_start();
     
     if ($chat->studentlogs or has_capability('mod/chat:readlog',$context)) {
         echo '<div class="reportlink">';
@@ -175,6 +182,7 @@
 
 
 /// Finish the page
+    if (!empty($THEME->customcorners)) print_custom_corners_end();
     echo '</td></tr></table>';
 
     print_footer($course);
diff --git a/mod/data/view.php b/mod/data/view.php
index bae0ca5ba3..03d134952e 100755
--- a/mod/data/view.php
+++ b/mod/data/view.php
@@ -29,6 +29,10 @@
 
     require_once('pagelib.php');
     
+    if (!empty($THEME->customcorners)) {
+        require_once($CFG->dirroot.'/lib/custom_corners_lib.php');
+    }
+    
     
 /// One of these is necessary!
     $id    = optional_param('id', 0, PARAM_INT);  // course module id
@@ -245,10 +249,13 @@
         echo '<table id="layout-table"><tr>';
         if ((blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing())) {
             echo '<td style="width: '.$blocks_preferred_width.'px;" id="left-column">';
+            if (!empty($THEME->customcorners)) print_custom_corners_start();
             blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
+            if (!empty($THEME->customcorners)) print_custom_corners_end();
             echo '</td>';
         }
         echo '<td id="middle-column">';
+        if (!empty($THEME->customcorners)) print_custom_corners_start();
     }
 
     print_heading(format_string($data->name));
@@ -555,10 +562,13 @@
 
 /// If we have blocks, then print the left side here
     if (!empty($CFG->showblocksonmodpages)) {
+        if (!empty($THEME->customcorners)) print_custom_corners_end();
         echo '</td>';   // Middle column
         if ((blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing())) {
             echo '<td style="width: '.$blocks_preferred_width.'px;" id="right-column">';
+            if (!empty($THEME->customcorners)) print_custom_corners_start();
             blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
+            if (!empty($THEME->customcorners)) print_custom_corners_end();
             echo '</td>';
         }
         echo '</tr></table>';
diff --git a/mod/quiz/view.php b/mod/quiz/view.php
index 0405da83ea..a59f9f2531 100644
--- a/mod/quiz/view.php
+++ b/mod/quiz/view.php
@@ -6,6 +6,10 @@
     require_once("locallib.php");
     require_once($CFG->libdir.'/blocklib.php');
     require_once('pagelib.php');
+    
+    if (!empty($THEME->customcorners)) {
+        require_once($CFG->dirroot.'/lib/custom_corners_lib.php');
+    }
 
     $id   = optional_param('id', 0, PARAM_INT); // Course Module ID, or
     $q    = optional_param('q',  0, PARAM_INT);  // quiz ID
@@ -39,7 +43,7 @@
 
     // if no questions have been set up yet redirect to edit.php
     if (!$quiz->questions and has_capability('mod/quiz:manage', $context)) {
-        redirect('edit.php?quizid='.$quiz->id);
+        redirect('edit.php?cmid='.$cm->id);
     }
 
     add_to_log($course->id, "quiz", "view", "view.php?id=$cm->id", $quiz->id, $cm->id);
@@ -63,11 +67,14 @@
 
     if(!empty($CFG->showblocksonmodpages) && (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing())) {
         echo '<td style="width: '.$blocks_preferred_width.'px;" id="left-column">';
+        if (!empty($THEME->customcorners)) print_custom_corners_start();
         blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
+        if (!empty($THEME->customcorners)) print_custom_corners_end();
         echo '</td>';
     }
 
     echo '<td id="middle-column">';
+    if (!empty($THEME->customcorners)) print_custom_corners_start();
 
     // Print the main part of the page
 
@@ -404,6 +411,7 @@ document.write('<input type="button" value="<?php echo $buttontext ?>" onclick="
     // Should we not be seeing if we need to print right-hand-side blocks?
 
     // Finish the page.
+    if (!empty($THEME->customcorners)) print_custom_corners_end();
     echo '</td></tr></table>';
     print_footer($course);
 
diff --git a/mod/resource/lib.php b/mod/resource/lib.php
index a1437a0db5..c0bcfab7c2 100644
--- a/mod/resource/lib.php
+++ b/mod/resource/lib.php
@@ -66,6 +66,10 @@ foreach ($RESOURCE_WINDOW_OPTIONS as $popupoption) {
     }
 }
 
+if (!empty($THEME->customcorners)) {
+    require_once($CFG->dirroot.'/lib/custom_corners_lib.php');
+}
+
 /**
 * resource_base is the base class for resource types
 *
@@ -168,11 +172,14 @@ function display_course_blocks_start() {
 
     if((blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing())) {
         echo '<td style="width: '.$blocks_preferred_width.'px;" id="left-column">';
+        if (!empty($THEME->customcorners)) print_custom_corners_start();
         blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
+        if (!empty($THEME->customcorners)) print_custom_corners_end();
         echo '</td>';
     }
 
     echo '<td id="middle-column">';
+    if (!empty($THEME->customcorners)) print_custom_corners_start();
     echo '<div id="resource">';
 
 }
@@ -190,11 +197,14 @@ function display_course_blocks_end() {
     $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
 
     echo '</div>';
+    if (!empty($THEME->customcorners)) print_custom_corners_end();
     echo '</td>';
 
     if((blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing())) {
         echo '<td style="width: '.$blocks_preferred_width.'px;" id="right-column">';
+        if (!empty($THEME->customcorners)) print_custom_corners_start();
         blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
+        if (!empty($THEME->customcorners)) print_custom_corners_end();
         echo '</td>';
     }