Skip to content
Snippets Groups Projects
Commit 312b2dcd authored by Tim Steiner's avatar Tim Steiner
Browse files

[gh-145] Pulling merged code from staging

git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x/staging@743 20a16fea-79d4-4915-8869-1ea9d5ebf173
parent 403418f7
Branches
Tags
No related merge requests found
......@@ -54,17 +54,6 @@ $t->doctitle = '<title>'.$head_title.'</title>';
$html = $t->toHtml();
if (theme_get_setting('wdn_beta')) {
$html = str_replace(
array('/wdn/templates',
'css/all.css',
'scripts/all.js'),
array('/wdntemplates-dev/wdn/templates',
'css/debug.css',
'scripts/debug.js'),
$html);
}
if (module_exists('rdf')) {
$html = str_replace(
array('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">',
......
<?php
/**
* Object oriented interface to create UNL Template based HTML pages.
*
*
* PHP version 5
*
*
* @category Templates
* @package UNL_Templates
* @author Brett Bieber <brett.bieber@gmail.com>
......@@ -19,13 +19,13 @@
require_once 'UNL/DWT.php';
/**
* Allows you to create UNL Template based HTML pages through an object
* Allows you to create UNL Template based HTML pages through an object
* oriented interface.
*
*
* Install on your PHP server with:
* pear channel-discover pear.unl.edu
* pear install unl/UNL_Templates
*
*
* <code>
* <?php
* require_once 'UNL/Templates.php';
......@@ -35,7 +35,7 @@ require_once 'UNL/DWT.php';
* $page->loadSharedcodeFiles();
* echo $page;
* </code>
*
*
* @category Templates
* @package UNL_Templates
* @author Brett Bieber <brett.bieber@gmail.com>
......@@ -48,14 +48,14 @@ class UNL_Templates extends UNL_DWT
{
const VERSION2 = 2;
const VERSION3 = 3;
/**
* Cache object for output caching
*
*
* @var UNL_Templates_CachingService
*/
static protected $cache;
static public $options = array(
'debug' => 0,
'sharedcodepath' => 'sharedcode',
......@@ -63,14 +63,14 @@ class UNL_Templates extends UNL_DWT
'cache' => array(),
'version' => self::VERSION3
);
/**
* The version of the templates we're using.
*
*
* @var UNL_Templates_Version
*/
static public $template_version;
/**
* Construct a UNL_Templates object
*/
......@@ -79,10 +79,10 @@ class UNL_Templates extends UNL_DWT
date_default_timezone_set(date_default_timezone_get());
self::$options['templatedependentspath'] = $_SERVER['DOCUMENT_ROOT'];
}
/**
* Initialize the configuration for the UNL_DWT class
*
*
* @return void
*/
public static function loadDefaultConfig()
......@@ -92,7 +92,7 @@ class UNL_Templates extends UNL_DWT
self::$template_version = new $class();
UNL_DWT::$options = array_merge(UNL_DWT::$options, self::$template_version->getConfig());
}
/**
* The factory returns a template object for any UNL Template style requested:
* * Fixed
......@@ -101,14 +101,14 @@ class UNL_Templates extends UNL_DWT
* * Document
* * Secure
* * Unlaffiliate
*
*
* <code>
* $page = UNL_Templates::factory('Fixed');
* </code>
*
* @param string $type Type of template to get, Fixed, Liquid, Doc, Popup
* @param mixed $coptions Options for the constructor
*
*
* @return UNL_Templates
*/
static function &factory($type, $coptions = false)
......@@ -116,17 +116,17 @@ class UNL_Templates extends UNL_DWT
UNL_Templates::loadDefaultConfig();
return parent::factory($type, $coptions);
}
/**
* Attempts to connect to the template server and grabs the latest cache of the
* template (.tpl) file. Set options for Cache_Lite in self::$options['cache']
*
*
* @return string
*/
function getCache()
{
$cache = self::getCachingService();
$cache_key = self::$options['version'].self::$options['templatedependentspath'].$this->__template;
$cache_key = self::$options['version'].$this->__template;
// Test if there is a valid cache for this template
if ($data = $cache->get($cache_key)) {
// Content is in $data
......@@ -147,14 +147,14 @@ class UNL_Templates extends UNL_DWT
}
return $data;
}
/**
* Loads standard customized content (sharedcode) files from the filesystem.
*
*
* @return void
*/
function loadSharedcodeFiles()
{
{
$includes = array(
'footercontent' => 'footer.html',
'contactinfo' => 'footerContactInfo.html',
......@@ -173,12 +173,12 @@ class UNL_Templates extends UNL_DWT
/**
* Add a link within the head of the page.
*
*
* @param string $href URI to the resource
* @param string $relation Relation of this link element (alternate)
* @param string $relType The type of relation (rel)
* @param array $attributes Any additional attribute=>value combinations
*
*
* @return void
*/
function addHeadLink($href, $relation, $relType = 'rel', array $attributes = array())
......@@ -186,10 +186,10 @@ class UNL_Templates extends UNL_DWT
$attributeString = '';
foreach ($attributes as $name=>$value) {
$attributeString .= $name.'="'.$value.'" ';
}
}
$this->head .= '<link '.$relType.'="'.$relation.'" href="'.$href.'" '.$attributeString.' />'.PHP_EOL;
}
/**
......@@ -197,7 +197,7 @@ class UNL_Templates extends UNL_DWT
*
* @param string $url URL to the script
* @param string $type Type of script text/javascript
*
*
* @return void
*/
function addScript($url, $type = 'text/javascript')
......@@ -210,7 +210,7 @@ class UNL_Templates extends UNL_DWT
*
* @param string $content The javascript you wish to add.
* @param string $type Type of script tag.
*
*
* @return void
*/
function addScriptDeclaration($content, $type = 'text/javascript')
......@@ -226,20 +226,20 @@ class UNL_Templates extends UNL_DWT
*
* @param string $content CSS content to add
* @param string $type type attribute for the style element
*
*
* @return void
*/
function addStyleDeclaration($content, $type = 'text/css')
{
$this->head .= '<style type="'.$type.'">'.$content.'</style>'.PHP_EOL;
}
/**
* Add a link to a stylesheet.
*
* @param string $url Address of the stylesheet, absolute or relative
* @param string $media Media target (screen/print/projector etc)
*
*
* @return void
*/
function addStyleSheet($url, $media = 'all')
......@@ -249,7 +249,7 @@ class UNL_Templates extends UNL_DWT
/**
* Returns the page in HTML form.
*
*
* @return string THe full HTML of the page.
*/
function toHtml()
......@@ -258,7 +258,7 @@ class UNL_Templates extends UNL_DWT
$regions = get_object_vars($this);
return $this->replaceRegions($p, $regions);
}
/**
* returns this template as a string.
*
......@@ -268,33 +268,33 @@ class UNL_Templates extends UNL_DWT
{
return $this->toHtml();
}
/**
* Populates templatedependents files
*
* Replaces the template dependent include statements with the corresponding
*
* Replaces the template dependent include statements with the corresponding
* files from the /ucomm/templatedependents/ directory. To specify the location
* of your templatedependents directory, use something like
* $page->options['templatedependentspath'] = '/var/www/';
* and set the path to the directory containing /ucomm/templatedependents/
*
* @param string $p Page to make replacements in
*
*
* @return string
*/
function makeIncludeReplacements($p)
{
return self::$template_version->makeIncludeReplacements($p);
}
/**
* Debug handler for messages.
*
* @param string $message Message to send to debug output
* @param int $logtype Which log to send this to
* @param int $level The threshold to send this message or not.
*
*
* @return void
*/
static function debug($message, $logtype = 0, $level = 1)
......@@ -302,7 +302,7 @@ class UNL_Templates extends UNL_DWT
UNL_DWT::$options['debug'] = self::$options['debug'];
parent::debug($message, $logtype, $level);
}
/**
* Cleans the cache.
*
......@@ -314,12 +314,12 @@ class UNL_Templates extends UNL_DWT
{
return self::getCachingService()->clean($object);
}
static public function setCachingService(UNL_Templates_CachingService $cache)
{
self::$cache = $cache;
}
static public function getCachingService()
{
if (!isset(self::$cache)) {
......@@ -352,7 +352,7 @@ class UNL_Templates extends UNL_DWT
// pear/pyrus installation
return '/Users/bbieber/Documents/workspace/wdn_thm_drupal/sites/all/themes/unl_wdn/lib/data/UNL_Templates/data/';
}
if (file_exists(dirname(__FILE__).'/../data/tpl_cache')) {
// svn checkout
return realpath(dirname(__FILE__).'/../data');
......
sites/all/themes/unl_wdn/screenshot.png

57.6 KiB | W: | H:

sites/all/themes/unl_wdn/screenshot.png

25.5 KiB | W: | H:

sites/all/themes/unl_wdn/screenshot.png
sites/all/themes/unl_wdn/screenshot.png
sites/all/themes/unl_wdn/screenshot.png
sites/all/themes/unl_wdn/screenshot.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -12,6 +12,12 @@ body.fixed #maincontent {
top: -60px;
}
/* Remove border found in system.theme.css
http://drupal.org/node/93357 */
tbody {
border-top: none;
}
/* Hide the contextual links in the UNL nav */
#navigation div.contextual-links-wrapper {
display: none;
......
<?php
/**
* Implements hook_css_alter().
*/
function unl_wdn_css_alter(&$css) {
// Turn off some styles from the system module.
// If some of this is later found desireable, add "stylesheets[all][] = css/unl_wdn.menus.css" to unl_wdn.info and copy these files to that locaiton with edits.
$path = drupal_get_path('module','system');
unset($css[$path.'/system.menus.css']);
unset($css[$path.'/system.theme.css']);
}
function unl_wdn_preprocess_html(&$vars, $hook) {
/**
* Change the <title> tag to UNL format: UNL | Department | Section | Page
......@@ -60,21 +49,16 @@ function unl_wdn_preprocess_page(&$vars, $hook) {
function unl_wdn_get_instance() {
static $instance;
if (!$instance) {
set_include_path(dirname(__FILE__) . '/lib/php');
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/lib/php');
require_once "UNL/Templates.php";
UNL_Templates::$options['version'] = UNL_Templates::VERSION3;
if (theme_get_setting('toggle_main_menu')) {
$instance = UNL_Templates::factory('Fixed');
}
else {
$instance = UNL_Templates::factory('Document');
}
if (theme_get_setting('wdn_beta')) {
UNL_Templates::$options['templatedependentspath'] = $_SERVER['DOCUMENT_ROOT'].'/wdntemplates-dev';
}
}
return $instance;
......
<?php
/**
* Implements hook_form_system_theme_settings_alter().
* Done as THEMENAME_form_system_theme_settings_alter(), reference http://drupal.org/node/177868
*/
function unl_wdn_form_system_theme_settings_alter(&$form, &$form_state) {
function unl_wdn_form_system_theme_settings_alter(&$form, &$form_state)
{
$form[] = array(
'#type' => 'fieldset',
'#title' => t('Site Name Abbreviation'),
'site_name_abbreviation' => array(
'#type' => 'textfield',
'#default_value' => theme_get_setting('site_name_abbreviation'),
'#description' => t('An abbreviated version of your site\'s name to use in breadcrumbs.'),
),
'#description' => t('An abbreviated version of your site\'s name to use in breadcrumbs.')
)
);
$form['intermediate_breadcrumbs'] = array(
'#type' => 'fieldset',
'#title' => t('Intermediate Breadcrumbs'),
'#description' => t('Breadcrumbs that are displayed between the UNL breadcrumb and this site\'s breadcrumb'),
);
$intermediate_breadcrumbs = theme_get_setting('intermediate_breadcrumbs');
for ($i = 0; $i < 3; $i++) {
$form['intermediate_breadcrumbs'][] = array(
'text' => array(
'text' => array(
'#type' => 'textfield',
'#title' => t('Text ' . ($i + 1)),
'#default_value' => isset($intermediate_breadcrumbs[$i]) ? $intermediate_breadcrumbs[$i]['text'] : '',
'#parents' => array('intermediate_breadcrumbs' , $i, 'text'),
),
'href' => array(
'href' => array(
'#type' => 'textfield',
'#title' => t('URL ' . ($i + 1)),
'#default_value' => isset($intermediate_breadcrumbs[$i]) ? $intermediate_breadcrumbs[$i]['href'] : '',
......@@ -37,50 +36,34 @@ function unl_wdn_form_system_theme_settings_alter(&$form, &$form_state) {
),
);
}
$form[] = array(
'#type' => 'fieldset',
'#title' => t('Head HTML'),
'#description' => t('Additional HTML (your own css, js) to be added inside the &lt;head&gt;&lt;/head&gt; tags.'),
'head_html' => array(
'#type' => 'textarea',
'#default_value' => theme_get_setting('head_html'),
),
'#default_value' => theme_get_setting('head_html')
)
);
$form['advanced_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced Settings'),
'zen_forms' => array(
'#type' => 'checkbox',
'#title' => t('Use Zen Forms'),
'#default_value' => theme_get_setting('zen_forms'),
'#description' => t('Transforms all forms into the list-based zen forms.'),
'#description' => t('Transforms all forms into the list-based zen forms.')
),
'use_base' => array(
'#type' => 'checkbox',
'#title' => t('Use HTML Base Tag in Head'),
'#default_value' => theme_get_setting('use_base'),
'#description' => t('Adds an HTML Base tag to the &lt;head&gt; section with href="' . url('<front>', array('absolute' => TRUE)) . '"'),
),
'wdn_beta' => array(
'#type' => 'checkbox',
'#title' => t('Use WDN Beta/Development CSS and JavaScript'),
'#default_value' => theme_get_setting('wdn_beta'),
'#description' => t('Replaces the links in &lt;head&gt; to the stable /wdn directory with the latest development versions.'),
'#access' => _unl_wdn_use_wdn_beta(),
),
'#type' => 'checkbox',
'#title' => t('Use HTML Base Tag in Head'),
'#default_value' => theme_get_setting('use_base'),
'#description' => t('Adds an HTML Base tag to the &lt;head&gt; section with href="' . url('<front>', array('absolute' => TRUE)) . '"')
)
);
}
/**
* Custom access function to determine if it is staging or live since the live site should not allow WDN dev code to be used.
* @TODO: Make this better using something other than site_name.
*/
function _unl_wdn_use_wdn_beta() {
$site_name = variable_get('site_name');
if (strpos($site_name, 'STAGING') === 0) {
return TRUE;
}
return FALSE;
}
......@@ -32,4 +32,3 @@ plugins[panels][layouts] = layouts
settings[toggle_favicon] = 0
settings[zen_forms] = 0
settings[use_base] = 1
settings[wdn_beta] = 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment