From dd08cd1133ea8c82acfb7624efcf83571568ee42 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 13 May 2010 01:42:18 +0000 Subject: attempting to standardize riverdashboard plugin in similar manner as 1.7 branch revision [5943] git-svn-id: http://code.elgg.org/elgg/trunk@6021 36083f99-b078-4883-b0ff-0f9b5a30f544 --- .../views/default/river/item/list.php | 79 +++++---- .../views/default/river/item/wrapper.php | 186 +++++++++++---------- .../views/default/river/item/wrapper_classic.php | 20 +-- .../views/default/riverdashboard/container.php | 2 +- .../views/default/riverdashboard/ecml/activity.php | 2 +- .../views/default/riverdashboard/menu.php | 7 +- .../views/default/riverdashboard/nav.php | 33 ++-- .../views/default/riverdashboard/sitemessage.php | 117 ++++++------- .../views/default/riverdashboard/welcome.php | 8 +- .../views/default/settings/riverdashboard/edit.php | 3 +- 10 files changed, 224 insertions(+), 233 deletions(-) (limited to 'mod/riverdashboard/views') diff --git a/mod/riverdashboard/views/default/river/item/list.php b/mod/riverdashboard/views/default/river/item/list.php index e7e1a9c07..4c3e240ac 100644 --- a/mod/riverdashboard/views/default/river/item/list.php +++ b/mod/riverdashboard/views/default/river/item/list.php @@ -1,54 +1,53 @@ = $vars['limit']) { - break; - } +if (isset($vars['items']) && is_array($vars['items'])) { + + $i = 0; + if (!empty($vars['items'])) { + foreach($vars['items'] as $item) { + echo elgg_view_river_item($item); + $i++; + if ($i >= $vars['limit']) { + break; } } } +} - if ($vars['pagination'] !== false) { - $baseurl = $_SERVER['REQUEST_URI']; - $baseurl = $baseurl = preg_replace('/[\&\?]offset\=[0-9]*/',"",$baseurl); +if ($vars['pagination'] !== false) { + $baseurl = $_SERVER['REQUEST_URI']; + $baseurl = $baseurl = preg_replace('/[\&\?]offset\=[0-9]*/',"",$baseurl); - $nav = ''; + $nav = ''; - if (sizeof($vars['items']) > $vars['limit']) { - $newoffset = $vars['offset'] + $vars['limit']; - $urladdition = 'offset='.$newoffset; - if (substr_count($baseurl,'?')) { - $nexturl = $baseurl . '&' . $urladdition; - } else { - $nexturl=$baseurl . '?' . $urladdition; - } - - $nav .= '« ' . elgg_echo('previous') . ' '; + if (sizeof($vars['items']) > $vars['limit']) { + $newoffset = $vars['offset'] + $vars['limit']; + $urladdition = 'offset='.$newoffset; + if (substr_count($baseurl,'?')) { + $nexturl = $baseurl . '&' . $urladdition; + } else { + $nexturl=$baseurl . '?' . $urladdition; } - if ($vars['offset'] > 0) { - $newoffset = $vars['offset'] - $vars['limit']; - if ($newoffset < 0) { - $newoffset = 0; - } - $urladdition = 'offset='.$newoffset; - if (substr_count($baseurl,'?')) { - $prevurl=$baseurl . '&' . $urladdition; - } else { - $prevurl=$baseurl . '?' . $urladdition; - } + $nav .= '« ' . elgg_echo('previous') . ' '; + } - $nav .= '' . elgg_echo('next') . ' » '; + if ($vars['offset'] > 0) { + $newoffset = $vars['offset'] - $vars['limit']; + if ($newoffset < 0) { + $newoffset = 0; } - - if (!empty($nav)) { - echo ''; + $urladdition = 'offset='.$newoffset; + if (substr_count($baseurl,'?')) { + $prevurl=$baseurl . '&' . $urladdition; + } else { + $prevurl=$baseurl . '?' . $urladdition; } + + $nav .= '' . elgg_echo('next') . ' » '; + } + + if (!empty($nav)) { + echo ''; } -?> \ No newline at end of file +} diff --git a/mod/riverdashboard/views/default/river/item/wrapper.php b/mod/riverdashboard/views/default/river/item/wrapper.php index 7a3285382..8506262a8 100644 --- a/mod/riverdashboard/views/default/river/item/wrapper.php +++ b/mod/riverdashboard/views/default/river/item/wrapper.php @@ -12,10 +12,11 @@ $numoflikes = elgg_count_likes($object); //user //if displaying on the profile get the object owner, else the subject_guid -if(get_context() == 'profile' && $object->getSubtype() == 'thewire') +if (get_context() == 'profile' && $object->getSubtype() == 'thewire') { $user = get_entity($object->owner_guid); -else +} else { $user = get_entity($vars['item']->subject_guid); +} //count comment annotations $comment_count = count_annotations($vars['item']->object_guid, $vars['item']->type, $vars['item']->subtype, $annotation_comment); @@ -23,16 +24,17 @@ $comment_count = count_annotations($vars['item']->object_guid, $vars['item']->ty //get last three comments display $get_comments = get_annotations($vars['item']->object_guid, "", "", 'generic_comment', "", "", 3, 0, "desc"); -if($get_comments){ +if ($get_comments){ //reverse the array so we can display comments in the right order - $get_comments = array_reverse($get_comments); + $get_comments = array_reverse($get_comments); } //minus 3 off the comment total as we display 3 by default -if($comment_count < 3) +if ($comment_count < 3) { $num_comments = 0; -else +} else { $num_comments = $comment_count - 3; +} ?>
@@ -43,98 +45,98 @@ else // body contents, generated by the river view in each plugin echo $vars['body']; - //display latest 3 comments if there are any - if($get_comments){ - $counter = 0; - //$background = ""; - - echo "
"; - - if($comment_count <= 3) { - echo "Comments"; - } - - //display 'more comments' if there are any - if($num_comments != 0){ - echo "Comments (+{$num_comments} more)"; - } - - if($numoflikes != 0){ - echo elgg_view('likes/forms/display', array('entity' => $object)); - } - echo "
"; // close river_comments_tabs - - echo "
"; +//display latest 3 comments if there are any +if ($get_comments){ + $counter = 0; + //$background = ""; + + echo "
"; + + if ($comment_count <= 3) { + echo "Comments"; + } + + //display 'more comments' if there are any + if ($num_comments != 0) { + echo "Comments (+{$num_comments} more)"; + } + + if ($numoflikes != 0) { + echo elgg_view('likes/forms/display', array('entity' => $object)); + } + echo "
"; // close river_comments_tabs + + echo "
"; - if($numoflikes != 0){ - //show the users who liked the object - echo ""; - } + if ($numoflikes != 0) { + //show the users who liked the object + echo ""; + } - foreach($get_comments as $gc){ - //get the comment owner - $comment_owner = get_user($gc->owner_guid); - //get the comment owner's profile url - $comment_owner_url = $comment_owner->getURL(); - // color-code each of the 3 comments - if( ($counter == 2 && $comment_count >= 4) || ($counter == 1 && $comment_count == 2) || ($counter == 0 && $comment_count == 1) || ($counter == 2 && $comment_count == 3) ) - $alt = 'latest'; - else if( ($counter == 1 && $comment_count >= 4) || ($counter == 0 && $comment_count == 2) || ($counter == 1 && $comment_count == 3) ) + foreach ($get_comments as $gc) { + //get the comment owner + $comment_owner = get_user($gc->owner_guid); + //get the comment owner's profile url + $comment_owner_url = $comment_owner->getURL(); + // color-code each of the 3 comments + if( ($counter == 2 && $comment_count >= 4) || ($counter == 1 && $comment_count == 2) || ($counter == 0 && $comment_count == 1) || ($counter == 2 && $comment_count == 3) ) { + $alt = 'latest'; + } else if( ($counter == 1 && $comment_count >= 4) || ($counter == 0 && $comment_count == 2) || ($counter == 1 && $comment_count == 3) ) { $alt = 'penultimate'; - - //display comment - echo "
"; - echo ""; - echo elgg_view("profile/icon",array('entity' => $comment_owner, 'size' => 'tiny')); - echo ""; - //truncate comment to 150 characters - if(strlen($gc->value) > 150) { - $gc->value = substr($gc->value, 0, strpos($gc->value, ' ', 150)) . "…"; - } - $contents = strip_tags($gc->value); - echo "
"; - echo "" . $comment_owner->name . " " . parse_urls($contents); - echo "" . friendly_time($gc->time_created) . ""; - echo "
"; - $counter++; } - echo elgg_make_river_comment($object); - echo "
"; // close river_comments - } else { - // tab bar nav - for users that liked object - $numoflikes = elgg_count_likes($object); - - if ($vars['item']->type != 'user' && $numoflikes != 0) { - echo "
"; - } - if($numoflikes != 0){ - echo elgg_view('likes/forms/display', array('entity' => $object)); - } - if ($vars['item']->type != 'user' && $numoflikes != 0) { - echo "
"; // close river_comments_tabs - } - - if ($vars['item']->type != 'user') { - echo "
"; - } - if($numoflikes != 0){ - //show the users who liked the object - echo ""; - } - - // if there are no comments to display - // and this is not a user or a group discussion entry - include the inline comment form - if($vars['item']->type != 'user' && $vars['item']->subtype != 'groupforumtopic') { - echo elgg_make_river_comment($object); - } - if ($vars['item']->type != 'user') { - echo "
"; + //display comment + echo "
"; + echo ""; + echo elgg_view("profile/icon", array('entity' => $comment_owner, 'size' => 'tiny')); + echo ""; + //truncate comment to 150 characters + if (strlen($gc->value) > 150) { + $gc->value = substr($gc->value, 0, strpos($gc->value, ' ', 150)) . "…"; } + $contents = strip_tags($gc->value); + echo "
"; + echo "" . $comment_owner->name . " " . parse_urls($contents); + echo "" . friendly_time($gc->time_created) . ""; + echo "
"; + $counter++; + } + echo elgg_make_river_comment($object); + echo "
"; // close river_comments +} else { + // tab bar nav - for users that liked object + $numoflikes = elgg_count_likes($object); + + if ($vars['item']->type != 'user' && $numoflikes != 0) { + echo "
"; + } + if ($numoflikes != 0) { + echo elgg_view('likes/forms/display', array('entity' => $object)); } + if ($vars['item']->type != 'user' && $numoflikes != 0) { + echo "
"; // close river_comments_tabs + } + + if ($vars['item']->type != 'user') { + echo "
"; + } + if ($numoflikes != 0) { + //show the users who liked the object + echo ""; + } + + // if there are no comments to display + // and this is not a user or a group discussion entry - include the inline comment form + if ($vars['item']->type != 'user' && $vars['item']->subtype != 'groupforumtopic') { + echo elgg_make_river_comment($object); + } + if ($vars['item']->type != 'user') { + echo "
"; + } +} echo "
"; // close river_item_contents ?> \ No newline at end of file diff --git a/mod/riverdashboard/views/default/river/item/wrapper_classic.php b/mod/riverdashboard/views/default/river/item/wrapper_classic.php index abbed46d6..0a3c1da8f 100644 --- a/mod/riverdashboard/views/default/river/item/wrapper_classic.php +++ b/mod/riverdashboard/views/default/river/item/wrapper_classic.php @@ -9,14 +9,14 @@ */ ?>
- - get_entity($vars['item']->subject_guid), 'size' => 'small')); - ?> - -
- -
+ + get_entity($vars['item']->subject_guid), 'size' => 'small')); +?> + +
+ +
\ No newline at end of file diff --git a/mod/riverdashboard/views/default/riverdashboard/container.php b/mod/riverdashboard/views/default/riverdashboard/container.php index 67e277e99..7d72453d1 100644 --- a/mod/riverdashboard/views/default/riverdashboard/container.php +++ b/mod/riverdashboard/views/default/riverdashboard/container.php @@ -1,6 +1,6 @@ -