First revision.
authorDan
Fri, 17 Apr 2009 00:02:18 -0400
changeset 0 e8db3e017691
child 1 b69d36dc637e
First revision.
plugins/EnaniumBackgrounds.php
plugins/enaniumbg/aqua.jpg
plugins/enaniumbg/blinds.jpg
plugins/enaniumbg/dune.jpg
plugins/enaniumbg/enaniumbg.css
plugins/enaniumbg/enaniumbg.js
plugins/enaniumbg/freshflower.jpg
plugins/enaniumbg/garden.jpg
plugins/enaniumbg/greenmeadow.jpg
plugins/enaniumbg/icons/aqua.png
plugins/enaniumbg/icons/blinds.png
plugins/enaniumbg/icons/default.png
plugins/enaniumbg/icons/dune.png
plugins/enaniumbg/icons/freshflower.png
plugins/enaniumbg/icons/garden.png
plugins/enaniumbg/icons/greenmeadow.png
plugins/enaniumbg/icons/ladybird.png
plugins/enaniumbg/icons/raindrops.png
plugins/enaniumbg/icons/sprite.png
plugins/enaniumbg/icons/storm.png
plugins/enaniumbg/icons/twowings.png
plugins/enaniumbg/icons/wood.png
plugins/enaniumbg/icons/yellowflower.png
plugins/enaniumbg/ladybird.jpg
plugins/enaniumbg/orig/aqua.jpg
plugins/enaniumbg/orig/blinds.jpg
plugins/enaniumbg/orig/dune.jpg
plugins/enaniumbg/orig/freshflower.jpg
plugins/enaniumbg/orig/garden.jpg
plugins/enaniumbg/orig/greenmeadow.jpg
plugins/enaniumbg/orig/ladybird.jpg
plugins/enaniumbg/orig/raindrops.jpg
plugins/enaniumbg/orig/storm.jpg
plugins/enaniumbg/orig/twowings.jpg
plugins/enaniumbg/orig/wood.jpg
plugins/enaniumbg/orig/yellowflower.jpg
plugins/enaniumbg/raindrops.jpg
plugins/enaniumbg/storm.jpg
plugins/enaniumbg/transw70.png
plugins/enaniumbg/twowings.jpg
plugins/enaniumbg/wood.jpg
plugins/enaniumbg/yellowflower.jpg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/EnaniumBackgrounds.php	Fri Apr 17 00:02:18 2009 -0400
@@ -0,0 +1,109 @@
+<?php
+/**!info**
+{
+  "Plugin Name"  : "Enanium backgrounds",
+  "Plugin URI"   : "http://enanocms.org/plugin/enaniumbg",
+  "Description"  : "Provides several additional background images for Enanium.",
+  "Author"       : "Dan Fuhry",
+  "Version"      : "1.1.6",
+  "Author URI"   : "http://enanocms.org/"
+}
+**!*/
+
+// $plugins->attachHook('enanium_search_form', 'enanium_paint_bg_controls();');
+$plugins->attachHook('enanium_main_header', 'enanium_paint_bg_controls();');
+$plugins->attachHook('compile_template', 'enanium_add_headers();');
+
+$ebg_images = array('default', 'aqua', 'blinds', 'dune', 'freshflower', 'garden', 'greenmeadow', 'ladybird', 'raindrops', 'storm', 'twowings', 'wood', 'yellowflower');
+
+$ebg_outsiders = array();
+if ( $dr = @opendir(ENANO_ROOT . '/plugins/enaniumbg') )
+{
+  while ( $dh = @readdir($dr) )
+  {
+    if ( $dh == '.' || $dh == '..' || is_dir(ENANO_ROOT . "/plugins/enaniumbg/$dr") )
+      continue;
+    
+    if ( in_array($dh, $ebg_images) || !preg_match('/\.jpg$/', $dh) )
+      continue;
+    
+    $dh = preg_replace('/\.jpg$/', '', $dh);
+    
+    if ( !file_exists(ENANO_ROOT . "/plugins/enaniumbg/icons/$dh.png") )
+      continue;
+    
+    $ebg_outsiders[] = $dh;
+  }
+  closedir($dr);
+}
+unset($dh, $dr);
+
+function enanium_paint_bg_controls()
+{
+  global $ebg_images, $ebg_outsiders;
+  global $lang;
+  
+  ?>
+  <div id="enanium_bg_list">
+    <?php
+    foreach ( $ebg_images as $i => $image )
+    {
+      $sel = ( $image == 'default' ) ? ' class="selected"' : '';
+      echo '<a' . $sel . ' href="#bg:' . $image . '" id="ebg_' . $image . '" onclick="enanium_change_bg(\'' . $image . '\', this); return false;" title="' . $lang->get('enaniumbg_' . $image) . '">';
+      echo enanium_generate_sprite(scriptPath . '/plugins/enaniumbg/icons/sprite.png', 16, 16, 0, $i * 16);
+      echo '</a>';
+    }
+    ?>
+  </div>
+  <?php
+}
+
+function enanium_add_headers()
+{
+  global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
+  
+  if ( $template->theme != 'enanium' )
+    return;
+  
+  $template->add_header('<link rel="stylesheet" type="text/css" href="' . scriptPath . '/plugins/enaniumbg/enaniumbg.css" />');
+  $template->add_header('<script type="text/javascript" src="' . scriptPath . '/plugins/enaniumbg/enaniumbg.js"></script>');
+}
+
+function enanium_generate_sprite($sprite, $width, $height, $start_x, $start_y)
+{
+  $start_x = 0 - $start_x;
+  $start_y = 0 - $start_y;
+  return '<img alt=" " src="' . cdnPath . '/images/spacer.gif" width="' . $width . '" height="' . $height . '" style="background-image: url(\'' . $sprite . '\'); background-repeat: no-repeat; background-position: ' . $start_x . 'px ' . $start_y . 'px;" />';
+}
+
+/**!language**
+<code>
+{
+  eng: {
+    categories: ['meta', 'enaniumbg'],
+    strings: {
+      meta: {
+        enaniumbg: 'Enanium backgrounds',
+      },
+      enaniumbg: {
+        default: 'Default',
+        aqua: 'Aqua',
+        blinds: 'Blinds',
+        dune: 'Dune',
+        freshflower: 'Fresh flower',
+        garden: 'Garden',
+        greenmeadow: 'Greenmeadow',
+        ladybird: 'Ladybird',
+        raindrops: 'Raindrops',
+        storm: 'Storm',
+        twowings: 'Two Wings',
+        wood: 'Wood',
+        yellowflower: 'Yellow flower'
+      }
+    }
+  }
+}
+</code>
+**!*/
+
Binary file plugins/enaniumbg/aqua.jpg has changed
Binary file plugins/enaniumbg/blinds.jpg has changed
Binary file plugins/enaniumbg/dune.jpg has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/enaniumbg/enaniumbg.css	Fri Apr 17 00:02:18 2009 -0400
@@ -0,0 +1,17 @@
+div#enanium_bg_list {
+  position: absolute;
+  right: 10px;
+  top: 43px;
+  background-image: url(../../themes/enanium/images/transb50.png);
+  padding: 11px 4px 8px 4px;
+}
+
+div#enanium_bg_list a {
+  padding: 8px 4px 1px 4px;
+  margin: 0 4px;
+  border: 1px solid #808080;
+}
+
+div#enanium_bg_list a:hover, div#enanium_bg_list a.selected {
+  border-color: #ffcb00;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/enaniumbg/enaniumbg.js	Fri Apr 17 00:02:18 2009 -0400
@@ -0,0 +1,42 @@
+function readCookie(name) {var nameEQ = name + "=";var ca = document.cookie.split(';');for(var i=0;i < ca.length;i++){var c = ca[i];while (c.charAt(0)==' ') c = c.substring(1,c.length);if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);}return null;}
+function createCookie(name,value,days){if (days){var date = new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires = "; expires="+date.toGMTString();}else var expires = "";document.cookie = name+"="+value+expires+"; path=/";}
+function eraseCookie(name) {createCookie(name,"",-1);}
+
+function enanium_change_bg(image)
+{
+  var body = document.getElementsByTagName('body')[0];
+  var cw = document.getElementById('cell-content');
+  if ( image == 'default' )
+  {
+    body.style.backgroundImage = 'url(' + cdnPath + '/themes/enanium/images/background.gif)';
+    body.style.backgroundRepeat = 'repeat';
+    body.style.backgroundAttachment = 'scroll';
+    cw.style.backgroundImage = null;
+    cw.style.backgroundColor = '#ffffff';
+  }
+  else
+  {
+    body.style.backgroundRepeat = 'no-repeat';
+    body.style.backgroundPosition = 'center top';
+    body.style.backgroundColor = '#000000';
+    body.style.backgroundImage = 'url(' + scriptPath + '/plugins/enaniumbg/' + image + '.jpg)';
+    body.style.backgroundAttachment = 'fixed';
+    cw.style.backgroundImage = 'url(' + scriptPath + '/plugins/enaniumbg/transw70.png)';
+    cw.style.backgroundColor = 'transparent';
+  }
+  
+  var as = getElementsByClassName(document.getElementById('enanium_bg_list'), 'a', 'selected');
+  for ( var i = 0; i < as.length; i++ )
+      $dynano(as[i]).rmClass('selected');
+  
+  $dynano('ebg_' + image).addClass('selected');
+  
+  createCookie('enanium_bg', image, 365);
+}
+
+addOnloadHook(function()
+  {
+    var ck = readCookie('enanium_bg');
+    if ( ck )
+      enanium_change_bg(ck);
+  });
Binary file plugins/enaniumbg/freshflower.jpg has changed
Binary file plugins/enaniumbg/garden.jpg has changed
Binary file plugins/enaniumbg/greenmeadow.jpg has changed
Binary file plugins/enaniumbg/icons/aqua.png has changed
Binary file plugins/enaniumbg/icons/blinds.png has changed
Binary file plugins/enaniumbg/icons/default.png has changed
Binary file plugins/enaniumbg/icons/dune.png has changed
Binary file plugins/enaniumbg/icons/freshflower.png has changed
Binary file plugins/enaniumbg/icons/garden.png has changed
Binary file plugins/enaniumbg/icons/greenmeadow.png has changed
Binary file plugins/enaniumbg/icons/ladybird.png has changed
Binary file plugins/enaniumbg/icons/raindrops.png has changed
Binary file plugins/enaniumbg/icons/sprite.png has changed
Binary file plugins/enaniumbg/icons/storm.png has changed
Binary file plugins/enaniumbg/icons/twowings.png has changed
Binary file plugins/enaniumbg/icons/wood.png has changed
Binary file plugins/enaniumbg/icons/yellowflower.png has changed
Binary file plugins/enaniumbg/ladybird.jpg has changed
Binary file plugins/enaniumbg/orig/aqua.jpg has changed
Binary file plugins/enaniumbg/orig/blinds.jpg has changed
Binary file plugins/enaniumbg/orig/dune.jpg has changed
Binary file plugins/enaniumbg/orig/freshflower.jpg has changed
Binary file plugins/enaniumbg/orig/garden.jpg has changed
Binary file plugins/enaniumbg/orig/greenmeadow.jpg has changed
Binary file plugins/enaniumbg/orig/ladybird.jpg has changed
Binary file plugins/enaniumbg/orig/raindrops.jpg has changed
Binary file plugins/enaniumbg/orig/storm.jpg has changed
Binary file plugins/enaniumbg/orig/twowings.jpg has changed
Binary file plugins/enaniumbg/orig/wood.jpg has changed
Binary file plugins/enaniumbg/orig/yellowflower.jpg has changed
Binary file plugins/enaniumbg/raindrops.jpg has changed
Binary file plugins/enaniumbg/storm.jpg has changed
Binary file plugins/enaniumbg/transw70.png has changed
Binary file plugins/enaniumbg/twowings.jpg has changed
Binary file plugins/enaniumbg/wood.jpg has changed
Binary file plugins/enaniumbg/yellowflower.jpg has changed