function showContent()
{
$user = common_current_user();
+ $design = $user->getDesign();
+
+ if (empty($design)) {
+ $design = $this->defaultDesign();
+ }
+
$this->elementStart('form', array('method' => 'post',
'enctype' => 'multipart/form-data',
'id' => 'form_settings_design',
$this->elementStart('li');
$this->checkbox('design_background-image_repeat',
_('Tile background image'),
- false, null, true, false);
+ $design->tile);
$this->elementEnd('li');
$this->elementEnd('ul');
$this->element('legend', null, _('Change colours'));
$this->elementStart('ul', 'form_data');
- $design = $user->getDesign();
-
- if (empty($design)) {
- $design = $this->defaultDesign();
- }
-
try {
$bgcolor = new WebColor($design->backgroundcolor);
$design->backgroundimage = $defaults['backgroundimage'];
+ $deisng->tile = $defaults['tile'];
+
} catch (WebColorException $e) {
common_log(LOG_ERR, _('Bad default color settings: ' .
$e->getMessage()));
return;
}
+ $tile = $this->boolean('design_background-image_repeat');
+
$user = common_current_user();
$design = $user->getDesign();
$design->textcolor = $tcolor->intValue();
$design->linkcolor = $lcolor->intValue();
$design->backgroundimage = $filepath;
+ $design->tile = $tile;
$result = $design->update($original);
$design->textcolor = $tcolor->intValue();
$design->linkcolor = $lcolor->intValue();
$design->backgroundimage = $filepath;
+ $design->tile = $tile;
$id = $design->insert();
public $textcolor; // int(4)
public $linkcolor; // int(4)
public $backgroundimage; // varchar(255)
- public $tile; // tinyint(1)
+ public $tile; // tinyint(1)
/* Static get */
function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Design',$k,$v); }
common_log(LOG_ERR, "Unable to create color for design $id.",
__FILE__);
}
-
+
$css = 'html, body { background-color: #' . $bgcolor->hexValue() . '} ' . "\n";
$css .= '#content, #site_nav_local_views .current a { background-color: #';
$css .= $ccolor->hexValue() . '} '."\n";
$css .= '#aside_primary { background-color: #'. $sbcolor->hexValue() . '} ' . "\n";
$css .= 'html body { color: #'. $tcolor->hexValue() . '} '. "\n";
$css .= 'a { color: #' . $lcolor->hexValue() . '} ' . "\n";
-
+
if (!empty($this->backgroundimage)) {
-
- $css .= 'body { background-image:url(' .
- Design::url($this->backgroundimage) .
- '); background-repeat:no-repeat; }' . "\n";
+
+ $repeat = ($this->tile) ? 'background-repeat:repeat;' :
+ 'background-repeat:no-repeat;';
+
+ $css .= 'body { background-image:url(' .
+ Design::url($this->backgroundimage) .
+ '); ' . $repeat . ' }' . "\n";
}
-
+
$out->element('style', array('type' => 'text/css'), $css);
-
+
}
static function filename($id, $extension, $extra=null)
return $dir . $filename;
}
-
+
static function url($filename)
{
$path = common_config('background', 'path');
return 'http://'.$server.$path.$filename;
}
-
+
}
'sidebarcolor' => '#CEE1E9',
'textcolor' => '#000000',
'linkcolor' => '#002E6E',
- 'backgroundimage' => null),
+ 'backgroundimage' => null,
+ 'tile' => true),
'path' => $_path,
'logfile' => null,
'logo' => null,