diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-16 22:00:32 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-16 22:00:32 +0000 |
commit | e45c0d4a62e6bc0f5aa2cd0522987123a9b457c7 (patch) | |
tree | 06644a4bd5a764c8dda28cec6125ac5ead486e11 /mod/bookmarks/views/default | |
parent | 851b6f87d426ff60d21eeafd6d63ff241bb18b82 (diff) | |
download | elgg-e45c0d4a62e6bc0f5aa2cd0522987123a9b457c7.tar.gz elgg-e45c0d4a62e6bc0f5aa2cd0522987123a9b457c7.tar.bz2 |
Refs #2680. Bookmarks revamp, part 2.
git-svn-id: http://code.elgg.org/elgg/trunk@8264 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/bookmarks/views/default')
5 files changed, 110 insertions, 87 deletions
diff --git a/mod/bookmarks/views/default/forms/bookmarks/save.php b/mod/bookmarks/views/default/forms/bookmarks/save.php new file mode 100644 index 000000000..9b15b542f --- /dev/null +++ b/mod/bookmarks/views/default/forms/bookmarks/save.php @@ -0,0 +1,59 @@ +<?php +/** + * Edit / add a bookmark + * + * @package Bookmarks + */ + +// once elgg_view stops throwing all sorts of junk into $vars, we can use +$title = elgg_extract('title', $vars, ''); +$desc = elgg_extract('description', $vars, ''); +$address = elgg_extract('address', $vars, ''); +$tags = elgg_extract('tags', $vars, ''); +$access_id = elgg_extract('access_id', $vars, ACCESS_DEFAULT); +$container_guid = elgg_extract('container_guid', $vars); +$guid = elgg_extract('guid', $vars, null); +$shares = elgg_extract('shares', $vars, array()); + +?> +<div> + <label><?php echo elgg_echo('title'); ?></label><br /> + <?php echo elgg_view('input/text', array('name' => 'title', 'value' => $title)); ?> +</div> +<div> + <label><?php echo elgg_echo('bookmarks:address'); ?></label><br /> + <?php echo elgg_view('input/text', array('name' => 'address', 'value' => $address)); ?> +</div> +<div> + <label><?php echo elgg_echo('description'); ?></label> + <?php echo elgg_view('input/longtext', array('name' => 'description', 'value' => $desc)); ?> +</div> +<div> + <label><?php echo elgg_echo('tags'); ?></label> + <?php echo elgg_view('input/tags', array('name' => 'tags', 'value' => $tags)); ?> +</div> +<?php + +$categories = elgg_view('input/categories', $vars); +if ($categories) { + echo $categories; +} + +?> +<div> + <label><?php echo elgg_echo('access'); ?></label><br /> + <?php echo elgg_view('input/access', array('name' => 'access_id', 'value' => $access_id)); ?> +</div> +<div> +<?php + +echo elgg_view('input/hidden', array('name' => 'container_guid', 'value' => $container_guid)); + +if ($guid) { + echo elgg_view('input/hidden', array('name' => 'bookmark_guid', 'value' => $guid)); +} + +echo elgg_view('input/submit', array('value' => elgg_echo("save"))); + +?> +</div>
\ No newline at end of file diff --git a/mod/bookmarks/views/default/object/bookmarks.php b/mod/bookmarks/views/default/object/bookmarks.php index aa7694fb6..abb14ab1f 100644 --- a/mod/bookmarks/views/default/object/bookmarks.php +++ b/mod/bookmarks/views/default/object/bookmarks.php @@ -74,10 +74,12 @@ $bookmark_info HTML; } elseif (elgg_in_context('gallery')) { - echo '<div class="bookmarks-gallery-item">'; - echo "<h3>" . $bookmark->title . "</h3>"; - echo "<p class='subtitle'>$owner_link $date</p>"; - echo '</div>'; + echo <<<HTML +<div class="bookmarks-gallery-item"> + <h3>$bookmark->title</h3> + <p class='subtitle'>$owner_link $date</p> +</div> +HTML; } else { // brief view $url = $bookmark->address; diff --git a/mod/bookmarks/views/default/widgets/bookmarks/content.php b/mod/bookmarks/views/default/widgets/bookmarks/content.php new file mode 100644 index 000000000..5f9f469d1 --- /dev/null +++ b/mod/bookmarks/views/default/widgets/bookmarks/content.php @@ -0,0 +1,31 @@ +<?php +/** + * Elgg bookmarks widget + * + * @package Bookmarks + */ + +$max = (int) $vars['entity']->num_display; + +$options = array( + 'type' => 'object', + 'subtype' => 'bookmarks', + 'container_guid' => $vars['entity']->owner_guid, + 'limit' => $max, + 'full_view' => FALSE, + 'pagination' => FALSE, +); +$content = elgg_list_entities($options); + +echo $content; + +if ($content) { + $url = "pg/bookmarks/owner/" . elgg_get_page_owner_entity()->username; + $more_link = elgg_view('output/url', array( + 'href' => $url, + 'text' => elgg_echo('bookmarks:more'), + )); + echo "<span class=\"elgg-widget-more\">$more_link</span>"; +} else { + echo elgg_echo('bookmarks:none'); +} diff --git a/mod/bookmarks/views/default/widgets/bookmarks/edit.php b/mod/bookmarks/views/default/widgets/bookmarks/edit.php index edb6afdf2..f31b7660f 100644 --- a/mod/bookmarks/views/default/widgets/bookmarks/edit.php +++ b/mod/bookmarks/views/default/widgets/bookmarks/edit.php @@ -1,28 +1,24 @@ <?php /** * Elgg bookmark widget edit view - * - * @package ElggBookmarks + * + * @package Bookmarks */ // set default value -if (!isset($vars['entity']->num_display)) { - $vars['entity']->num_display = 4; +if (!isset($vars['entity']->max_display)) { + $vars['entity']->max_display = 4; } -?> -<p> - <?php echo elgg_echo('bookmarks:numbertodisplay'); ?>: - <select name="params[num_display]"> -<?php -for ($i=1; $i<=10; $i++) { - $selected = ''; - if ($vars['entity']->num_display == $i) { - $selected = "selected='selected'"; - } +$params = array( + 'name' => 'params[max_display]', + 'value' => $vars['entity']->max_display, + 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), +); +$dropdown = elgg_view('input/dropdown', $params); - echo " <option value='{$i}' $selected >{$i}</option>\n"; -} ?> - </select> -</p>
\ No newline at end of file +<div> + <?php echo elgg_echo('bookmarks:max_display'); ?>: + <?php echo $dropdown; ?> +</div> diff --git a/mod/bookmarks/views/default/widgets/bookmarks/view.php b/mod/bookmarks/views/default/widgets/bookmarks/view.php deleted file mode 100644 index 6a5c7476a..000000000 --- a/mod/bookmarks/views/default/widgets/bookmarks/view.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php //@todo JS 1.8: Remove inline JS, use elgg-toggle ?> -<script type="text/javascript"> -$(document).ready(function () { - $('a.share_more_info').click(function () { - $(this.parentNode).children("[class=share_desc]").slideToggle("fast"); - return false; - }); -}); /* end document ready function */ -</script> - -<?php - -//get the num of shares the user want to display -$num = $vars['entity']->num_display; - -//if no number has been set, default to 4 -if(!$num) - $num = 4; - -//grab the users bookmarked items -$shares = elgg_get_entities(array('types' => 'object', 'subtypes' => 'bookmarks', 'container_guid' => $vars['entity']->owner_guid, 'limit' => $num, 'offset' => 0)); - -if($shares){ - - foreach($shares as $s){ - - //get the owner - $owner = $s->getOwnerEntity(); - - //get the time - $friendlytime = elgg_view_friendly_time($s->time_created); - - //get the user icon - $icon = elgg_view( - "profile/icon", array( - 'entity' => $owner, - 'size' => 'tiny', - ) - ); - - //get the bookmark title - $info = "<p class=\"shares_title\"><a href=\"{$s->getURL()}\">{$s->title}</a></p>"; - - //get the user details - $info .= "<p class=\"shares_timestamp\"><small><a href=\"{$owner->getURL()}\">{$owner->name}</a> {$friendlytime}</small></p>"; - - //get the bookmark description - if($s->description) - $info .= "<a href=\"javascript:void(0);\" class=\"share_more_info\">".elgg_echo('bookmarks:more')."</a><br /><div class=\"share_desc\"><p>{$s->description}</p></div>"; - - //display - echo "<div class=\"shares_widget_wrapper\">"; - echo "<div class=\"shares_widget_icon\">" . $icon . "</div>"; - echo "<div class=\"shares_widget_content\">" . $info . "</div>"; - echo "</div>"; - - } - - $user_inbox = $vars['url'] . "pg/bookmarks/owner/" . page_owner_entity()->username; - echo "<div class=\"widget_more_wrapper\"><a href=\"{$user_inbox}\">".elgg_echo('bookmarks:morebookmarks')."</a></div>"; - -} - - -?>
\ No newline at end of file |