# HG changeset patch
# User Nathan Phillip Brink 
# Date 2011-03-27 00:52:56
# Node ID 4b72fdabad4c38d5badaa6fa70f057ac4a9d38c6
# Parent  6583b052978214d1b5472fe68c4799ab07c06900
Let schools set their own CSS. Move cedarville's lab CSS into its custom CSS callback so that it doesn't mess up other schools such as calvin.
diff --git a/inc/class.page.php b/inc/class.page.php
--- a/inc/class.page.php
+++ b/inc/class.page.php
@@ -218,8 +218,10 @@ class page
           '    '. PHP_EOL .
-          '    '. PHP_EOL;
-
+          '    '. PHP_EOL
+      . '    ' . PHP_EOL;
     // Write out all passed scripts
     foreach ($this->scripts as $i)
       echo '    ' . $this->headCode["$i"] . "\n";
@@ -535,11 +537,29 @@ class page
    */
   public function script_wrap($js, $type = 'text/javascript')
   {
-    return '';
+    return ''
+      . '';
+  }
+
+  /**
+   * \brief
+   *   Wrap something in CDATA or not wrap depending on if we're
+   *   serving HTML.
+   *
+   * Lower-level than Page::script_wrap().
+   * \param $content
+   *   The stuff to wrap in CDATA.
+   * \return
+   *   The wrapped string.
+   */
+  public function cdata_wrap($content)
+  {
+    return ''
+      . ($this->xhtml ? 'xhtml ? ']]>' : '') . PHP_EOL;
   }
 
   /**
diff --git a/inc/school.inc b/inc/school.inc
--- a/inc/school.inc
+++ b/inc/school.inc
@@ -282,6 +282,29 @@ function school_instructions_html($schoo
 
 /**
  * \brief
+ *   Get CSS specific to a school.
+ *
+ * For a school to get custom CSS into slate_permutate's ,
+ * just create a _page_css($school) function which returns
+ * a string of CSS.
+ *
+ * \param $school
+ *   The school from which to fetch CSS.
+ * \return
+ *   A string of valid CSS.
+ */
+function school_page_css(array $school)
+{
+  if (empty($school))
+    return '';
+  $school_page_css = $school['id'] . '_page_css';
+  if (!function_exists($school_page_css))
+    return '';
+  return $school_page_css($school);
+}
+
+/**
+ * \brief
  *   Return information about available semesters.
  *
  * \param $school
diff --git a/school.d/cedarville.inc b/school.d/cedarville.inc
--- a/school.d/cedarville.inc
+++ b/school.d/cedarville.inc
@@ -65,3 +65,22 @@ function cedarville_default_courses()
 
   return array($chapel);
 }
+
+/**
+ * \brief
+ *   Implement _page_css().
+ */
+function cedarville_page_css($school)
+{
+  return <<<'CSS'
+#container .lab .sectionIdentifier {
+  background: none!important;
+}
+#container .lab .sectionIdentifier input {
+  display: none;
+}
+#container .lab .deleteSection input {
+  display: none;
+}
+CSS;
+}
diff --git a/styles/general.css b/styles/general.css
--- a/styles/general.css
+++ b/styles/general.css
@@ -137,15 +137,6 @@ a:hover {
 #container .emptyCell, .removeCell {
   background: none!important; 
 }
-#container .lab .sectionIdentifier {
-  background: none!important;
-}
-#container .lab .sectionIdentifier input {
-  display: none;
-}
-#container .lab .deleteSection input {
-  display: none;
-}
 #container .lab .deleteSection:before {
   content: "LAB";
 }