Added background image tile flag to Design

This commit is contained in:
Zach Copley 2009-06-16 21:36:15 -07:00
parent bea2fa1506
commit 7b7f119428
3 changed files with 13 additions and 10 deletions

View File

@ -41,6 +41,7 @@ class Design extends Memcached_DataObject
public $textcolor; // int(4) public $textcolor; // int(4)
public $linkcolor; // int(4) public $linkcolor; // int(4)
public $backgroundimage; // varchar(255) public $backgroundimage; // varchar(255)
public $tile; // tinyint(1)
/* Static get */ /* Static get */
function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Design',$k,$v); } function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Design',$k,$v); }
@ -63,23 +64,23 @@ class Design extends Memcached_DataObject
common_log(LOG_ERR, "Unable to create color for design $id.", common_log(LOG_ERR, "Unable to create color for design $id.",
__FILE__); __FILE__);
} }
$css = 'html, body { background-color: #' . $bgcolor->hexValue() . '} ' . "\n"; $css = 'html, body { background-color: #' . $bgcolor->hexValue() . '} ' . "\n";
$css .= '#content, #site_nav_local_views .current a { background-color: #'; $css .= '#content, #site_nav_local_views .current a { background-color: #';
$css .= $ccolor->hexValue() . '} '."\n"; $css .= $ccolor->hexValue() . '} '."\n";
$css .= '#aside_primary { background-color: #'. $sbcolor->hexValue() . '} ' . "\n"; $css .= '#aside_primary { background-color: #'. $sbcolor->hexValue() . '} ' . "\n";
$css .= 'html body { color: #'. $tcolor->hexValue() . '} '. "\n"; $css .= 'html body { color: #'. $tcolor->hexValue() . '} '. "\n";
$css .= 'a { color: #' . $lcolor->hexValue() . '} ' . "\n"; $css .= 'a { color: #' . $lcolor->hexValue() . '} ' . "\n";
if (!empty($this->backgroundimage)) { if (!empty($this->backgroundimage)) {
$css .= 'body { background-image:url(' . $css .= 'body { background-image:url(' .
Design::url($this->backgroundimage) . Design::url($this->backgroundimage) .
'); background-repeat:no-repeat; }' . "\n"; '); background-repeat:no-repeat; }' . "\n";
} }
$out->element('style', array('type' => 'text/css'), $css); $out->element('style', array('type' => 'text/css'), $css);
} }
static function filename($id, $extension, $extra=null) static function filename($id, $extension, $extra=null)
@ -97,7 +98,7 @@ class Design extends Memcached_DataObject
return $dir . $filename; return $dir . $filename;
} }
static function url($filename) static function url($filename)
{ {
$path = common_config('background', 'path'); $path = common_config('background', 'path');
@ -120,5 +121,5 @@ class Design extends Memcached_DataObject
return 'http://'.$server.$path.$filename; return 'http://'.$server.$path.$filename;
} }
} }

View File

@ -46,6 +46,7 @@ sidebarcolor = 1
textcolor = 1 textcolor = 1
linkcolor = 1 linkcolor = 1
backgroundimage = 2 backgroundimage = 2
tile = 17
[design__keys] [design__keys]
id = N id = N

View File

@ -495,7 +495,8 @@ create table design (
sidebarcolor integer comment 'sidebar background color', sidebarcolor integer comment 'sidebar background color',
textcolor integer comment 'text color', textcolor integer comment 'text color',
linkcolor integer comment 'link color', linkcolor integer comment 'link color',
backgroundimage varchar(255) comment 'background image, if any' backgroundimage varchar(255) comment 'background image, if any',
tile tinyint default 0 comment 'tile background image'
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
create table group_block ( create table group_block (