Esempio n. 1
0
 function showUploadForm()
 {
     $user = common_current_user();
     $profile = $user->getProfile();
     if (!$profile) {
         common_log_db_error($user, 'SELECT', __FILE__);
         $this->serverError(_('用户个人资料丢失'));
         return;
     }
     $original = $profile->getOriginalAvatar();
     $this->elementStart('form', array('enctype' => 'multipart/form-data', 'method' => 'post', 'id' => 'form_settings_avatar', 'class' => 'form_settings', 'action' => common_local_url('avatarsettings')));
     $this->elementStart('fieldset');
     $this->element('legend', null, _('头像设置'));
     $this->hidden('token', common_session_token());
     if (Event::handle('StartAvatarFormData', array($this))) {
         $this->elementStart('ul', 'form_data');
         if ($original) {
             $this->elementStart('li', array('id' => 'avatar_original', 'class' => 'avatar_view'));
             $this->element('h2', null, _("原始大小头像"));
             $this->elementStart('div', array('id' => 'avatar_original_view'));
             $this->element('img', array('src' => $original->url, 'width' => $original->width, 'height' => $original->height, 'alt' => $user->nickname));
             $this->elementEnd('div');
             $this->elementEnd('li');
         }
         $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
         if ($avatar) {
             $this->elementStart('li', array('id' => 'avatar_preview', 'class' => 'avatar_view'));
             $this->element('h2', null, _("缩略图预览"));
             $this->elementStart('div', array('id' => 'avatar_preview_view'));
             $this->element('img', array('src' => $original->url, 'width' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE, 'alt' => $user->nickname));
             $this->elementEnd('div');
             $this->submit('delete', _('删 除'));
             $this->elementEnd('li');
         }
         $this->elementStart('li', array('id' => 'settings_attach'));
         $this->element('input', array('name' => 'avatarfile', 'type' => 'file', 'id' => 'avatarfile'));
         $this->element('input', array('name' => 'MAX_FILE_SIZE', 'type' => 'hidden', 'id' => 'MAX_FILE_SIZE', 'value' => ImageFile::maxFileSizeInt()));
         $this->elementEnd('li');
         $this->elementEnd('ul');
         $this->elementStart('ul', 'form_actions');
         $this->elementStart('li');
         $this->submit('upload', _('上 传'));
         $this->elementEnd('li');
         $this->elementEnd('ul');
     }
     Event::handle('EndAvatarFormData', array($this));
     $this->elementEnd('fieldset');
     $this->elementEnd('form');
 }
 /**
  * Data elements of the form
  *
  * @return void
  */
 function formData()
 {
     if ($this->application) {
         $id = $this->application->id;
         $icon = $this->application->icon;
         $name = $this->application->name;
         $description = $this->application->description;
         $source_url = $this->application->source_url;
         $organization = $this->application->organization;
         $homepage = $this->application->homepage;
         $callback_url = $this->application->callback_url;
         $this->type = $this->application->type;
         $this->access_type = $this->application->access_type;
     } else {
         $id = '';
         $icon = '';
         $name = '';
         $description = '';
         $source_url = '';
         $organization = '';
         $homepage = '';
         $callback_url = '';
         $this->type = '';
         $this->access_type = '';
     }
     $this->out->elementStart('ul', 'form_data');
     $this->out->elementStart('li', array('id' => 'application_icon'));
     if (!empty($icon)) {
         $this->out->element('img', array('src' => $icon));
     }
     $this->out->element('input', array('name' => 'MAX_FILE_SIZE', 'type' => 'hidden', 'id' => 'MAX_FILE_SIZE', 'value' => ImageFile::maxFileSizeInt()));
     $this->out->element('label', array('for' => 'app_icon'), _('Icon'));
     $this->out->element('input', array('name' => 'app_icon', 'type' => 'file', 'id' => 'app_icon'));
     // TRANS: Form guide.
     $this->out->element('p', 'form_guide', _('Icon for this application'));
     $this->out->elementEnd('li');
     $this->out->elementStart('li');
     $this->out->hidden('application_id', $id);
     // TRANS: Form input field label for application name.
     $this->out->input('name', _('Name'), $this->out->arg('name') ? $this->out->arg('name') : $name);
     $this->out->elementEnd('li');
     $this->out->elementStart('li');
     $maxDesc = Oauth_application::maxDesc();
     if ($maxDesc > 0) {
         // TRANS: Form input field instructions.
         // TRANS: %d is the number of available characters for the description.
         $descInstr = sprintf(_m('Describe your application in %d character', 'Describe your application in %d characters', $maxDesc), $maxDesc);
     } else {
         // TRANS: Form input field instructions.
         $descInstr = _('Describe your application');
     }
     // TRANS: Form input field label.
     $this->out->textarea('description', _('Description'), $this->out->arg('description') ? $this->out->arg('description') : $description, $descInstr);
     $this->out->elementEnd('li');
     $this->out->elementStart('li');
     // TRANS: Form input field instructions.
     $instruction = _('URL of the homepage of this application');
     // TRANS: Form input field label.
     $this->out->input('source_url', _('Source URL'), $this->out->arg('source_url') ? $this->out->arg('source_url') : $source_url, $instruction);
     $this->out->elementEnd('li');
     $this->out->elementStart('li');
     // TRANS: Form input field instructions.
     $instruction = _('Organization responsible for this application');
     // TRANS: Form input field label.
     $this->out->input('organization', _('Organization'), $this->out->arg('organization') ? $this->out->arg('organization') : $organization, $instruction);
     $this->out->elementEnd('li');
     $this->out->elementStart('li');
     // TRANS: Form input field instructions.
     $instruction = _('URL for the homepage of the organization');
     // TRANS: Form input field label.
     $this->out->input('homepage', _('Homepage'), $this->out->arg('homepage') ? $this->out->arg('homepage') : $homepage, $instruction);
     $this->out->elementEnd('li');
     $this->out->elementStart('li');
     // TRANS: Form input field instructions.
     $instruction = _('URL to redirect to after authentication');
     // TRANS: Form input field label.
     $this->out->input('callback_url', 'Callback URL', $this->out->arg('callback_url') ? $this->out->arg('callback_url') : $callback_url, $instruction);
     $this->out->elementEnd('li');
     $this->out->elementStart('li', array('id' => 'application_types'));
     $attrs = array('name' => 'app_type', 'type' => 'radio', 'id' => 'app_type-browser', 'class' => 'radio', 'value' => Oauth_application::$browser);
     // Default to Browser
     if (empty($this->application) || empty($this->application->type) || $this->application->type == Oauth_application::$browser) {
         $attrs['checked'] = 'checked';
     }
     $this->out->element('input', $attrs);
     $this->out->element('label', array('for' => 'app_type-browser', 'class' => 'radio'), _('Browser'));
     $attrs = array('name' => 'app_type', 'type' => 'radio', 'id' => 'app_type-dekstop', 'class' => 'radio', 'value' => Oauth_application::$desktop);
     if (!empty($this->application) && $this->application->type == Oauth_application::$desktop) {
         $attrs['checked'] = 'checked';
     }
     $this->out->element('input', $attrs);
     $this->out->element('label', array('for' => 'app_type-desktop', 'class' => 'radio'), _('Desktop'));
     // TRANS: Form guide.
     $this->out->element('p', 'form_guide', _('Type of application, browser or desktop'));
     $this->out->elementEnd('li');
     $this->out->elementStart('li', array('id' => 'default_access_types'));
     $attrs = array('name' => 'default_access_type', 'type' => 'radio', 'id' => 'default_access_type-r', 'class' => 'radio', 'value' => 'r');
     // default to read-only access
     if (empty($this->application) || empty($this->application->access_type) || $this->application->access_type & Oauth_application::$readAccess) {
         $attrs['checked'] = 'checked';
     }
     $this->out->element('input', $attrs);
     $this->out->element('label', array('for' => 'default_access_type-ro', 'class' => 'radio'), _('Read-only'));
     $attrs = array('name' => 'default_access_type', 'type' => 'radio', 'id' => 'default_access_type-rw', 'class' => 'radio', 'value' => 'rw');
     if (!empty($this->application) && $this->application->access_type & Oauth_application::$readAccess && $this->application->access_type & Oauth_application::$writeAccess) {
         $attrs['checked'] = 'checked';
     }
     $this->out->element('input', $attrs);
     $this->out->element('label', array('for' => 'default_access_type-rw', 'class' => 'radio'), _('Read-write'));
     // TRANS: Form guide.
     $this->out->element('p', 'form_guide', _('Default access for this application: read-only, or read-write'));
     $this->out->elementEnd('li');
     $this->out->elementEnd('ul');
 }
Esempio n. 3
0
 function showUploadForm()
 {
     $user = common_current_user();
     $profile = $user->getProfile();
     if (!$profile) {
         common_log_db_error($user, 'SELECT', __FILE__);
         // TRANS: Error message displayed when referring to a user without a profile.
         $this->serverError(_('User has no profile.'));
         return;
     }
     $original = $this->group->original_logo;
     $this->elementStart('form', array('enctype' => 'multipart/form-data', 'method' => 'post', 'id' => 'form_settings_avatar', 'class' => 'form_settings', 'action' => common_local_url('grouplogo', array('nickname' => $this->group->nickname))));
     $this->elementStart('fieldset');
     // TRANS: Group logo form legend.
     $this->element('legend', null, _('Group logo'));
     $this->hidden('token', common_session_token());
     $this->elementStart('ul', 'form_data');
     if ($original) {
         $this->elementStart('li', array('id' => 'avatar_original', 'class' => 'avatar_view'));
         // TRANS: Uploaded original file in group logo form.
         $this->element('h2', null, _('Original'));
         $this->elementStart('div', array('id' => 'avatar_original_view'));
         $this->element('img', array('src' => $this->group->original_logo, 'alt' => $this->group->nickname));
         $this->elementEnd('div');
         $this->elementEnd('li');
     }
     if ($this->group->homepage_logo) {
         $this->elementStart('li', array('id' => 'avatar_preview', 'class' => 'avatar_view'));
         // TRANS: Header for preview of to be displayed group logo.
         $this->element('h2', null, _('Preview'));
         $this->elementStart('div', array('id' => 'avatar_preview_view'));
         $this->element('img', array('src' => $this->group->homepage_logo, 'width' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE, 'alt' => $this->group->nickname));
         $this->elementEnd('div');
         $this->elementEnd('li');
     }
     $this->elementStart('li', array('id' => 'settings_attach'));
     $this->element('input', array('name' => 'MAX_FILE_SIZE', 'type' => 'hidden', 'id' => 'MAX_FILE_SIZE', 'value' => ImageFile::maxFileSizeInt()));
     $this->element('input', array('name' => 'avatarfile', 'type' => 'file', 'id' => 'avatarfile'));
     $this->elementEnd('li');
     $this->elementEnd('ul');
     $this->elementStart('ul', 'form_actions');
     $this->elementStart('li');
     // TRANS: Submit button for uploading a group logo.
     $this->submit('upload', _('Upload'));
     $this->elementEnd('li');
     $this->elementEnd('ul');
     $this->elementEnd('fieldset');
     $this->elementEnd('form');
 }
Esempio n. 4
0
 static function maxFileSize()
 {
     $value = ImageFile::maxFileSizeInt();
     if ($value > 1024 * 1024) {
         return $value / (1024 * 1024) . _('MB');
     } else {
         if ($value > 1024) {
             return $value / 1024 . _('kB');
         } else {
             return $value;
         }
     }
 }
Esempio n. 5
0
 /**
  * Shows the design settings form
  *
  * @param Design $design a working design to show
  *
  * @return nothing
  */
 function showDesignForm($design)
 {
     $this->elementStart('form', array('method' => 'post', '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'));
     // TRANS: Fieldset legend on profile design page.
     $this->element('legend', null, _('Change background image'));
     $this->elementStart('ul', 'form_data');
     $this->elementStart('li');
     $this->element('input', array('name' => 'MAX_FILE_SIZE', 'type' => 'hidden', 'id' => 'MAX_FILE_SIZE', 'value' => ImageFile::maxFileSizeInt()));
     $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'));
     // TRANS: Instructions for form on profile design page.
     $this->element('p', 'form_guide', _('You can upload your personal ' . 'background image. The maximum file size is 2MB.'));
     $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'), _m('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'), _m('RADIO', 'Off'));
         // TRANS: Form guide for a set of radio buttons on the profile design page that will enable or disable
         // TRANS: use of the uploaded profile image.
         $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'));
     // TRANS: Fieldset legend on profile design page to change profile page colours.
     $this->element('legend', null, _('Change colours'));
     $this->elementStart('ul', 'form_data');
     try {
         $bgcolor = new WebColor($design->backgroundcolor);
         $this->elementStart('li');
         // TRANS: Label on profile design page for setting a profile page background colour.
         $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');
         // TRANS: Label on profile design page for setting a profile page content colour.
         $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');
         // TRANS: Label on profile design page for setting a profile page sidebar colour.
         $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');
         // TRANS: Label on profile design page for setting a profile page text colour.
         $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');
         // TRANS: Label on profile design page for setting a profile page links colour.
         $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');
     // TRANS: Button text on profile design page to immediately reset all colour settings to default.
     $this->submit('defaults', _('Use defaults'), 'submit form_action-default', 'defaults', _('Restore default designs'));
     $this->element('input', array('id' => 'settings_design_reset', 'type' => 'reset', 'value' => _m('BUTTON', 'Reset'), 'class' => 'submit form_action-primary', 'title' => _('Reset back to default')));
     // TRANS: Button text on profile design page to save settings.
     $this->submit('save', _m('BUTTON', 'Save'), 'submit form_action-secondary', 'save', _('Save design'));
     $this->elementEnd('fieldset');
     $this->elementEnd('form');
 }
Esempio n. 6
0
 function showUploadForm()
 {
     $user = common_current_user();
     $profile = $user->getProfile();
     if (!$profile) {
         common_log_db_error($user, 'SELECT', __FILE__);
         // TRANS: Error message displayed when referring to a user without a profile.
         $this->serverError(_('User has no profile.'));
         return;
     }
     $original = $profile->getOriginalAvatar();
     $this->elementStart('form', array('enctype' => 'multipart/form-data', 'method' => 'post', 'id' => 'form_settings_avatar', 'class' => 'form_settings', 'action' => common_local_url('avatarsettings')));
     $this->elementStart('fieldset');
     // TRANS: Avatar upload page form legend.
     $this->element('legend', null, _('Avatar settings'));
     $this->hidden('token', common_session_token());
     if (Event::handle('StartAvatarFormData', array($this))) {
         $this->elementStart('ul', 'form_data');
         if ($original) {
             $this->elementStart('li', array('id' => 'avatar_original', 'class' => 'avatar_view'));
             // TRANS: Header on avatar upload page for thumbnail of originally uploaded avatar (h2).
             $this->element('h2', null, _("Original"));
             $this->elementStart('div', array('id' => 'avatar_original_view'));
             $this->element('img', array('src' => $original->url, 'width' => $original->width, 'height' => $original->height, 'alt' => $user->nickname));
             $this->elementEnd('div');
             $this->elementEnd('li');
         }
         $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
         if ($avatar) {
             $this->elementStart('li', array('id' => 'avatar_preview', 'class' => 'avatar_view'));
             // TRANS: Header on avatar upload page for thumbnail of to be used rendition of uploaded avatar (h2).
             $this->element('h2', null, _("Preview"));
             $this->elementStart('div', array('id' => 'avatar_preview_view'));
             $this->element('img', array('src' => $avatar->url, 'width' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE, 'alt' => $user->nickname));
             $this->elementEnd('div');
             if (!empty($avatar->filename)) {
                 // TRANS: Button on avatar upload page to delete current avatar.
                 $this->submit('delete', _m('BUTTON', 'Delete'));
             }
             $this->elementEnd('li');
         }
         $this->elementStart('li', array('id' => 'settings_attach'));
         $this->element('input', array('name' => 'MAX_FILE_SIZE', 'type' => 'hidden', 'id' => 'MAX_FILE_SIZE', 'value' => ImageFile::maxFileSizeInt()));
         $this->element('input', array('name' => 'avatarfile', 'type' => 'file', 'id' => 'avatarfile'));
         $this->elementEnd('li');
         $this->elementEnd('ul');
         $this->elementStart('ul', 'form_actions');
         $this->elementStart('li');
         // TRANS: Button on avatar upload page to upload an avatar.
         $this->submit('upload', _m('BUTTON', 'Upload'));
         $this->elementEnd('li');
         $this->elementEnd('ul');
     }
     Event::handle('EndAvatarFormData', array($this));
     $this->elementEnd('fieldset');
     $this->elementEnd('form');
 }
Esempio n. 7
0
 function setting($section, $key)
 {
     $result = common_config($section, $key);
     if ($key == 'file_quota') {
         // hack: adjust for the live upload limit
         if (common_config($section, 'uploads')) {
             $max = ImageFile::maxFileSizeInt();
         } else {
             $max = 0;
         }
         return min($result, $max);
     }
     return $result;
 }
Esempio n. 8
0
 /**
  * Data elements of the form
  *
  * @return void
  */
 function formData()
 {
     $this->out->elementStart('fieldset', array('id' => 'settings_design_logo'));
     $this->out->element('legend', null, _('Change logo'));
     $this->out->elementStart('ul', 'form_data');
     $this->li();
     $this->input('logo', _('Site logo'), 'Logo for the site (full URL)');
     $this->unli();
     $this->out->elementEnd('ul');
     $this->out->elementEnd('fieldset');
     $this->out->elementStart('fieldset', array('id' => 'settings_design_theme'));
     $this->out->element('legend', null, _('Change theme'));
     $this->out->elementStart('ul', 'form_data');
     $themes = Theme::listAvailable();
     // XXX: listAvailable() can return an empty list if you
     // screw up your settings, so just in case:
     if (empty($themes)) {
         $themes = array('default', 'default');
     }
     asort($themes);
     $themes = array_combine($themes, $themes);
     $this->li();
     $this->out->dropdown('theme', _('Site theme'), $themes, _('Theme for the site.'), false, $this->value('theme'));
     $this->unli();
     $this->out->elementEnd('ul');
     $this->out->elementEnd('fieldset');
     $design = $this->out->design;
     $this->out->elementStart('fieldset', array('id' => 'settings_design_background-image'));
     $this->out->element('legend', null, _('Change background image'));
     $this->out->elementStart('ul', 'form_data');
     $this->li();
     $this->out->element('label', array('for' => 'design_background-image_file'), _('Background'));
     $this->out->element('input', array('name' => 'design_background-image_file', 'type' => 'file', 'id' => 'design_background-image_file'));
     $this->out->element('p', 'form_guide', sprintf(_('You can upload a background image for the site. ' . 'The maximum file size is %1$s.'), ImageFile::maxFileSize()));
     $this->out->element('input', array('name' => 'MAX_FILE_SIZE', 'type' => 'hidden', 'id' => 'MAX_FILE_SIZE', 'value' => ImageFile::maxFileSizeInt()));
     $this->unli();
     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->unli();
         $this->li();
         $this->out->checkbox('design_background-image_repeat', _('Tile background image'), $design->disposition & BACKGROUND_TILE ? true : false);
         $this->unli();
     }
     $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->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->unli();
         $ccolor = new WebColor($design->contentcolor);
         $this->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->unli();
         $sbcolor = new WebColor($design->sidebarcolor);
         $this->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->unli();
         $tcolor = new WebColor($design->textcolor);
         $this->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->unli();
         $lcolor = new WebColor($design->linkcolor);
         $this->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->unli();
     } catch (WebColorException $e) {
         common_log(LOG_ERR, 'Bad color values in site design: ' . $e->getMessage());
     }
     $this->out->elementEnd('fieldset');
     $this->out->elementEnd('ul');
 }
Esempio n. 9
0
 static function maxFileSize()
 {
     $value = ImageFile::maxFileSizeInt();
     if ($value > 1024 * 1024) {
         $value = $value / (1024 * 1024);
         // TRANS: Number of megabytes. %d is the number.
         return sprintf(_m('%dMB', '%dMB', $value), $value);
     } else {
         if ($value > 1024) {
             $value = $value / 1024;
             // TRANS: Number of kilobytes. %d is the number.
             return sprintf(_m('%dkB', '%dkB', $value), $value);
         } else {
             // TRANS: Number of bytes. %d is the number.
             return sprintf(_m('%dB', '%dB', $value), $value);
         }
     }
 }
Esempio n. 10
0
 function showBackground()
 {
     $design = $this->out->design;
     $this->out->elementStart('fieldset', array('id' => 'settings_design_background-image'));
     // TRANS: Fieldset legend for theme background image.
     $this->out->element('legend', null, _('Change background image'));
     $this->out->elementStart('ul', 'form_data');
     $this->li();
     $this->out->element('input', array('name' => 'MAX_FILE_SIZE', 'type' => 'hidden', 'id' => 'MAX_FILE_SIZE', 'value' => ImageFile::maxFileSizeInt()));
     $this->out->element('label', array('for' => 'design_background-image_file'), _('Background'));
     $this->out->element('input', array('name' => 'design_background-image_file', 'type' => 'file', 'id' => 'design_background-image_file'));
     $this->out->element('p', 'form_guide', sprintf(_('You can upload a background image for the site. ' . 'The maximum file size is %1$s.'), ImageFile::maxFileSize()));
     $this->unli();
     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'));
         // TRANS: Form guide for turning background image on or off on theme designer page.
         $this->out->element('p', 'form_guide', _('Turn background image on or off.'));
         $this->unli();
         $this->li();
         $this->out->checkbox('design_background-image_repeat', _('Tile background image'), $design->disposition & BACKGROUND_TILE ? true : false);
         $this->unli();
     }
     $this->out->elementEnd('ul');
     $this->out->elementEnd('fieldset');
 }