Group theming.
This commit is contained in:
parent
dff43c03e4
commit
57274d21ba
|
@ -41,7 +41,7 @@ if (!defined('LACONICA')) {
|
|||
* @link http://laconi.ca/
|
||||
*/
|
||||
|
||||
class BlockedfromgroupAction extends Action
|
||||
class BlockedfromgroupAction extends GroupDesignAction
|
||||
{
|
||||
var $page = null;
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
* @package Laconica
|
||||
* @author Evan Prodromou <evan@controlyourself.ca>
|
||||
* @author Sarven Capadisli <csarven@controlyourself.ca>
|
||||
* @author Zach Copley <zach@controlyourself.ca>
|
||||
* @copyright 2008-2009 Control Yourself, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://laconi.ca/
|
||||
|
@ -40,14 +41,15 @@ if (!defined('LACONICA')) {
|
|||
* @category Group
|
||||
* @package Laconica
|
||||
* @author Evan Prodromou <evan@controlyourself.ca>
|
||||
* @author Zach Copley <zach@controlyourself.ca>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://laconi.ca/
|
||||
*/
|
||||
|
||||
class EditgroupAction extends Action
|
||||
class EditgroupAction extends GroupDesignAction
|
||||
{
|
||||
|
||||
var $msg;
|
||||
var $group = null;
|
||||
|
||||
function title()
|
||||
{
|
||||
|
|
|
@ -151,19 +151,17 @@ class GroupblockAction extends Action
|
|||
function areYouSureForm()
|
||||
{
|
||||
$id = $this->profile->id;
|
||||
$this->elementStart('form', array('id' => 'block-' . $id,
|
||||
'method' => 'post',
|
||||
'class' => 'form_settings form_entity_block',
|
||||
'action' => common_local_url('groupblock')));
|
||||
$this->elementStart('fieldset');
|
||||
$this->hidden('token', common_session_token());
|
||||
$this->element('legend', null, _('Block user'));
|
||||
$this->element('p', null,
|
||||
sprintf(_('Are you sure you want to block user "%s" from the group "%s"? '.
|
||||
'They will be removed from the group, unable to post, and '.
|
||||
'unable to subscribe to the group in the future.'),
|
||||
$this->profile->getBestName(),
|
||||
$this->group->getBestName()));
|
||||
$this->elementStart('form', array('id' => 'block-' . $id,
|
||||
'method' => 'post',
|
||||
'class' => 'block',
|
||||
'action' => common_local_url('groupblock')));
|
||||
$this->hidden('token', common_session_token());
|
||||
$this->hidden('blockto-' . $this->profile->id,
|
||||
$this->profile->id,
|
||||
'blockto');
|
||||
|
@ -175,9 +173,8 @@ class GroupblockAction extends Action
|
|||
$this->hidden($k, $v);
|
||||
}
|
||||
}
|
||||
$this->submit('form_action-no', _('No'), 'submit form_action-primary', 'no', _("Do not block this user from this group"));
|
||||
$this->submit('form_action-yes', _('Yes'), 'submit form_action-secondary', 'yes', _('Block this user from this group'));
|
||||
$this->elementEnd('fieldset');
|
||||
$this->submit('no', _('No'));
|
||||
$this->submit('yes', _('Yes'));
|
||||
$this->elementEnd('form');
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ define('MAX_ORIGINAL', 480);
|
|||
* @link http://laconi.ca/
|
||||
*/
|
||||
|
||||
class GrouplogoAction extends Action
|
||||
class GrouplogoAction extends GroupDesignAction
|
||||
{
|
||||
var $mode = null;
|
||||
var $imagefile = null;
|
||||
|
|
|
@ -44,7 +44,7 @@ require_once INSTALLDIR.'/lib/publicgroupnav.php';
|
|||
* @link http://laconi.ca/
|
||||
*/
|
||||
|
||||
class GroupmembersAction extends Action
|
||||
class GroupmembersAction extends GroupDesignAction
|
||||
{
|
||||
var $page = null;
|
||||
|
||||
|
|
|
@ -47,10 +47,9 @@ define('MEMBERS_PER_SECTION', 27);
|
|||
* @link http://laconi.ca/
|
||||
*/
|
||||
|
||||
class ShowgroupAction extends Action
|
||||
class ShowgroupAction extends GroupDesignAction
|
||||
{
|
||||
/** group we're viewing. */
|
||||
var $group = null;
|
||||
|
||||
/** page we're viewing. */
|
||||
var $page = null;
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ class AccountSettingsNav extends Widget
|
|||
'openidsettings' =>
|
||||
array(_('OpenID'),
|
||||
_('Add or remove OpenIDs')),
|
||||
'designsettings' =>
|
||||
'userdesignsettings' =>
|
||||
array(_('Design'),
|
||||
_('Design your profile')),
|
||||
'othersettings' =>
|
||||
|
|
|
@ -35,8 +35,11 @@ if (!defined('LACONICA')) {
|
|||
require_once INSTALLDIR . '/lib/accountsettingsaction.php';
|
||||
require_once INSTALLDIR . '/lib/webcolor.php';
|
||||
|
||||
class DesignsettingsAction extends AccountSettingsAction
|
||||
class DesignSettingsAction extends AccountSettingsAction
|
||||
{
|
||||
|
||||
var $submitaction = null;
|
||||
|
||||
/**
|
||||
* Title of the page
|
||||
*
|
||||
|
@ -60,29 +63,14 @@ class DesignsettingsAction extends AccountSettingsAction
|
|||
'with a background image and a colour palette of your choice.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Content area of the page
|
||||
*
|
||||
* Shows a form for changing the password
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showContent()
|
||||
function showDesignForm($design)
|
||||
{
|
||||
$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',
|
||||
'class' => 'form_settings',
|
||||
'action' =>
|
||||
common_local_url('designsettings')));
|
||||
'action' => $this->submitaction));
|
||||
$this->elementStart('fieldset');
|
||||
$this->hidden('token', common_session_token());
|
||||
|
||||
|
@ -370,108 +358,7 @@ class DesignsettingsAction extends AccountSettingsAction
|
|||
return $design;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save or update the user's design settings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function saveDesign()
|
||||
{
|
||||
try {
|
||||
|
||||
$bgcolor = new WebColor($this->trimmed('design_background'));
|
||||
$ccolor = new WebColor($this->trimmed('design_content'));
|
||||
$sbcolor = new WebColor($this->trimmed('design_sidebar'));
|
||||
$tcolor = new WebColor($this->trimmed('design_text'));
|
||||
$lcolor = new WebColor($this->trimmed('design_links'));
|
||||
|
||||
} catch (WebColorException $e) {
|
||||
$this->showForm($e->getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
$onoff = $this->arg('design_background-image_onoff');
|
||||
|
||||
$on = false;
|
||||
$off = false;
|
||||
$tile = false;
|
||||
|
||||
if ($onoff == 'on') {
|
||||
$on = true;
|
||||
} else {
|
||||
$off = true;
|
||||
}
|
||||
|
||||
$repeat = $this->boolean('design_background-image_repeat');
|
||||
|
||||
if ($repeat) {
|
||||
$tile = true;
|
||||
}
|
||||
|
||||
$user = common_current_user();
|
||||
$design = $user->getDesign();
|
||||
|
||||
if (!empty($design)) {
|
||||
|
||||
$original = clone($design);
|
||||
|
||||
$design->backgroundcolor = $bgcolor->intValue();
|
||||
$design->contentcolor = $ccolor->intValue();
|
||||
$design->sidebarcolor = $sbcolor->intValue();
|
||||
$design->textcolor = $tcolor->intValue();
|
||||
$design->linkcolor = $lcolor->intValue();
|
||||
$design->backgroundimage = $filepath;
|
||||
|
||||
$design->setDisposition($on, $off, $tile);
|
||||
|
||||
$result = $design->update($original);
|
||||
|
||||
if ($result === false) {
|
||||
common_log_db_error($design, 'UPDATE', __FILE__);
|
||||
$this->showForm(_('Couldn\'t update your design.'));
|
||||
return;
|
||||
}
|
||||
|
||||
// update design
|
||||
} else {
|
||||
|
||||
$user->query('BEGIN');
|
||||
|
||||
// save new design
|
||||
$design = new Design();
|
||||
|
||||
$design->backgroundcolor = $bgcolor->intValue();
|
||||
$design->contentcolor = $ccolor->intValue();
|
||||
$design->sidebarcolor = $sbcolor->intValue();
|
||||
$design->textcolor = $tcolor->intValue();
|
||||
$design->linkcolor = $lcolor->intValue();
|
||||
$design->backgroundimage = $filepath;
|
||||
|
||||
$design->setDisposition($on, $off, $tile);
|
||||
|
||||
$id = $design->insert();
|
||||
|
||||
if (empty($id)) {
|
||||
common_log_db_error($id, 'INSERT', __FILE__);
|
||||
$this->showForm(_('Unable to save your design settings!'));
|
||||
return;
|
||||
}
|
||||
|
||||
$original = clone($user);
|
||||
$user->design_id = $id;
|
||||
$result = $user->update($original);
|
||||
|
||||
if (empty($result)) {
|
||||
common_log_db_error($original, 'UPDATE', __FILE__);
|
||||
$this->showForm(_('Unable to save your design settings!'));
|
||||
$user->query('ROLLBACK');
|
||||
return;
|
||||
}
|
||||
|
||||
$user->query('COMMIT');
|
||||
|
||||
}
|
||||
function saveBackgroundImage($design) {
|
||||
|
||||
// Now that we have a Design ID we can add a file to the design.
|
||||
// XXX: This is an additional DB hit, but figured having the image
|
||||
|
@ -510,8 +397,6 @@ class DesignsettingsAction extends AccountSettingsAction
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$this->showForm(_('Design preferences saved.'), true);
|
||||
}
|
||||
|
||||
}
|
|
@ -113,6 +113,12 @@ class GroupNav extends Widget
|
|||
sprintf(_('Add or edit %s logo'), $nickname),
|
||||
$action_name == 'grouplogo',
|
||||
'nav_group_logo');
|
||||
$this->out->menuItem(common_local_url('groupdesignsettings', array('nickname' =>
|
||||
$nickname)),
|
||||
_('Design'),
|
||||
sprintf(_('Add or edit %s design'), $nickname),
|
||||
$action_name == 'groupdesignsettings',
|
||||
'nav_group_design');
|
||||
}
|
||||
$this->out->elementEnd('ul');
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ class Router
|
|||
// settings
|
||||
|
||||
foreach (array('profile', 'avatar', 'password', 'openid', 'im',
|
||||
'email', 'sms', 'twitter', 'design', 'other') as $s) {
|
||||
'email', 'sms', 'twitter', 'userdesign', 'other') as $s) {
|
||||
$m->connect('settings/'.$s, array('action' => $s.'settings'));
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ class Router
|
|||
array('nickname' => '[a-zA-Z0-9]+'));
|
||||
}
|
||||
|
||||
foreach (array('members', 'logo', 'rss') as $n) {
|
||||
foreach (array('members', 'logo', 'rss', 'designsettings') as $n) {
|
||||
$m->connect('group/:nickname/'.$n,
|
||||
array('action' => 'group'.$n),
|
||||
array('nickname' => '[a-zA-Z0-9]+'));
|
||||
|
|
Loading…
Reference in New Issue
Block a user