forked from GNUsocial/gnu-social
		
	Widgetize the design form
Squashed commit of the following: commit a4610db66974866fdeb98184ce7e2be1470fb4d7 Author: Evan Prodromou <evan@status.net> Date: Mon May 31 08:48:35 2010 -0700 use selfUrl for designform action commit fd9f46ab33caa2c2d0df90d1d596c7b8c6453ce3 Author: Evan Prodromou <evan@status.net> Date: Mon May 31 08:29:43 2010 -0700 fix design settings syntax commit d1797ef9f90bf038665463424ad962bfe039c9f0 Author: Evan Prodromou <evan@status.net> Date: Mon Nov 9 23:23:53 2009 -0500 widgetizing design form
This commit is contained in:
		
							
								
								
									
										293
									
								
								lib/designform.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										293
									
								
								lib/designform.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,293 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * StatusNet, the distributed open-source microblogging tool
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Form for choosing a design
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * PHP version 5
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * LICENCE: This program is free software: you can redistribute it and/or modify
 | 
				
			||||||
 | 
					 * it under the terms of the GNU Affero General Public License as published by
 | 
				
			||||||
 | 
					 * the Free Software Foundation, either version 3 of the License, or
 | 
				
			||||||
 | 
					 * (at your option) any later version.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					 * GNU Affero General Public License for more details.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * You should have received a copy of the GNU Affero General Public License
 | 
				
			||||||
 | 
					 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @category  Form
 | 
				
			||||||
 | 
					 * @package   StatusNet
 | 
				
			||||||
 | 
					 * @author    Evan Prodromou <evan@status.net>
 | 
				
			||||||
 | 
					 * @author    Sarven Capadisli <csarven@status.net>
 | 
				
			||||||
 | 
					 * @copyright 2009 StatusNet, Inc.
 | 
				
			||||||
 | 
					 * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
 | 
				
			||||||
 | 
					 * @link      http://status.net/
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (!defined('STATUSNET') && !defined('LACONICA')) {
 | 
				
			||||||
 | 
					    exit(1);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Form for choosing a design
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Used for choosing a site design, user design, or group design.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @category Form
 | 
				
			||||||
 | 
					 * @package  StatusNet
 | 
				
			||||||
 | 
					 * @author   Evan Prodromou <evan@status.net>
 | 
				
			||||||
 | 
					 * @author   Sarven Capadisli <csarven@status.net>
 | 
				
			||||||
 | 
					 * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
 | 
				
			||||||
 | 
					 * @link     http://status.net/
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class DesignForm extends Form
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Return-to args
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    var $design     = null;
 | 
				
			||||||
 | 
					    var $actionurl  = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Constructor
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param HTMLOutputter $out       output channel
 | 
				
			||||||
 | 
					     * @param Design        $design    initial design
 | 
				
			||||||
 | 
					     * @param Design        $actionurl url of action (for form posting)
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function __construct($out, $design, $actionurl)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        parent::__construct($out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->design     = $design;
 | 
				
			||||||
 | 
					        $this->actionurl = $actionurl;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * ID of the form
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return int ID of the form
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function id()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return 'design';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * class of the form
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return string class of the form
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function formClass()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return 'form_design';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Action of the form
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return string URL of the action
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function action()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return $this->actionurl;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Legend of the Form
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return void
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    function formLegend()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->out->element('legend', null, _('Change design'));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Data elements of the form
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return void
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function formData()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->out->elementStart('ul', 'form_data');
 | 
				
			||||||
 | 
					        $this->out->elementStart('li');
 | 
				
			||||||
 | 
					        $this->out->element('label', array('for' => 'design_background-image_file'),
 | 
				
			||||||
 | 
					                            _('Upload file'));
 | 
				
			||||||
 | 
					        $this->out->element('input', array('name' => 'design_background-image_file',
 | 
				
			||||||
 | 
					                                           'type' => 'file',
 | 
				
			||||||
 | 
					                                           'id' => 'design_background-image_file'));
 | 
				
			||||||
 | 
					        $this->out->element('p', 'form_guide', _('You can upload your personal ' .
 | 
				
			||||||
 | 
					                                                 'background image. The maximum file size is 2Mb.'));
 | 
				
			||||||
 | 
					        $this->out->element('input', array('name' => 'MAX_FILE_SIZE',
 | 
				
			||||||
 | 
					                                           'type' => 'hidden',
 | 
				
			||||||
 | 
					                                           'id' => 'MAX_FILE_SIZE',
 | 
				
			||||||
 | 
					                                           'value' => ImageFile::maxFileSizeInt()));
 | 
				
			||||||
 | 
					        $this->out->elementEnd('li');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (!empty($design->backgroundimage)) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $this->out->elementStart('li', array('id' =>
 | 
				
			||||||
 | 
					                                                 'design_background-image_onoff'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $this->out->element('img', array('src' =>
 | 
				
			||||||
 | 
					                                             Design::url($design->backgroundimage)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $attrs = array('name' => 'design_background-image_onoff',
 | 
				
			||||||
 | 
					                           'type' => 'radio',
 | 
				
			||||||
 | 
					                           'id' => 'design_background-image_on',
 | 
				
			||||||
 | 
					                           'class' => 'radio',
 | 
				
			||||||
 | 
					                           'value' => 'on');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if ($design->disposition & BACKGROUND_ON) {
 | 
				
			||||||
 | 
					                $attrs['checked'] = 'checked';
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $this->out->element('input', $attrs);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $this->out->element('label', array('for' => 'design_background-image_on',
 | 
				
			||||||
 | 
					                                               'class' => 'radio'),
 | 
				
			||||||
 | 
					                                _('On'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $attrs = array('name' => 'design_background-image_onoff',
 | 
				
			||||||
 | 
					                           'type' => 'radio',
 | 
				
			||||||
 | 
					                           'id' => 'design_background-image_off',
 | 
				
			||||||
 | 
					                           'class' => 'radio',
 | 
				
			||||||
 | 
					                           'value' => 'off');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if ($design->disposition & BACKGROUND_OFF) {
 | 
				
			||||||
 | 
					                $attrs['checked'] = 'checked';
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $this->out->element('input', $attrs);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $this->out->element('label', array('for' => 'design_background-image_off',
 | 
				
			||||||
 | 
					                                               'class' => 'radio'),
 | 
				
			||||||
 | 
					                                _('Off'));
 | 
				
			||||||
 | 
					            $this->out->element('p', 'form_guide', _('Turn background image on or off.'));
 | 
				
			||||||
 | 
					            $this->out->elementEnd('li');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $this->out->elementStart('li');
 | 
				
			||||||
 | 
					            $this->out->checkbox('design_background-image_repeat',
 | 
				
			||||||
 | 
					                                 _('Tile background image'),
 | 
				
			||||||
 | 
					                                 ($design->disposition & BACKGROUND_TILE) ? true : false);
 | 
				
			||||||
 | 
					            $this->out->elementEnd('li');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->out->elementEnd('ul');
 | 
				
			||||||
 | 
					        $this->out->elementEnd('fieldset');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->out->elementStart('fieldset', array('id' => 'settings_design_color'));
 | 
				
			||||||
 | 
					        $this->out->element('legend', null, _('Change colours'));
 | 
				
			||||||
 | 
					        $this->out->elementStart('ul', 'form_data');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $bgcolor = new WebColor($design->backgroundcolor);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $this->out->elementStart('li');
 | 
				
			||||||
 | 
					            $this->out->element('label', array('for' => 'swatch-1'), _('Background'));
 | 
				
			||||||
 | 
					            $this->out->element('input', array('name' => 'design_background',
 | 
				
			||||||
 | 
					                                               'type' => 'text',
 | 
				
			||||||
 | 
					                                               'id' => 'swatch-1',
 | 
				
			||||||
 | 
					                                               'class' => 'swatch',
 | 
				
			||||||
 | 
					                                               'maxlength' => '7',
 | 
				
			||||||
 | 
					                                               'size' => '7',
 | 
				
			||||||
 | 
					                                               'value' => ''));
 | 
				
			||||||
 | 
					            $this->out->elementEnd('li');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $ccolor = new WebColor($design->contentcolor);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $this->out->elementStart('li');
 | 
				
			||||||
 | 
					            $this->out->element('label', array('for' => 'swatch-2'), _('Content'));
 | 
				
			||||||
 | 
					            $this->out->element('input', array('name' => 'design_content',
 | 
				
			||||||
 | 
					                                               'type' => 'text',
 | 
				
			||||||
 | 
					                                               'id' => 'swatch-2',
 | 
				
			||||||
 | 
					                                               'class' => 'swatch',
 | 
				
			||||||
 | 
					                                               'maxlength' => '7',
 | 
				
			||||||
 | 
					                                               'size' => '7',
 | 
				
			||||||
 | 
					                                               'value' => ''));
 | 
				
			||||||
 | 
					            $this->out->elementEnd('li');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $sbcolor = new WebColor($design->sidebarcolor);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $this->out->elementStart('li');
 | 
				
			||||||
 | 
					            $this->out->element('label', array('for' => 'swatch-3'), _('Sidebar'));
 | 
				
			||||||
 | 
					            $this->out->element('input', array('name' => 'design_sidebar',
 | 
				
			||||||
 | 
					                                               'type' => 'text',
 | 
				
			||||||
 | 
					                                               'id' => 'swatch-3',
 | 
				
			||||||
 | 
					                                               'class' => 'swatch',
 | 
				
			||||||
 | 
					                                               'maxlength' => '7',
 | 
				
			||||||
 | 
					                                               'size' => '7',
 | 
				
			||||||
 | 
					                                               'value' => ''));
 | 
				
			||||||
 | 
					            $this->out->elementEnd('li');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $tcolor = new WebColor($design->textcolor);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $this->out->elementStart('li');
 | 
				
			||||||
 | 
					            $this->out->element('label', array('for' => 'swatch-4'), _('Text'));
 | 
				
			||||||
 | 
					            $this->out->element('input', array('name' => 'design_text',
 | 
				
			||||||
 | 
					                                               'type' => 'text',
 | 
				
			||||||
 | 
					                                               'id' => 'swatch-4',
 | 
				
			||||||
 | 
					                                               'class' => 'swatch',
 | 
				
			||||||
 | 
					                                               'maxlength' => '7',
 | 
				
			||||||
 | 
					                                               'size' => '7',
 | 
				
			||||||
 | 
					                                               'value' => ''));
 | 
				
			||||||
 | 
					            $this->out->elementEnd('li');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $lcolor = new WebColor($design->linkcolor);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $this->out->elementStart('li');
 | 
				
			||||||
 | 
					            $this->out->element('label', array('for' => 'swatch-5'), _('Links'));
 | 
				
			||||||
 | 
					            $this->out->element('input', array('name' => 'design_links',
 | 
				
			||||||
 | 
					                                               'type' => 'text',
 | 
				
			||||||
 | 
					                                               'id' => 'swatch-5',
 | 
				
			||||||
 | 
					                                               'class' => 'swatch',
 | 
				
			||||||
 | 
					                                               'maxlength' => '7',
 | 
				
			||||||
 | 
					                                               'size' => '7',
 | 
				
			||||||
 | 
					                                               'value' => ''));
 | 
				
			||||||
 | 
					            $this->out->elementEnd('li');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        } catch (WebColorException $e) {
 | 
				
			||||||
 | 
					            common_log(LOG_ERR, 'Bad color values in design ID: ' .$design->id);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->out->elementEnd('ul');
 | 
				
			||||||
 | 
					        $this->out->elementEnd('fieldset');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->out->elementStart('fieldset');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->out->submit('defaults', _('Use defaults'), 'submit form_action-default',
 | 
				
			||||||
 | 
					                           'defaults', _('Restore default designs'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->out->element('input', array('id' => 'settings_design_reset',
 | 
				
			||||||
 | 
					                                           'type' => 'reset',
 | 
				
			||||||
 | 
					                                           'value' => 'Reset',
 | 
				
			||||||
 | 
					                                           'class' => 'submit form_action-primary',
 | 
				
			||||||
 | 
					                                           'title' => _('Reset back to default')));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Action elements
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return void
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function formActions()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->out->submit('save', _('Save'), 'submit form_action-secondary',
 | 
				
			||||||
 | 
					                           'save', _('Save design'));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -87,177 +87,8 @@ class DesignSettingsAction extends AccountSettingsAction
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    function showDesignForm($design)
 | 
					    function showDesignForm($design)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        $form = new DesignForm($this, $design, $this->selfUrl());
 | 
				
			||||||
        $this->elementStart('form', array('method' => 'post',
 | 
					        $form->show();
 | 
				
			||||||
                                          'enctype' => 'multipart/form-data',
 | 
					 | 
				
			||||||
                                          'id' => 'form_settings_design',
 | 
					 | 
				
			||||||
                                          'class' => 'form_settings',
 | 
					 | 
				
			||||||
                                          'action' => $this->submitaction));
 | 
					 | 
				
			||||||
        $this->elementStart('fieldset');
 | 
					 | 
				
			||||||
        $this->hidden('token', common_session_token());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $this->elementStart('fieldset', array('id' =>
 | 
					 | 
				
			||||||
            'settings_design_background-image'));
 | 
					 | 
				
			||||||
        $this->element('legend', null, _('Change background image'));
 | 
					 | 
				
			||||||
        $this->elementStart('ul', 'form_data');
 | 
					 | 
				
			||||||
        $this->elementStart('li');
 | 
					 | 
				
			||||||
        $this->element('label', array('for' => 'design_background-image_file'),
 | 
					 | 
				
			||||||
                                _('Upload file'));
 | 
					 | 
				
			||||||
        $this->element('input', array('name' => 'design_background-image_file',
 | 
					 | 
				
			||||||
                                      'type' => 'file',
 | 
					 | 
				
			||||||
                                      'id' => 'design_background-image_file'));
 | 
					 | 
				
			||||||
        $this->element('p', 'form_guide', _('You can upload your personal ' .
 | 
					 | 
				
			||||||
            'background image. The maximum file size is 2MB.'));
 | 
					 | 
				
			||||||
        $this->element('input', array('name' => 'MAX_FILE_SIZE',
 | 
					 | 
				
			||||||
                                      'type' => 'hidden',
 | 
					 | 
				
			||||||
                                      'id' => 'MAX_FILE_SIZE',
 | 
					 | 
				
			||||||
                                      'value' => ImageFile::maxFileSizeInt()));
 | 
					 | 
				
			||||||
        $this->elementEnd('li');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (!empty($design->backgroundimage)) {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            $this->elementStart('li', array('id' =>
 | 
					 | 
				
			||||||
                'design_background-image_onoff'));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            $this->element('img', array('src' =>
 | 
					 | 
				
			||||||
                Design::url($design->backgroundimage)));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            $attrs = array('name' => 'design_background-image_onoff',
 | 
					 | 
				
			||||||
                           'type' => 'radio',
 | 
					 | 
				
			||||||
                           'id' => 'design_background-image_on',
 | 
					 | 
				
			||||||
                           'class' => 'radio',
 | 
					 | 
				
			||||||
                           'value' => 'on');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if ($design->disposition & BACKGROUND_ON) {
 | 
					 | 
				
			||||||
                $attrs['checked'] = 'checked';
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            $this->element('input', $attrs);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            $this->element('label', array('for' => 'design_background-image_on',
 | 
					 | 
				
			||||||
                                          'class' => 'radio'),
 | 
					 | 
				
			||||||
                                          _('On'));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            $attrs = array('name' => 'design_background-image_onoff',
 | 
					 | 
				
			||||||
                           'type' => 'radio',
 | 
					 | 
				
			||||||
                           'id' => 'design_background-image_off',
 | 
					 | 
				
			||||||
                           'class' => 'radio',
 | 
					 | 
				
			||||||
                           'value' => 'off');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if ($design->disposition & BACKGROUND_OFF) {
 | 
					 | 
				
			||||||
                $attrs['checked'] = 'checked';
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            $this->element('input', $attrs);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            $this->element('label', array('for' => 'design_background-image_off',
 | 
					 | 
				
			||||||
                                          'class' => 'radio'),
 | 
					 | 
				
			||||||
                                          _('Off'));
 | 
					 | 
				
			||||||
            $this->element('p', 'form_guide', _('Turn background image on or off.'));
 | 
					 | 
				
			||||||
            $this->elementEnd('li');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            $this->elementStart('li');
 | 
					 | 
				
			||||||
            $this->checkbox('design_background-image_repeat',
 | 
					 | 
				
			||||||
                            _('Tile background image'),
 | 
					 | 
				
			||||||
                            ($design->disposition & BACKGROUND_TILE) ? true : false);
 | 
					 | 
				
			||||||
            $this->elementEnd('li');
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $this->elementEnd('ul');
 | 
					 | 
				
			||||||
        $this->elementEnd('fieldset');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $this->elementStart('fieldset', array('id' => 'settings_design_color'));
 | 
					 | 
				
			||||||
        $this->element('legend', null, _('Change colours'));
 | 
					 | 
				
			||||||
        $this->elementStart('ul', 'form_data');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        try {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            $bgcolor = new WebColor($design->backgroundcolor);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            $this->elementStart('li');
 | 
					 | 
				
			||||||
            $this->element('label', array('for' => 'swatch-1'), _('Background'));
 | 
					 | 
				
			||||||
            $this->element('input', array('name' => 'design_background',
 | 
					 | 
				
			||||||
                                          'type' => 'text',
 | 
					 | 
				
			||||||
                                          'id' => 'swatch-1',
 | 
					 | 
				
			||||||
                                          'class' => 'swatch',
 | 
					 | 
				
			||||||
                                          'maxlength' => '7',
 | 
					 | 
				
			||||||
                                          'size' => '7',
 | 
					 | 
				
			||||||
                                          'value' => ''));
 | 
					 | 
				
			||||||
            $this->elementEnd('li');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            $ccolor = new WebColor($design->contentcolor);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            $this->elementStart('li');
 | 
					 | 
				
			||||||
            $this->element('label', array('for' => 'swatch-2'), _('Content'));
 | 
					 | 
				
			||||||
            $this->element('input', array('name' => 'design_content',
 | 
					 | 
				
			||||||
                                          'type' => 'text',
 | 
					 | 
				
			||||||
                                          'id' => 'swatch-2',
 | 
					 | 
				
			||||||
                                          'class' => 'swatch',
 | 
					 | 
				
			||||||
                                          'maxlength' => '7',
 | 
					 | 
				
			||||||
                                          'size' => '7',
 | 
					 | 
				
			||||||
                                          'value' => ''));
 | 
					 | 
				
			||||||
            $this->elementEnd('li');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            $sbcolor = new WebColor($design->sidebarcolor);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            $this->elementStart('li');
 | 
					 | 
				
			||||||
            $this->element('label', array('for' => 'swatch-3'), _('Sidebar'));
 | 
					 | 
				
			||||||
            $this->element('input', array('name' => 'design_sidebar',
 | 
					 | 
				
			||||||
                                        'type' => 'text',
 | 
					 | 
				
			||||||
                                        'id' => 'swatch-3',
 | 
					 | 
				
			||||||
                                        'class' => 'swatch',
 | 
					 | 
				
			||||||
                                        'maxlength' => '7',
 | 
					 | 
				
			||||||
                                        'size' => '7',
 | 
					 | 
				
			||||||
                                        'value' => ''));
 | 
					 | 
				
			||||||
            $this->elementEnd('li');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            $tcolor = new WebColor($design->textcolor);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            $this->elementStart('li');
 | 
					 | 
				
			||||||
            $this->element('label', array('for' => 'swatch-4'), _('Text'));
 | 
					 | 
				
			||||||
            $this->element('input', array('name' => 'design_text',
 | 
					 | 
				
			||||||
                                        'type' => 'text',
 | 
					 | 
				
			||||||
                                        'id' => 'swatch-4',
 | 
					 | 
				
			||||||
                                        'class' => 'swatch',
 | 
					 | 
				
			||||||
                                        'maxlength' => '7',
 | 
					 | 
				
			||||||
                                        'size' => '7',
 | 
					 | 
				
			||||||
                                        'value' => ''));
 | 
					 | 
				
			||||||
            $this->elementEnd('li');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            $lcolor = new WebColor($design->linkcolor);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            $this->elementStart('li');
 | 
					 | 
				
			||||||
            $this->element('label', array('for' => 'swatch-5'), _('Links'));
 | 
					 | 
				
			||||||
            $this->element('input', array('name' => 'design_links',
 | 
					 | 
				
			||||||
                                         'type' => 'text',
 | 
					 | 
				
			||||||
                                         'id' => 'swatch-5',
 | 
					 | 
				
			||||||
                                         'class' => 'swatch',
 | 
					 | 
				
			||||||
                                         'maxlength' => '7',
 | 
					 | 
				
			||||||
                                         'size' => '7',
 | 
					 | 
				
			||||||
                                         'value' => ''));
 | 
					 | 
				
			||||||
            $this->elementEnd('li');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        } catch (WebColorException $e) {
 | 
					 | 
				
			||||||
            common_log(LOG_ERR, 'Bad color values in design ID: ' .$design->id);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $this->elementEnd('ul');
 | 
					 | 
				
			||||||
        $this->elementEnd('fieldset');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $this->submit('defaults', _('Use defaults'), 'submit form_action-default',
 | 
					 | 
				
			||||||
            'defaults', _('Restore default designs'));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $this->element('input', array('id' => 'settings_design_reset',
 | 
					 | 
				
			||||||
                                     'type' => 'reset',
 | 
					 | 
				
			||||||
                                     'value' => 'Reset',
 | 
					 | 
				
			||||||
                                     'class' => 'submit form_action-primary',
 | 
					 | 
				
			||||||
                                     'title' => _('Reset back to default')));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $this->submit('save', _('Save'), 'submit form_action-secondary',
 | 
					 | 
				
			||||||
            'save', _('Save design'));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $this->elementEnd('fieldset');
 | 
					 | 
				
			||||||
        $this->elementEnd('form');
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user