From 8942e3a445d6e4965fc46e08cb90bbfed17cd56a Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 23 Jan 2009 03:00:51 +0100 Subject: Add an action to show the list of the latest groups --- actions/groups.php | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 actions/groups.php (limited to 'actions/groups.php') diff --git a/actions/groups.php b/actions/groups.php new file mode 100644 index 000000000..154976f21 --- /dev/null +++ b/actions/groups.php @@ -0,0 +1,117 @@ +. + * + * @category Personal + * @package Laconica + * @author Evan Prodromou + * @author Sarven Capadisli + * @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/grouplist.php'; + +/** + * Latest groups + * + * Show the latest groups on the site + * + * @category Personal + * @package Laconica + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + */ + +class GroupsAction extends Action +{ + var $page = null; + var $profile = null; + + function title() + { + if ($this->page == 1) { + return _("Groups"); + } else { + return sprintf(_("Groups, page %d"), $this->page); + } + } + + function prepare($args) + { + parent::prepare($args); + $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; + return true; + } + + function handle($args) + { + parent::handle($args); + $this->showPage(); + } + + function showLocalNav() + { + $nav = new PublicGroupNav($this); + $nav->show(); + } + + function showPageNotice() + { + $notice = + sprintf(_('%%%%site.name%%%% groups let you find and talk with ' . + 'people of similar interests. After you join a group ' . + 'you can send messages to all other members using the ' . + 'syntax "!groupname". Don\'t see a group you like? Try ' . + '[searching for one](%%%%action.groupsearch%%%%) or ' . + '[start your own!](%%%%action.newgroup%%%%)')); + $this->elementStart('div', 'instructions'); + $this->raw(common_markup_to_html($notice)); + $this->elementEnd('div'); + } + + function showContent() + { + $this->element('a', array('href' => common_local_url('newgroup'), + 'id' => 'new_group'), + _('Create a new group')); + + $offset = ($this->page-1) * GROUPS_PER_PAGE; + $limit = GROUPS_PER_PAGE + 1; + + $groups = new User_group(); + $groups->orderBy('created DESC'); + $groups->limit($offset, $limit); + + if ($groups->find()) { + $gl = new GroupList($groups, null, $this); + $cnt = $gl->show(); + } + + $this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE, + $this->page, 'groups'); + } +} -- cgit v1.2.3-54-g00ecf From 6949cefa7f1649d2c466df2f3566c118be9d88cd Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 23 Jan 2009 03:03:17 +0100 Subject: add groups-by-posts section --- actions/groups.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'actions/groups.php') diff --git a/actions/groups.php b/actions/groups.php index 154976f21..206065d26 100644 --- a/actions/groups.php +++ b/actions/groups.php @@ -114,4 +114,10 @@ class GroupsAction extends Action $this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE, $this->page, 'groups'); } + + function showSections() + { + $gbp = new GroupsByPostsSection($this); + $gbp->show(); + } } -- cgit v1.2.3-54-g00ecf From ae0f2009d580200c6fa88890c79b003b802f810b Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 23 Jan 2009 03:07:03 +0100 Subject: Groups list by members --- actions/groups.php | 2 ++ lib/groupsbymemberssection.php | 78 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 lib/groupsbymemberssection.php (limited to 'actions/groups.php') diff --git a/actions/groups.php b/actions/groups.php index 206065d26..6faa497fc 100644 --- a/actions/groups.php +++ b/actions/groups.php @@ -119,5 +119,7 @@ class GroupsAction extends Action { $gbp = new GroupsByPostsSection($this); $gbp->show(); + $gbm = new GroupsByMembersSection($this); + $gbm->show(); } } diff --git a/lib/groupsbymemberssection.php b/lib/groupsbymemberssection.php new file mode 100644 index 000000000..4fa07a244 --- /dev/null +++ b/lib/groupsbymemberssection.php @@ -0,0 +1,78 @@ +. + * + * @category Widget + * @package Laconica + * @author Evan Prodromou + * @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); +} + +/** + * Groups with the most members section + * + * @category Widget + * @package Laconica + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + */ + +class GroupsByMembersSection extends GroupSection +{ + function getGroups() + { + $qry = 'SELECT user_group.*, count(*) as value ' . + 'FROM user_group JOIN group_member '. + 'ON user_group.id = group_member.group_id ' . + 'GROUP BY user_group.id ' . + 'ORDER BY value DESC '; + + $limit = GROUPS_PER_SECTION; + $offset = 0; + + if (common_config('db','type') == 'pgsql') { + $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; + } else { + $qry .= ' LIMIT ' . $offset . ', ' . $limit; + } + + $group = Memcached_DataObject::cachedQuery('User_group', + $qry, + 3600); + return $group; + } + + function title() + { + return _('Groups with most members'); + } + + function divId() + { + return 'top_groups_by_member'; + } +} -- cgit v1.2.3-54-g00ecf From 961c5af3cec8cf4fc3efe7e80b90ea69e6137cdd Mon Sep 17 00:00:00 2001 From: sarven Date: Fri, 23 Jan 2009 03:47:32 +0000 Subject: Anonymous notice --- actions/groups.php | 4 +++- actions/public.php | 2 +- actions/showstream.php | 2 +- theme/base/css/display.css | 18 ++++++++++++++++-- theme/base/css/initial_states.css | 1 - theme/identica/css/display.css | 13 +++++++++++++ 6 files changed, 34 insertions(+), 6 deletions(-) delete mode 100644 theme/base/css/initial_states.css (limited to 'actions/groups.php') diff --git a/actions/groups.php b/actions/groups.php index 6faa497fc..261f9b3aa 100644 --- a/actions/groups.php +++ b/actions/groups.php @@ -95,9 +95,11 @@ class GroupsAction extends Action function showContent() { + $this->elementStart('p', array('id' => 'new_group')); $this->element('a', array('href' => common_local_url('newgroup'), - 'id' => 'new_group'), + 'class' => 'more'), _('Create a new group')); + $this->elementEnd('p'); $offset = ($this->page-1) * GROUPS_PER_PAGE; $limit = GROUPS_PER_PAGE + 1; diff --git a/actions/public.php b/actions/public.php index 396b60e83..f5380589a 100644 --- a/actions/public.php +++ b/actions/public.php @@ -215,7 +215,7 @@ class PublicAction extends Action $m = _('This is %%site.name%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' . 'based on the Free Software [Laconica](http://laconi.ca/) tool. ' . '[Join now](%%action.register%%) to share notices about yourself with friends, family, and colleagues! ([Read more](%%doc.help%%))'); - $this->elementStart('div', 'anonymous'); + $this->elementStart('div', array('id' => 'anon_notice')); $this->raw(common_markup_to_html($m)); $this->elementEnd('div'); } diff --git a/actions/showstream.php b/actions/showstream.php index 3005cdd88..157ccdd0c 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -538,7 +538,7 @@ class ShowstreamAction extends Action 'based on the Free Software [Laconica](http://laconi.ca/) tool. ' . '[Join now](%%%%action.register%%%%) to follow **%s**\'s notices and many more! ([Read more](%%%%doc.help%%%%))'), $this->user->nickname, $this->user->nickname); - $this->elementStart('div', 'anonymous'); + $this->elementStart('div', array('id' => 'anon_notice')); $this->raw(common_markup_to_html($m)); $this->elementEnd('div'); } diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 5cafd8c1f..bc06c50ab 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -234,6 +234,22 @@ clear:both; margin-bottom:18px; } + +#anon_notice { +float:left; +width:432px; +padding:11px; +border-radius:7px; +-moz-border-radius:7px; +-webkit-border-radius:7px; +border-width:2px; +border-style:solid; +line-height:1.5; +font-size:1.1em; +font-weight:bold; +} + + #footer { float:left; width:64%; @@ -378,7 +394,6 @@ border-radius:7px; /*Start: FORM NOTICE*/ #form_notice { -width:384px; width:458px; float:left; position:relative; @@ -395,7 +410,6 @@ display:none; border-radius:7px; -moz-border-radius:7px; -webkit-border-radius:7px; -width:377px; width:370px; height:67px; line-height:1.5; diff --git a/theme/base/css/initial_states.css b/theme/base/css/initial_states.css deleted file mode 100644 index 8b1378917..000000000 --- a/theme/base/css/initial_states.css +++ /dev/null @@ -1 +0,0 @@ - diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css index 62086d74e..5088d7ac7 100644 --- a/theme/identica/css/display.css +++ b/theme/identica/css/display.css @@ -119,6 +119,19 @@ background-color:#F7E8E8; background-color:#EFF3DC; } + +#anon_notice { +background-color:#97BFD1; +color:#fff; +} + +#showstream #anon_notice { +background-color:#A9BF4F; +} + + + + #export_data li a { background-repeat:no-repeat; background-position:0 45%; -- cgit v1.2.3-54-g00ecf