Merge branch 'userdesign' of /var/www/design into userdesign

This commit is contained in:
Sarven Capadisli 2009-06-17 05:19:32 +00:00
commit fe9cace9b7
3 changed files with 29 additions and 19 deletions

View File

@ -71,6 +71,12 @@ class DesignsettingsAction extends AccountSettingsAction
function showContent() function showContent()
{ {
$user = common_current_user(); $user = common_current_user();
$design = $user->getDesign();
if (empty($design)) {
$design = $this->defaultDesign();
}
$this->elementStart('form', array('method' => 'post', $this->elementStart('form', array('method' => 'post',
'enctype' => 'multipart/form-data', 'enctype' => 'multipart/form-data',
'id' => 'form_settings_design', 'id' => 'form_settings_design',
@ -122,7 +128,7 @@ class DesignsettingsAction extends AccountSettingsAction
$this->elementStart('li'); $this->elementStart('li');
$this->checkbox('design_background-image_repeat', $this->checkbox('design_background-image_repeat',
_('Tile background image'), _('Tile background image'),
false, null, true, false); $design->tile);
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
@ -132,12 +138,6 @@ class DesignsettingsAction extends AccountSettingsAction
$this->element('legend', null, _('Change colours')); $this->element('legend', null, _('Change colours'));
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
$design = $user->getDesign();
if (empty($design)) {
$design = $this->defaultDesign();
}
try { try {
$bgcolor = new WebColor($design->backgroundcolor); $bgcolor = new WebColor($design->backgroundcolor);
@ -340,6 +340,8 @@ class DesignsettingsAction extends AccountSettingsAction
$design->backgroundimage = $defaults['backgroundimage']; $design->backgroundimage = $defaults['backgroundimage'];
$deisng->tile = $defaults['tile'];
} catch (WebColorException $e) { } catch (WebColorException $e) {
common_log(LOG_ERR, _('Bad default color settings: ' . common_log(LOG_ERR, _('Bad default color settings: ' .
$e->getMessage())); $e->getMessage()));
@ -369,6 +371,8 @@ class DesignsettingsAction extends AccountSettingsAction
return; return;
} }
$tile = $this->boolean('design_background-image_repeat');
$user = common_current_user(); $user = common_current_user();
$design = $user->getDesign(); $design = $user->getDesign();
@ -382,6 +386,7 @@ class DesignsettingsAction extends AccountSettingsAction
$design->textcolor = $tcolor->intValue(); $design->textcolor = $tcolor->intValue();
$design->linkcolor = $lcolor->intValue(); $design->linkcolor = $lcolor->intValue();
$design->backgroundimage = $filepath; $design->backgroundimage = $filepath;
$design->tile = $tile;
$result = $design->update($original); $result = $design->update($original);
@ -405,6 +410,7 @@ class DesignsettingsAction extends AccountSettingsAction
$design->textcolor = $tcolor->intValue(); $design->textcolor = $tcolor->intValue();
$design->linkcolor = $lcolor->intValue(); $design->linkcolor = $lcolor->intValue();
$design->backgroundimage = $filepath; $design->backgroundimage = $filepath;
$design->tile = $tile;
$id = $design->insert(); $id = $design->insert();

View File

@ -74,9 +74,12 @@ class Design extends Memcached_DataObject
if (!empty($this->backgroundimage)) { if (!empty($this->backgroundimage)) {
$repeat = ($this->tile) ? 'background-repeat:repeat;' :
'background-repeat:no-repeat;';
$css .= 'body { background-image:url(' . $css .= 'body { background-image:url(' .
Design::url($this->backgroundimage) . Design::url($this->backgroundimage) .
'); background-repeat:no-repeat; }' . "\n"; '); ' . $repeat . ' }' . "\n";
} }
$out->element('style', array('type' => 'text/css'), $css); $out->element('style', array('type' => 'text/css'), $css);

View File

@ -78,7 +78,8 @@ $config =
'sidebarcolor' => '#CEE1E9', 'sidebarcolor' => '#CEE1E9',
'textcolor' => '#000000', 'textcolor' => '#000000',
'linkcolor' => '#002E6E', 'linkcolor' => '#002E6E',
'backgroundimage' => null), 'backgroundimage' => null,
'tile' => true),
'path' => $_path, 'path' => $_path,
'logfile' => null, 'logfile' => null,
'logo' => null, 'logo' => null,