From 42e945a42d9578da21dbd008b705677b482ea33f Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 13 Apr 2011 15:08:12 -0700 Subject: [PATCH] Style group directory output --- plugins/Directory/DirectoryPlugin.php | 2 +- plugins/Directory/actions/groupdirectory.php | 7 ++-- plugins/Directory/actions/userdirectory.php | 2 +- plugins/Directory/css/directory.css | 16 ++++---- plugins/Directory/lib/sortablegrouplist.php | 43 +++++--------------- 5 files changed, 24 insertions(+), 46 deletions(-) diff --git a/plugins/Directory/DirectoryPlugin.php b/plugins/Directory/DirectoryPlugin.php index fbc11fbede..921de71a1a 100644 --- a/plugins/Directory/DirectoryPlugin.php +++ b/plugins/Directory/DirectoryPlugin.php @@ -185,7 +185,7 @@ class DirectoryPlugin extends Plugin { if (in_array( $action->trimmed('action'), - array('userdirectory')) + array('userdirectory', 'groupdirectory')) ) { $action->cssLink($this->path('css/directory.css')); } diff --git a/plugins/Directory/actions/groupdirectory.php b/plugins/Directory/actions/groupdirectory.php index 0966dfac98..0bcc185670 100644 --- a/plugins/Directory/actions/groupdirectory.php +++ b/plugins/Directory/actions/groupdirectory.php @@ -199,7 +199,7 @@ class GroupdirectoryAction extends Action { $this->showForm(); - $this->elementStart('div', array('id' => 'group_directory')); + $this->elementStart('div', array('id' => 'profile_directory')); $alphaNav = new AlphaNav($this, false, false, array('0-9', 'All')); $alphaNav->show(); @@ -232,14 +232,13 @@ class GroupdirectoryAction extends Action $this->pagination( $this->page > 1, - $cnt > GROUPS_PER_PAGE, + $cnt > PROFILES_PER_PAGE, $this->page, 'groupdirectory', $args ); $this->elementEnd('div'); - } function showForm($error=null) @@ -281,7 +280,7 @@ class GroupdirectoryAction extends Action $limit = GROUPS_PER_PAGE + 1; if (isset($this->q)) { - + $order = 'user_group.created ASC'; if ($this->sort == 'nickname') { diff --git a/plugins/Directory/actions/userdirectory.php b/plugins/Directory/actions/userdirectory.php index 6532f03c02..b12d1171ea 100644 --- a/plugins/Directory/actions/userdirectory.php +++ b/plugins/Directory/actions/userdirectory.php @@ -199,7 +199,7 @@ class UserdirectoryAction extends Action { $this->showForm(); - $this->elementStart('div', array('id' => 'user_directory')); + $this->elementStart('div', array('id' => 'profile_directory')); $alphaNav = new AlphaNav($this, false, false, array('0-9', 'All')); $alphaNav->show(); diff --git a/plugins/Directory/css/directory.css b/plugins/Directory/css/directory.css index 14fd2ce23b..d49c28fe55 100644 --- a/plugins/Directory/css/directory.css +++ b/plugins/Directory/css/directory.css @@ -1,35 +1,35 @@ /* CSS file for the Directory plugin */ -div#user_directory div.alpha_nav { +div#profile_directory div.alpha_nav { overflow: hidden; width: 100%; text-align: center; } /* XXX: this needs serious CSS foo */ -div#user_directory div.alpha_nav > a { +div#profile_directory div.alpha_nav > a { border-left: 1px solid #000; padding-left: 2px; } -div#user_directory div.alpha_nav > a.first { +div#profile_directory div.alpha_nav > a.first { border-left: none; } -div#user_directory div.alpha_nav a:link { +div#profile_directory div.alpha_nav a:link { text-decoration: none; } -div#user_directory div.alpha_nav a:visited { +div#profile_directory div.alpha_nav a:visited { text-decoration: none; } -div#user_directory div.alpha_nav a:active { +div#profile_directory div.alpha_nav a:active { text-decoration: none; } -div#user_directory div.alpha_nav a:hover { +div#profile_directory div.alpha_nav a:hover { text-decoration: underline; color: blue; } -div#user_directory div.alpha_nav a.current { +div#profile_directory div.alpha_nav a.current { background-color:#9BB43E; } diff --git a/plugins/Directory/lib/sortablegrouplist.php b/plugins/Directory/lib/sortablegrouplist.php index 4f875ce2c3..db6bc1d068 100644 --- a/plugins/Directory/lib/sortablegrouplist.php +++ b/plugins/Directory/lib/sortablegrouplist.php @@ -58,7 +58,7 @@ class SortableGroupList extends SortableSubscriptionList function startList() { - $this->out->elementStart('table', array('class' => 'profile_list xoxo', 'border' => '1')); + $this->out->elementStart('table', array('class' => 'profile_list xoxo')); $this->out->elementStart('thead'); $this->out->elementStart('tr'); @@ -120,25 +120,6 @@ class SortableGroupList extends SortableSubscriptionList $this->out->elementStart('tbody'); } - function showProfiles() - { - $cnt = 0; - - while ($this->profile->fetch()) { - $cnt++; - if($cnt > PROFILES_PER_PAGE) { - break; - } - - $odd = ($cnt % 2 == 0); // for zebra striping - - $pli = $this->newListItem($this->profile, $odd); - $pli->show(); - } - - return $cnt; - } - function newListItem($profile, $odd) { return new SortableGroupListItem($profile, $this->owner, $this->action, $odd); @@ -188,13 +169,16 @@ class SortableGroupListItem extends SortableSubscriptionListItem $avatar = $this->profile->stream_logo; $aAttrs = $this->linkAttributes(); $this->out->elementStart('a', $aAttrs); - $this->out->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE), - 'class' => 'photo avatar', - 'width' => AVATAR_STREAM_SIZE, - 'height' => AVATAR_STREAM_SIZE, - 'alt' => - ($this->profile->fullname) ? $this->profile->fullname : - $this->profile->nickname)); + $this->out->element( + 'img', + array( + 'src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE), + 'class' => 'photo avatar', + 'width' => AVATAR_STREAM_SIZE, + 'height' => AVATAR_STREAM_SIZE, + 'alt' => ($this->profile->fullname) ? $this->profile->fullname : $this->profile->nickname + ) + ); $this->out->text(' '); $hasFN = (!empty($this->profile->fullname)) ? 'nickname' : 'fn nickname'; $this->out->elementStart('span', $hasFN); @@ -203,7 +187,6 @@ class SortableGroupListItem extends SortableSubscriptionListItem $this->out->elementEnd('a'); } - function endItem() { $this->out->elementEnd('tr'); @@ -266,8 +249,6 @@ class SortableGroupListItem extends SortableSubscriptionListItem function showJoinButton() { - $this->out->elementStart('td', 'entry_controls'); - $user = $this->owner; if ($user) { @@ -282,8 +263,6 @@ class SortableGroupListItem extends SortableSubscriptionListItem $jf->show(); } } - $this->out->elementEnd('td'); - } function showMemberCount()