summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-06-18 07:45:06 -0700
committerEvan Prodromou <evan@controlyourself.ca>2009-06-18 07:45:06 -0700
commit3a0c6d6c6d33bf343c832be3bc38ec85062588c4 (patch)
tree282137f4ac2b4d28bdbacd1052cb975dc6647385
parentba3a484a655f93329463465d224dfc6ae6494434 (diff)
parentc442b400b985cb9e30bf036007bcffc96807d5a3 (diff)
Merge branch '0.8.x' of git@gitorious.org:+laconica-developers/laconica/dev into 0.8.x
-rw-r--r--actions/blockedfromgroup.php2
-rw-r--r--actions/editgroup.php6
-rw-r--r--actions/groupblock.php17
-rw-r--r--actions/groupdesignsettings.php330
-rw-r--r--actions/grouplogo.php2
-rw-r--r--actions/groupmembers.php2
-rw-r--r--actions/showgroup.php5
-rw-r--r--actions/userdesignsettings.php208
-rw-r--r--classes/User_group.php7
-rwxr-xr-xclasses/laconica.ini1
-rw-r--r--db/laconica.sql1
-rw-r--r--lib/accountsettingsaction.php2
-rw-r--r--lib/attachmentlist.php36
-rw-r--r--lib/designsettings.php (renamed from actions/designsettings.php)129
-rw-r--r--lib/groupdesignaction.php87
-rw-r--r--lib/groupnav.php6
-rw-r--r--lib/router.php4
-rw-r--r--theme/base/css/display.css6
-rw-r--r--theme/default/css/display.css2
-rw-r--r--theme/identica/css/display.css2
-rw-r--r--theme/pigeonthoughts/css/base.css158
-rw-r--r--theme/pigeonthoughts/css/display.css125
22 files changed, 931 insertions, 207 deletions
diff --git a/actions/blockedfromgroup.php b/actions/blockedfromgroup.php
index 541ebcfd9..5c1eab354 100644
--- a/actions/blockedfromgroup.php
+++ b/actions/blockedfromgroup.php
@@ -41,7 +41,7 @@ if (!defined('LACONICA')) {
* @link http://laconi.ca/
*/
-class BlockedfromgroupAction extends Action
+class BlockedfromgroupAction extends GroupDesignAction
{
var $page = null;
diff --git a/actions/editgroup.php b/actions/editgroup.php
index 29a7bce43..6aa6f8b11 100644
--- a/actions/editgroup.php
+++ b/actions/editgroup.php
@@ -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()
{
diff --git a/actions/groupblock.php b/actions/groupblock.php
index 28685b1d5..93662da79 100644
--- a/actions/groupblock.php
+++ b/actions/groupblock.php
@@ -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');
}
diff --git a/actions/groupdesignsettings.php b/actions/groupdesignsettings.php
new file mode 100644
index 000000000..7270bc8f7
--- /dev/null
+++ b/actions/groupdesignsettings.php
@@ -0,0 +1,330 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Change user password
+ *
+ * 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 Settings
+ * @package Laconica
+ * @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/
+ */
+
+if (!defined('LACONICA')) {
+ exit(1);
+}
+
+require_once INSTALLDIR . '/lib/designsettings.php';
+
+class GroupDesignSettingsAction extends DesignSettingsAction
+{
+ var $group = null;
+
+ /**
+ * Prepare to run
+ */
+
+ function prepare($args)
+ {
+ parent::prepare($args);
+
+ if (!common_config('inboxes','enabled')) {
+ $this->serverError(_('Inboxes must be enabled for groups to work'));
+ return false;
+ }
+
+ if (!common_logged_in()) {
+ $this->clientError(_('You must be logged in to edit a group.'));
+ return false;
+ }
+
+ $nickname_arg = $this->trimmed('nickname');
+ $nickname = common_canonical_nickname($nickname_arg);
+
+ // Permanent redirect on non-canonical nickname
+
+ if ($nickname_arg != $nickname) {
+ $args = array('nickname' => $nickname);
+ common_redirect(common_local_url('groupdesignsettings', $args), 301);
+ return false;
+ }
+
+ if (!$nickname) {
+ $this->clientError(_('No nickname'), 404);
+ return false;
+ }
+
+ $groupid = $this->trimmed('groupid');
+
+ if ($groupid) {
+ $this->group = User_group::staticGet('id', $groupid);
+ } else {
+ $this->group = User_group::staticGet('nickname', $nickname);
+ }
+
+ if (!$this->group) {
+ $this->clientError(_('No such group'), 404);
+ return false;
+ }
+
+ $cur = common_current_user();
+
+ if (!$cur->isAdmin($this->group)) {
+ $this->clientError(_('You must be an admin to edit the group'), 403);
+ return false;
+ }
+
+ $this->submitaction = common_local_url('groupdesignsettings',
+ array('nickname' => $this->group->nickname));
+
+ return true;
+ }
+
+ /**
+ * A design for this action
+ *
+ * if the group attribute has been set, returns that group's
+ * design.
+ *
+ * @return Design a design object to use
+ */
+
+ function getDesign()
+ {
+
+ if (empty($this->group)) {
+ return null;
+ }
+
+ return $this->group->getDesign();
+ }
+
+ /**
+ * Title of the page
+ *
+ * @return string Title of the page
+ */
+
+ function title()
+ {
+ return _('Group design');
+ }
+
+ /**
+ * Instructions for use
+ *
+ * @return instructions for use
+ */
+
+ function getInstructions()
+ {
+ return _('Customize the way your group looks ' .
+ 'with a background image and a colour palette of your choice.');
+ }
+
+ /**
+ * Override to show group nav stuff
+ *
+ * @return nothing
+ */
+
+ function showLocalNav()
+ {
+ $nav = new GroupNav($this, $this->group);
+ $nav->show();
+ }
+
+ /**
+ * Get the design we want to edit
+ *
+ * @return Design
+ */
+
+ function getWorkingDesign() {
+
+ $design = null;
+
+ if (isset($this->group)) {
+ $design = $this->group->getDesign();
+ }
+
+ if (empty($design)) {
+ $design = $this->defaultDesign();
+ }
+
+ return $design;
+ }
+
+ /**
+ * Content area of the page
+ *
+ * Shows a form for changing the design
+ *
+ * @return void
+ */
+
+ function showContent()
+ {
+ $this->showDesignForm($this->getWorkingDesign());
+ }
+
+ /**
+ * Save or update the group'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;
+ }
+
+ $design = $this->group->getDesign();
+
+ if (!empty($design)) {
+
+ // update 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;
+ }
+
+ } else {
+
+ $this->group->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($this->group);
+ $this->group->design_id = $id;
+ $result = $this->group->update($original);
+
+ if (empty($result)) {
+ common_log_db_error($original, 'UPDATE', __FILE__);
+ $this->showForm(_('Unable to save your design settings!'));
+ $this->group->query('ROLLBACK');
+ return;
+ }
+
+ $this->group->query('COMMIT');
+
+ }
+
+ $this->saveBackgroundImage($design);
+
+ $this->showForm(_('Design preferences saved.'), true);
+ }
+
+ /**
+ * Handle input and output a page (overrided)
+ *
+ * @param array $args $_REQUEST arguments
+ *
+ * @return void
+ */
+
+ function handle($args)
+ {
+ parent::handle($args);
+ if (!common_logged_in()) {
+ $this->clientError(_('Not logged in.'));
+ return;
+ } else if (!common_is_real_login()) {
+ // Cookie theft means that automatic logins can't
+ // change important settings or see private info, and
+ // _all_ our settings are important
+ common_set_returnto($this->selfUrl());
+ $user = common_current_user();
+ if ($user->hasOpenID()) {
+ common_redirect(common_local_url('openidlogin'), 303);
+ } else {
+ common_redirect(common_local_url('login'), 303);
+ }
+ } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
+ $this->handlePost();
+ } else {
+ $this->showForm();
+ }
+ }
+
+}
diff --git a/actions/grouplogo.php b/actions/grouplogo.php
index fe6127da2..8f6158dac 100644
--- a/actions/grouplogo.php
+++ b/actions/grouplogo.php
@@ -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;
diff --git a/actions/groupmembers.php b/actions/groupmembers.php
index abfad3f0d..d132cdf96 100644
--- a/actions/groupmembers.php
+++ b/actions/groupmembers.php
@@ -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;
diff --git a/actions/showgroup.php b/actions/showgroup.php
index 357f579d8..b6a0f4844 100644
--- a/actions/showgroup.php
+++ b/actions/showgroup.php
@@ -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;
diff --git a/actions/userdesignsettings.php b/actions/userdesignsettings.php
new file mode 100644
index 000000000..d6088aa9d
--- /dev/null
+++ b/actions/userdesignsettings.php
@@ -0,0 +1,208 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Change user password
+ *
+ * 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 Settings
+ * @package Laconica
+ * @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/
+ */
+
+if (!defined('LACONICA')) {
+ exit(1);
+}
+
+require_once INSTALLDIR . '/lib/designsettings.php';
+
+class UserDesignSettingsAction extends DesignSettingsAction
+{
+
+ function prepare($args)
+ {
+ parent::prepare($args);
+ $this->submitaction = common_local_url('userdesignsettings');
+ return true;
+ }
+
+ /**
+ * Title of the page
+ *
+ * @return string Title of the page
+ */
+
+ function title()
+ {
+ return _('Profile design');
+ }
+
+ /**
+ * Instructions for use
+ *
+ * @return instructions for use
+ */
+
+ function getInstructions()
+ {
+ return _('Customize the way your profile looks ' .
+ 'with a background image and a colour palette of your choice.');
+ }
+
+ /**
+ * Get the design we want to edit
+ *
+ * @return Design
+ */
+
+ function getWorkingDesign() {
+
+ $user = common_current_user();
+ $design = $user->getDesign();
+
+ if (empty($design)) {
+ $design = $this->defaultDesign();
+ }
+
+ return $design;
+ }
+
+ /**
+ * Content area of the page
+ *
+ * Shows a form for changing the design
+ *
+ * @return void
+ */
+
+ function showContent()
+ {
+ $this->showDesignForm($this->getWorkingDesign());
+ }
+
+ /**
+ * 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');
+
+ }
+
+ $this->saveBackgroundImage($design);
+
+ $this->showForm(_('Design preferences saved.'), true);
+ }
+}
diff --git a/classes/User_group.php b/classes/User_group.php
index 1a24124bb..8a56b9e52 100644
--- a/classes/User_group.php
+++ b/classes/User_group.php
@@ -19,6 +19,7 @@ class User_group extends Memcached_DataObject
public $homepage_logo; // varchar(255)
public $stream_logo; // varchar(255)
public $mini_logo; // varchar(255)
+ public $design_id; // int(4)
public $created; // datetime() not_null
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
@@ -239,4 +240,10 @@ class User_group extends Memcached_DataObject
}
return null;
}
+
+ function getDesign()
+ {
+ return Design::staticGet('id', $this->design_id);
+ }
+
}
diff --git a/classes/laconica.ini b/classes/laconica.ini
index 1a650aba5..5ced15885 100755
--- a/classes/laconica.ini
+++ b/classes/laconica.ini
@@ -468,6 +468,7 @@ original_logo = 2
homepage_logo = 2
stream_logo = 2
mini_logo = 2
+design_id = 1
created = 142
modified = 384
diff --git a/db/laconica.sql b/db/laconica.sql
index b018afec8..8d1d47d38 100644
--- a/db/laconica.sql
+++ b/db/laconica.sql
@@ -387,6 +387,7 @@ create table user_group (
homepage_logo varchar(255) comment 'homepage (profile) size logo',
stream_logo varchar(255) comment 'stream-sized logo',
mini_logo varchar(255) comment 'mini logo',
+ design_id integer comment 'id of a design' references design(id),
created datetime not null comment 'date this record was created',
modified timestamp comment 'date this record was modified',
diff --git a/lib/accountsettingsaction.php b/lib/accountsettingsaction.php
index 86800d2a3..4ab50abce 100644
--- a/lib/accountsettingsaction.php
+++ b/lib/accountsettingsaction.php
@@ -115,7 +115,7 @@ class AccountSettingsNav extends Widget
'openidsettings' =>
array(_('OpenID'),
_('Add or remove OpenIDs')),
- 'designsettings' =>
+ 'userdesignsettings' =>
array(_('Design'),
_('Design your profile')),
'othersettings' =>
diff --git a/lib/attachmentlist.php b/lib/attachmentlist.php
index e1726df28..c80c0c418 100644
--- a/lib/attachmentlist.php
+++ b/lib/attachmentlist.php
@@ -243,6 +243,42 @@ class AttachmentListItem extends Widget
class Attachment extends AttachmentListItem
{
+ function showLink() {
+ $this->out->elementStart('a', $this->linkAttr());
+ $this->out->element('span', null, $this->linkTitle());
+ $this->showRepresentation();
+ $this->out->elementEnd('a');
+
+ if (empty($this->oembed->author_name) && empty($this->oembed->provider)) {
+ return;
+ }
+
+ $this->out->elementStart('dl', 'oembed_info');
+
+ if (!empty($this->oembed->author_name)) {
+ $this->out->element('dt', null, _('Author:'));
+
+ $this->out->elementStart('dd');
+ if (empty($this->oembed->author_url)) {
+ $this->out->text($this->oembed->author_name);
+ } else {
+ $this->out->element('a', array('href' => $this->oembed->author_url), $this->oembed->author_name);
+ }
+ $this->out->elementEnd('dd');
+ }
+ if (!empty($this->oembed->provider)) {
+ $this->out->element('dt', null, _('Provider:'));
+ $this->out->elementStart('dd');
+ if (empty($this->oembed->provider_url)) {
+ $this->out->text($this->oembed->provider);
+ } else {
+ $this->out->element('a', array('href' => $this->oembed->provider_url), $this->oembed->provider);
+ }
+ $this->out->elementEnd('dd');
+ }
+ $this->out->elementEnd('dl');
+ }
+
function show() {
$this->showNoticeAttachment();
}
diff --git a/actions/designsettings.php b/lib/designsettings.php
index 047059e04..6aa6bb2f1 100644
--- a/actions/designsettings.php
+++ b/lib/designsettings.php
@@ -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);
}
}
diff --git a/lib/groupdesignaction.php b/lib/groupdesignaction.php
new file mode 100644
index 000000000..bc95921f1
--- /dev/null
+++ b/lib/groupdesignaction.php
@@ -0,0 +1,87 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Base class for actions that use the current user's 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 Action
+ * @package Laconica
+ * @author Zach Copley <zach@controlyourself.ca>
+ * @copyright 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/
+ */
+
+if (!defined('LACONICA')) {
+ exit(1);
+}
+
+/**
+ * Base class for actions that use a group's design
+ *
+ * Pages related to groups can be themed with a design.
+ * This superclass returns that design.
+ *
+ * @category Action
+ * @package Laconica
+ * @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 GroupDesignAction extends Action {
+
+ /** The group in question */
+ var $group = null;
+
+ /**
+ * Show the groups's design stylesheet
+ *
+ * @return nothing
+ */
+ function showStylesheets()
+ {
+ parent::showStylesheets();
+
+ $design = $this->getDesign();
+
+ if (!empty($design)) {
+ $design->showCSS($this);
+ }
+ }
+
+ /**
+ * A design for this action
+ *
+ * if the group attribute has been set, returns that group's
+ * design.
+ *
+ * @return Design a design object to use
+ */
+
+ function getDesign()
+ {
+
+ if (empty($this->group)) {
+ return null;
+ }
+
+ return $this->group->getDesign();
+ }
+
+}
diff --git a/lib/groupnav.php b/lib/groupnav.php
index 194247982..9e530c447 100644
--- a/lib/groupnav.php
+++ b/lib/groupnav.php
@@ -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');
}
diff --git a/lib/router.php b/lib/router.php
index 8b6f63618..1f39c60dc 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -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]+'));
diff --git a/theme/base/css/display.css b/theme/base/css/display.css
index d6ecef2fc..daf5ada1c 100644
--- a/theme/base/css/display.css
+++ b/theme/base/css/display.css
@@ -1284,3 +1284,9 @@ display:none;
.guide {
clear:both;
}
+
+dl.oembed_info dt,
+dl.oembed_info dd {
+display: inline;
+}
+
diff --git a/theme/default/css/display.css b/theme/default/css/display.css
index 881e264da..7e8b84b4c 100644
--- a/theme/default/css/display.css
+++ b/theme/default/css/display.css
@@ -244,7 +244,7 @@ div.notice-options a,
div.notice-options input {
font-family:sans-serif;
}
-.notices li:hover {
+#content .notices li:hover {
background-color:#FCFCFC;
}
#conversation .notices li:hover {
diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css
index ad57a0f0e..09ad4c972 100644
--- a/theme/identica/css/display.css
+++ b/theme/identica/css/display.css
@@ -244,7 +244,7 @@ div.notice-options a,
div.notice-options input {
font-family:sans-serif;
}
-.notices li:hover {
+#content .notices li:hover {
background-color:#FCFCFC;
}
#conversation .notices li:hover {
diff --git a/theme/pigeonthoughts/css/base.css b/theme/pigeonthoughts/css/base.css
index 08427d3c8..9866e2d2c 100644
--- a/theme/pigeonthoughts/css/base.css
+++ b/theme/pigeonthoughts/css/base.css
@@ -12,9 +12,9 @@ img { display:block; border:0; }
a abbr { cursor: pointer; border-bottom:0; }
table { border-collapse:collapse; }
ol { list-style-position:inside; }
-html { font-size: 87.5%; background-color:#fff; }
+html { font-size: 87.5%; }
body {
-background-color:#fff;
+background-color:#FFFFFF;
color:#000;
font-family:sans-serif;
font-size:1em;
@@ -78,7 +78,8 @@ margin:0 0 18px 0;
form label {
font-weight:bold;
}
-input.checkbox {
+input.checkbox,
+input.radio {
position:relative;
top:2px;
left:0;
@@ -155,7 +156,8 @@ font-weight:bold;
#form_invite legend,
#form_notice_delete legend,
#form_password_recover legend,
-#form_password_change legend {
+#form_password_change legend,
+.form_entity_block legend {
display:none;
}
@@ -181,13 +183,19 @@ margin-left:11px;
float:left;
width:90%;
}
-
+.form_settings label.radio {
+margin-top:0;
+margin-right:47px;
+margin-left:11px;
+width:auto;
+}
#form_login p.form_guide,
#form_register #settings_rememberme p.form_guide,
#form_openid_login #settings_rememberme p.form_guide,
#settings_twitter_remove p.form_guide,
-#form_search ul.form_data #q {
+#form_search ul.form_data #q,
+#design_background-image_onoff p.form_guide {
margin-left:0;
}
@@ -375,10 +383,10 @@ margin-bottom:1em;
}
#content {
-width:50.009%;
+width:49.009%;
min-height:259px;
float:left;
-margin-left:18px;
+padding:0 18px;
}
#shownotice #content {
min-height:0;
@@ -421,6 +429,8 @@ width:80.789%;
height:46px;
line-height:1.5;
padding:7px 7px 16px 7px;
+position:relative;
+z-index:2;
}
#form_notice label {
display:block;
@@ -428,8 +438,22 @@ float:left;
font-size:1.3em;
margin-bottom:7px;
}
-#form_notice #notice_submit label {
-display:none;
+#form_notice label[for=notice_data-attach],
+#form_notice #notice_data-attach {
+position:absolute;
+top:25px;
+cursor:pointer;
+}
+#form_notice label[for=notice_data-attach] {
+text-indent:-9999px;
+left:394px;
+width:16px;
+height:16px;
+}
+#form_notice #notice_data-attach {
+left:183px;
+padding:0;
+height:16px;
}
#form_notice .form_note {
position:absolute;
@@ -509,12 +533,15 @@ margin-bottom:4px;
.entity_profile .entity_nickname {
margin-left:11px;
display:inline;
-font-weight:bold;
}
.entity_profile .entity_nickname {
margin-left:0;
}
-
+.entity_profile .fn,
+.entity_profile .nickname {
+font-size:1.1em;
+font-weight:bold;
+}
.entity_profile .entity_fn dd:before {
content: "(";
font-weight:normal;
@@ -574,10 +601,13 @@ display:block;
.form_user_block input.submit,
.form_user_unblock input.submit,
+.form_group_block input.submit,
+.form_group_unblock input.submit,
.entity_send-a-message a,
.entity_edit a,
.form_user_nudge input.submit,
-.entity_nudge p {
+.entity_nudge p,
+.form_make_admin input.submit {
border:0;
padding-left:20px;
}
@@ -640,6 +670,7 @@ list-style-type:none;
float:left;
margin-right:7px;
margin-bottom:7px;
+display:inline;
}
.section .entities li .photo {
margin-right:0;
@@ -712,12 +743,17 @@ float:left;
width:96.41%;
border-width:1px;
border-style:solid;
-padding:1.795%;
margin-bottom:11px;
}
.notices li {
list-style-type:none;
}
+.notices .notices {
+margin-top:7px;
+margin-left:5%;
+width:95%;
+float:left;
+}
#aside_primary .notice,
#aside_primary .profile {
@@ -773,6 +809,9 @@ float:left;
width:100%;
overflow:hidden;
}
+.notice .entry-title.ov {
+overflow:visible;
+}
#shownotice .notice .entry-title {
font-size:2.2em;
}
@@ -797,7 +836,7 @@ clear:left;
float:left;
font-size:0.95em;
margin-left:59px;
-width:65%;
+width:60%;
}
#showstream .notice div.entry-content,
#shownotice .notice div.entry-content {
@@ -827,15 +866,12 @@ display:inline-block;
text-transform:lowercase;
}
-
.notice-options {
-padding-left:2%;
-float:left;
-width:50%;
position:relative;
font-size:0.95em;
-width:12.5%;
+width:90px;
float:right;
+margin-right:11px;
}
.notice-options a {
@@ -896,6 +932,74 @@ border:0;
padding:0;
}
+.notice .attachment {
+position:relative;
+padding-left:16px;
+}
+#attachments .attachment {
+padding-left:0;
+}
+.notice .attachment img {
+position:absolute;
+top:18px;
+left:0;
+z-index:99;
+}
+#shownotice .notice .attachment img {
+position:static;
+}
+
+#attachments {
+clear:both;
+float:left;
+width:100%;
+margin-top:18px;
+}
+#attachments dt {
+font-weight:bold;
+font-size:1.3em;
+margin-bottom:4px;
+}
+
+#attachments ol li {
+margin-bottom:18px;
+list-style-type:decimal;
+float:left;
+clear:both;
+}
+
+#jOverlayContent,
+#jOverlayContent #content,
+#jOverlayContent #content_inner {
+width: auto !important;
+margin-bottom:0;
+}
+#jOverlayContent #content {
+padding:11px;
+min-height:auto;
+}
+#jOverlayContent .external span {
+display:block;
+margin-bottom:11px;
+}
+#jOverlayContent button {
+position:absolute;
+top:0;
+right:0;
+width:29px;
+height:29px;
+text-align:center;
+font-weight:bold;
+padding:0;
+}
+#jOverlayContent h1 {
+max-width:475px;
+}
+#jOverlayContent #content {
+border-radius:7px;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+}
#usergroups #new_group {
float: left;
@@ -1019,8 +1123,6 @@ margin-left:18px;
}
-
-
/* TOP_POSTERS */
.section tbody td {
padding-right:11px;
@@ -1140,6 +1242,18 @@ width:400px;
margin-right:28px;
}
+#settings_design_color .form_data li {
+width:33%;
+}
+#settings_design_color .form_data label {
+float:none;
+display:block;
+}
+#settings_design_color .form_data .swatch {
+padding:11px;
+margin-left:0;
+}
+
.instructions ul {
list-style-position:inside;
}
diff --git a/theme/pigeonthoughts/css/display.css b/theme/pigeonthoughts/css/display.css
index af31cf78d..01af500bf 100644
--- a/theme/pigeonthoughts/css/display.css
+++ b/theme/pigeonthoughts/css/display.css
@@ -10,7 +10,7 @@
@import url(base.css);
html {
-background:#fff url(../images/illustrations/illu_pigeons-01.png) no-repeat 0 100%;
+background:url(../images/illustrations/illu_pigeons-01.png) no-repeat 0 100%;
}
body,
@@ -30,10 +30,10 @@ font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
}
input, textarea, select,
.entity_remote_subscribe {
-border-color:#aaa;
+border-color:#AAAAAA;
}
#filter_tags ul li {
-border-color:#ddd;
+border-color:#DDDDDD;
}
.form_settings input.form_action-primary {
@@ -50,35 +50,41 @@ background-color:#8F0000;
input:focus, textarea:focus, select:focus,
#form_notice.warning #notice_data-text {
border-color:#8F0000;
+box-shadow:3px 3px 3px rgba(194, 194, 194, 0.3);
+-moz-box-shadow:3px 3px 3px rgba(194, 194, 194, 0.3);
+-webkit-box-shadow:3px 3px 3px rgba(194, 194, 194, 0.3);
}
input.submit,
.entity_remote_subscribe {
-color:#fff;
+color:#FFFFFF;
}
a,
div.notice-options input,
.form_user_block input.submit,
.form_user_unblock input.submit,
+.form_group_block input.submit,
+.form_group_unblock input.submit,
.entity_send-a-message a,
.form_user_nudge input.submit,
.entity_nudge p,
-.form_settings input.form_action-primary {
-color:#000;
+.form_settings input.form_action-primary,
+.form_make_admin input.submit {
+color:#000000;
}
.notice,
.profile {
-border-color:#000;
+border-color:#000000;
}
.notice a,
.profile a {
-color:#fff;
+color:#FFFFFF;
}
.notice:nth-child(3n-1),
.profile:nth-child(3n-1) {
-border-color:#fff;
+border-color:#FFFFFF;
}
.notice:nth-child(3n-1) a,
.profile:nth-child(3n-1) a {
@@ -90,7 +96,7 @@ border-color:#7F1114;
}
.notice:nth-child(3n) a,
.profile:nth-child(3n) a {
-color:#000;
+color:#000000;
}
.aside .section .notice,
@@ -100,30 +106,30 @@ color:#000;
.aside .section .notice:nth-child(3n),
.aside .section .profile:nth-child(3n) {
background-color:transparent;
-color:#000;
+color:#000000;
}
.aside .section {
-border-color:#fff;
-background-color:#fff;
-color:#000;
+border-color:#FFFFFF;
+background-color:#FFFFFF;
+color:#000000;
}
.aside .section:nth-child(n) {
-border-color:#000;
-background-color:#000;
-color:#fff;
+border-color:#000000;
+background-color:#000000;
+color:#FFFFFF;
}
.aside .section:nth-child(3n-1) {
-border-color:#fff;
-background-color:#fff;
-color:#000;
+border-color:#FFFFFF;
+background-color:#FFFFFF;
+color:#000000;
}
.aside .section:nth-child(3n) {
background-color:#7F1114;
border-color:#7F1114;
-color:#000;
+color:#000000;
}
.aside .section a {
color:#7F1114;
@@ -132,7 +138,7 @@ color:#7F1114;
color:#7F1114;
}
.aside .section:nth-child(3n) a {
-color:#fff;
+color:#FFFFFF;
}
@@ -145,33 +151,43 @@ background:url(../images/illustrations/illu_pigeons-02.png) no-repeat 10% 100%;
}
#notice_text-count {
-color:#333;
+color:#333333;
}
#form_notice.warning #notice_text-count {
-color:#000;
+color:#000000;
+}
+#form_notice label[for=notice_data-attach] {
+background:transparent url(../../base/images/icons/twotone/green/clip-01.gif) no-repeat 0 45%;
+}
+#form_notice #notice_data-attach {
+opacity:0;
}
+
#form_notice.processing #notice_action-submit {
-background:#fff url(../../base/images/icons/icon_processing.gif) no-repeat 47% 47%;
+background:#FFFFFF url(../../base/images/icons/icon_processing.gif) no-repeat 47% 47%;
cursor:wait;
text-indent:-9999px;
}
#content,
#site_nav_local_views a {
-border-color:#fff;
+border-color:#FFFFFF;
}
#site_nav_local_views .current a {
background-color:rgba(143, 0, 0, 0.8);
-color:#fff;
+color:#FFFFFF;
}
#site_nav_local_views a {
-background-color:rgba(255, 255, 255, 0.3);
+background-color:rgba(255, 255, 255, 0.5);
}
#site_nav_local_views a:hover {
-background-color:#fff;
+background-color:rgba(255, 255, 255, 0.9);
color:#8F0000;
}
+#site_nav_local_views .current a {
+text-shadow: rgba(194,194,194,0.5) 1px 1px 1px;
+}
.error {
background-color:#F7E8E8;
@@ -181,7 +197,7 @@ background-color:#EFF3DC;
}
#anon_notice {
-color:#000;
+color:#000000;
}
@@ -204,7 +220,10 @@ background-image:url(../../base/images/icons/icon_foaf.gif);
.form_user_nudge input.submit,
.form_user_block input.submit,
.form_user_unblock input.submit,
-.entity_nudge p {
+.form_group_block input.submit,
+.form_group_unblock input.submit,
+.entity_nudge p,
+.form_make_admin input.submit {
background-position: 0 40%;
background-repeat: no-repeat;
background-color:transparent;
@@ -214,7 +233,7 @@ background-color:transparent;
.form_user_subscribe input.submit,
.form_user_unsubscribe input.submit {
background-color:#8F0000;
-color:#fff;
+color:#FFFFFF;
}
.form_user_unsubscribe input.submit,
.form_group_leave input.submit,
@@ -233,15 +252,22 @@ background-image:url(../../base/images/icons/twotone/green/quote.gif);
background-image:url(../../base/images/icons/twotone/green/mail.gif);
}
.form_user_block input.submit,
-.form_user_unblock input.submit {
+.form_user_unblock input.submit,
+.form_group_block input.submit,
+.form_group_unblock input.submit {
background-image:url(../../base/images/icons/twotone/green/shield.gif);
}
+.form_make_admin input.submit {
+background-image:url(../../base/images/icons/twotone/green/admin.gif);
+}
/* NOTICES */
-.notices li.over {
-background-color:#fcfcfc;
+.notice .attachment {
+background:transparent url(../../base/images/icons/twotone/green/clip-02.gif) no-repeat 0 45%;
+}
+#attachments .attachment {
+background:none;
}
-
.notice-options .notice_reply a,
.notice-options form input.submit {
background-color:transparent;
@@ -263,17 +289,36 @@ background:transparent url(../../base/images/icons/twotone/green/trash.gif) no-r
.notices div.notice-options {
opacity:0.4;
}
-.notices li.hover div.entry-content,
-.notices li.hover div.notice-options {
+.notices li:hover div.entry-content,
+.notices li:hover div.notice-options {
opacity:1;
}
div.entry-content {
-color:#333;
+color:#333333;
}
div.notice-options a,
div.notice-options input {
font-family:sans-serif;
}
+#content .notices li:hover {
+background-color:transparent;
+}
+#conversation .notices li:hover {
+background-color:transparent;
+}
+
+.notices .notices {
+background-color:rgba(200, 200, 200, 0.050);
+}
+.notices .notices .notices {
+background-color:rgba(200, 200, 200, 0.100);
+}
+.notices .notices .notices .notices {
+background-color:rgba(200, 200, 200, 0.150);
+}
+.notices .notices .notices .notices .notices {
+background-color:rgba(200, 200, 200, 0.300);
+}
/*END: NOTICES */
#new_group a {
@@ -283,7 +328,7 @@ background:transparent url(../../base/images/icons/twotone/green/news.gif) no-re
.pagination .nav_prev a,
.pagination .nav_next a {
background-repeat:no-repeat;
-border-color:#000;
+border-color:#000000;
}
.pagination .nav_prev a {
background-image:url(../../base/images/icons/twotone/green/arrow-left.gif);