summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/apitimelinegroup.php2
-rw-r--r--actions/oauthconnectionssettings.php4
-rw-r--r--actions/showgroup.php5
-rw-r--r--actions/siteadminpanel.php4
-rw-r--r--actions/sitenoticeadminpanel.php201
-rw-r--r--actions/subscribers.php9
-rw-r--r--actions/usergroups.php30
7 files changed, 231 insertions, 24 deletions
diff --git a/actions/apitimelinegroup.php b/actions/apitimelinegroup.php
index d0af49844..e30a08fb5 100644
--- a/actions/apitimelinegroup.php
+++ b/actions/apitimelinegroup.php
@@ -140,7 +140,7 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
// @todo set all this Atom junk up inside the feed class
- $atom->setId($id);
+ #$atom->setId($id);
$atom->setTitle($title);
$atom->setSubtitle($subtitle);
$atom->setLogo($logo);
diff --git a/actions/oauthconnectionssettings.php b/actions/oauthconnectionssettings.php
index b1467f0d0..f125f4c63 100644
--- a/actions/oauthconnectionssettings.php
+++ b/actions/oauthconnectionssettings.php
@@ -99,7 +99,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction
$application = $profile->getApplications($offset, $limit);
- $cnt == 0;
+ $cnt = 0;
if (!empty($application)) {
$al = new ApplicationList($application, $user, $this, true);
@@ -112,7 +112,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction
$this->pagination($this->page > 1, $cnt > APPS_PER_PAGE,
$this->page, 'connectionssettings',
- array('nickname' => $this->user->nickname));
+ array('nickname' => $user->nickname));
}
/**
diff --git a/actions/showgroup.php b/actions/showgroup.php
index a1dc3865b..5704b13d1 100644
--- a/actions/showgroup.php
+++ b/actions/showgroup.php
@@ -300,8 +300,8 @@ class ShowgroupAction extends GroupDesignAction
$this->elementStart('div', 'entity_actions');
$this->element('h2', null, _('Group actions'));
$this->elementStart('ul');
+ $this->elementStart('li', 'entity_subscribe');
if (Event::handle('StartGroupSubscribe', array($this, $this->group))) {
- $this->elementStart('li', 'entity_subscribe');
$cur = common_current_user();
if ($cur) {
if ($cur->isMember($this->group)) {
@@ -312,10 +312,9 @@ class ShowgroupAction extends GroupDesignAction
$jf->show();
}
}
- $this->elementEnd('li');
Event::handle('EndGroupSubscribe', array($this, $this->group));
}
-
+ $this->elementEnd('li');
$this->elementEnd('ul');
$this->elementEnd('div');
}
diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php
index 8c8f8b374..4b29819b7 100644
--- a/actions/siteadminpanel.php
+++ b/actions/siteadminpanel.php
@@ -277,8 +277,8 @@ class SiteAdminPanelForm extends AdminForm
$this->unli();
$this->li();
- $this->out->dropdown('language', _('Language'),
- get_nice_language_list(), _('Default site language'),
+ $this->out->dropdown('language', _('Default language'),
+ get_nice_language_list(), _('Site language when autodetection from browser settings is not available'),
false, $this->value('language'));
$this->unli();
diff --git a/actions/sitenoticeadminpanel.php b/actions/sitenoticeadminpanel.php
new file mode 100644
index 000000000..613a2e96b
--- /dev/null
+++ b/actions/sitenoticeadminpanel.php
@@ -0,0 +1,201 @@
+<?php
+/**
+ * StatusNet, the distributed open-source microblogging tool
+ *
+ * Site notice administration panel
+ *
+ * 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 StatusNet
+ * @author Zach Copley <zach@status.net>
+ * @copyright 2010 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')) {
+ exit(1);
+}
+
+require_once INSTALLDIR.'/extlib/htmLawed/htmLawed.php';
+
+/**
+ * Update the site-wide notice text
+ *
+ * @category Admin
+ * @package StatusNet
+ * @author Zach Copley <zach@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 SitenoticeadminpanelAction extends AdminPanelAction
+{
+ /**
+ * Returns the page title
+ *
+ * @return string page title
+ */
+
+ function title()
+ {
+ return _('Site Notice');
+ }
+
+ /**
+ * Instructions for using this form.
+ *
+ * @return string instructions
+ */
+
+ function getInstructions()
+ {
+ return _('Edit site-wide message');
+ }
+
+ /**
+ * Show the site notice admin panel form
+ *
+ * @return void
+ */
+
+ function showForm()
+ {
+ $form = new SiteNoticeAdminPanelForm($this);
+ $form->show();
+ return;
+ }
+
+ /**
+ * Save settings from the form
+ *
+ * @return void
+ */
+
+ function saveSettings()
+ {
+ $siteNotice = $this->trimmed('site-notice');
+
+ // assert(all values are valid);
+ // This throws an exception on validation errors
+
+ $this->validate(&$siteNotice);
+
+ $config = new Config();
+
+ $result = Config::save('site', 'notice', $siteNotice);
+
+ if (!result) {
+ $this->ServerError(_("Unable to save site notice."));
+ }
+ }
+
+ function validate(&$siteNotice)
+ {
+ // Validate notice text
+
+ if (mb_strlen($siteNotice) > 255) {
+ $this->clientError(
+ _('Max length for the site-wide notice is 255 chars')
+ );
+ }
+
+ // scrub HTML input
+
+ $config = array(
+ 'safe' => 1,
+ 'deny_attribute' => 'id,style,on*'
+ );
+
+ $siteNotice = htmLawed($siteNotice, $config);
+ }
+}
+
+class SiteNoticeAdminPanelForm extends AdminForm
+{
+ /**
+ * ID of the form
+ *
+ * @return int ID of the form
+ */
+
+ function id()
+ {
+ return 'form_site_notice_admin_panel';
+ }
+
+ /**
+ * class of the form
+ *
+ * @return string class of the form
+ */
+
+ function formClass()
+ {
+ return 'form_settings';
+ }
+
+ /**
+ * Action of the form
+ *
+ * @return string URL of the action
+ */
+
+ function action()
+ {
+ return common_local_url('sitenoticeadminpanel');
+ }
+
+ /**
+ * Data elements of the form
+ *
+ * @return void
+ */
+
+ function formData()
+ {
+ $this->out->elementStart('ul', 'form_data');
+
+ $this->out->elementStart('li');
+ $this->out->textarea(
+ 'site-notice',
+ _('Site notice text'),
+ common_config('site', 'notice'),
+ _('Site-wide notice text (255 chars max; HTML okay)')
+ );
+ $this->out->elementEnd('li');
+
+ $this->out->elementEnd('ul');
+ }
+
+ /**
+ * Action elements
+ *
+ * @return void
+ */
+
+ function formActions()
+ {
+ $this->out->submit(
+ 'submit',
+ _('Save'),
+ 'submit',
+ null,
+ _('Save site notice')
+ );
+ }
+}
diff --git a/actions/subscribers.php b/actions/subscribers.php
index cd3e2ee5b..4bced6284 100644
--- a/actions/subscribers.php
+++ b/actions/subscribers.php
@@ -143,9 +143,12 @@ class SubscribersListItem extends SubscriptionListItem
function showActions()
{
$this->startActions();
- $this->showSubscribeButton();
- // Relevant code!
- $this->showBlockForm();
+ if (Event::handle('StartProfileListItemActionElements', array($this))) {
+ $this->showSubscribeButton();
+ // Relevant code!
+ $this->showBlockForm();
+ Event::handle('EndProfileListItemActionElements', array($this));
+ }
$this->endActions();
}
diff --git a/actions/usergroups.php b/actions/usergroups.php
index 97faabae6..29bda0a76 100644
--- a/actions/usergroups.php
+++ b/actions/usergroups.php
@@ -130,22 +130,26 @@ class UsergroupsAction extends OwnerDesignAction
_('Search for more groups'));
$this->elementEnd('p');
- $offset = ($this->page-1) * GROUPS_PER_PAGE;
- $limit = GROUPS_PER_PAGE + 1;
+ if (Event::handle('StartShowUserGroupsContent', array($this))) {
+ $offset = ($this->page-1) * GROUPS_PER_PAGE;
+ $limit = GROUPS_PER_PAGE + 1;
+
+ $groups = $this->user->getGroups($offset, $limit);
+
+ if ($groups) {
+ $gl = new GroupList($groups, $this->user, $this);
+ $cnt = $gl->show();
+ if (0 == $cnt) {
+ $this->showEmptyListMessage();
+ }
+ }
- $groups = $this->user->getGroups($offset, $limit);
+ $this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE,
+ $this->page, 'usergroups',
+ array('nickname' => $this->user->nickname));
- if ($groups) {
- $gl = new GroupList($groups, $this->user, $this);
- $cnt = $gl->show();
- if (0 == $cnt) {
- $this->showEmptyListMessage();
- }
+ Event::handle('EndShowUserGroupsContent', array($this));
}
-
- $this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE,
- $this->page, 'usergroups',
- array('nickname' => $this->user->nickname));
}
function showEmptyListMessage()