Changeset - 4b72fdabad4c
[Not reviewed]
default
0 4 0
Nathan Brink (binki) - 15 years ago 2011-03-27 00:52:56
ohnobinki@ohnopublishing.net
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.
4 files changed with 69 insertions and 16 deletions:
0 comments (0 inline, 0 general)
inc/class.page.php
Show inline comments
 
@@ -218,8 +218,10 @@ class page
 
          '    <!--[if IE]>'. PHP_EOL .
 
          '      <link rel="stylesheet" type="text/css" media="screen" charset="utf-8" href="styles/ie.css" />'. PHP_EOL .
 
          '    <![endif]-->'. PHP_EOL .
 
          '    <link rel="shortcut icon" href="images/favicon.png" />'. PHP_EOL;
 

	
 
          '    <link rel="shortcut icon" href="images/favicon.png" />'. PHP_EOL
 
      . '    <style type="text/css">' . PHP_EOL
 
      . $this->cdata_wrap(school_page_css($this->school))
 
      . '    </style>' . 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 '<script type="' . $type . '">' . PHP_EOL
 
         . ($this->xhtml ? '<![CDATA[' : '') . PHP_EOL
 
         . $js . PHP_EOL
 
	 . ($this->xhtml ? ']]>' : '') . PHP_EOL
 
         . '// </script>';
 
    return ''
 
      . '<script type="' . $type . '">' . PHP_EOL
 
      . $this->cdata_wrap($js)
 
      . '// </script>';
 
  }
 

	
 
  /**
 
   * \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 ? '<![CDATA[' : '') . PHP_EOL
 
      . $content . PHP_EOL
 
      . ($this->xhtml ? ']]>' : '') . PHP_EOL;
 
  }
 

	
 
  /**
inc/school.inc
Show inline comments
 
@@ -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 <head />,
 
 * just create a <school_id>_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
school.d/cedarville.inc
Show inline comments
 
@@ -65,3 +65,22 @@ function cedarville_default_courses()
 

	
 
  return array($chapel);
 
}
 

	
 
/**
 
 * \brief
 
 *   Implement <school_id>_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;
 
}
styles/general.css
Show inline comments
 
@@ -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";
 
}
0 comments (0 inline, 0 general)