]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2680. Added group profile bookmark widget. Fixed a problem editing bookmarks.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 17 Feb 2011 04:11:38 +0000 (04:11 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 17 Feb 2011 04:11:38 +0000 (04:11 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@8272 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/bookmarks/actions/bookmarks/edit.php [deleted file]
mod/bookmarks/start.php
mod/bookmarks/views/default/bookmarks/group_module.php [new file with mode: 0644]
mod/bookmarks/views/default/bookmarks/groupprofile_bookmarks.php [deleted file]
mod/bookmarks/views/default/forms/bookmarks/save.php

diff --git a/mod/bookmarks/actions/bookmarks/edit.php b/mod/bookmarks/actions/bookmarks/edit.php
deleted file mode 100644 (file)
index 87de1c5..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-/**
- * Elgg bookmarks edit action
- * 
- */
-       
-//set some required variables
-$guid = get_input('guid');
-$title = get_input('title');
-$address = get_input('address');
-$notes = get_input('notes');
-$access = get_input('access');
-$tags = get_input('tags');
-$tagarray = string_to_tag_array($tags);
-
-// Make sure we actually have permission to edit
-$bookmark = get_entity($guid);
-if ($bookmark->getSubtype() == "bookmarks" && $bookmark->canEdit()) {
-       $bookmark->title = $title;
-       $bookmark->description = $notes;
-       $bookmark->address = $address;
-       $bookmark->access_id = $access;
-       $bookmark->tags = $tagarray;
-       if ($bookmark->save()) {
-               system_message(elgg_echo('bookmarks:edit:success'));
-       } else {
-               system_message(elgg_echo('bookmarks:edit:fail'));
-       }
-}else{
-       system_message(elgg_echo('bookmarks:edit:fail'));
-}
-$account = get_entity($bookmark->container_guid);
-forward("pg/bookmarks/" . $account->username);
\ No newline at end of file
index 00a6406445489b36a14d9f132f75f98d8b9b110f..1fd9768a116907dcaae65ac1d37d8da9705fc3bf 100644 (file)
@@ -52,7 +52,7 @@ function bookmarks_init() {
 
        // Groups
        add_group_tool_option('bookmarks', elgg_echo('bookmarks:enablebookmarks'), true);
-       elgg_extend_view('groups/tool_latest', 'bookmarks/group_bookmarks');
+       elgg_extend_view('groups/tool_latest', 'bookmarks/group_module');
 }
 
 /**
diff --git a/mod/bookmarks/views/default/bookmarks/group_module.php b/mod/bookmarks/views/default/bookmarks/group_module.php
new file mode 100644 (file)
index 0000000..94204d7
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+/**
+ * List most recent bookmarks on group profile page
+ *
+ * @package Bookmarks
+ */
+
+$group = elgg_get_page_owner_entity();
+
+if ($group->bookmarks_enable == "no") {
+       return true;
+}
+
+$all_link = elgg_view('output/url', array(
+       'href' => "pg/bookmarks/group/$group->guid/owner",
+       'text' => elgg_echo('link:view:all'),
+));
+
+$header = "<span class=\"group-widget-viewall\">$all_link</span>";
+$header .= '<h3>' . elgg_echo('bookmarks:group') . '</h3>';
+
+elgg_push_context('widgets');
+$options = array(
+       'type' => 'object',
+       'subtype' => 'bookmarks',
+       'container_guid' => elgg_get_page_owner_guid(),
+       'limit' => 6,
+       'full_view' => false,
+       'pagination' => false,
+);
+$content = elgg_list_entities($options);
+elgg_pop_context();
+
+if (!$content) {
+       $content = '<p>' . elgg_echo('bookmarks:none') . '</p>';
+}
+
+$new_link = elgg_view('output/url', array(
+       'href' => "pg/bookmarks/add/$group->guid",
+       'text' => elgg_echo('bookmarks:add'),
+));
+$content .= "<span class='elgg-widget-more'>$new_link</span>";
+
+echo elgg_view_module('info', '', $content, array('header' => $header));
diff --git a/mod/bookmarks/views/default/bookmarks/groupprofile_bookmarks.php b/mod/bookmarks/views/default/bookmarks/groupprofile_bookmarks.php
deleted file mode 100644 (file)
index ad8095d..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-/**
- * List most recent bookmarks on group profile page
- */
-
-if ($vars['entity']->bookmarks_enable != 'no') {
-?>
-
-<div class="group_widget">
-<h2><?php echo elgg_echo('bookmarks:group'); ?></h2>
-<?php
-       $context = get_context();
-       set_context('search');
-       $content = elgg_list_entities(array('types' => 'object',
-                                                                               'subtypes' => 'bookmarks',
-                                                                               'container_guid' => $vars['entity']->guid,
-                                                                               'limit' => 5,
-                                                                               'full_view' => FALSE,
-                                                                               'pagination' => FALSE));
-       set_context($context);
-
-    if ($content) {
-               echo $content;
-
-               $more_url = "{$vars['url']}pg/bookmarks/owner/group:{$vars['entity']->guid}/";
-               echo "<div class=\"forum_latest\"><a href=\"$more_url\">" . elgg_echo('bookmarks:more') . "</a></div>";
-       } else {
-               echo "<div class=\"forum_latest\">" . elgg_echo("bookmarks:nogroup") . "</div>";
-       }
-?>
-</div>
-<?php
-}
\ No newline at end of file
index 9b15b542fe73bef570af480173ae714ce6875ee7..4930aacdb80142422251173b0b82c227a4af8f81 100644 (file)
@@ -50,7 +50,7 @@ if ($categories) {
 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/hidden', array('name' => 'guid', 'value' => $guid));
 }
 
 echo elgg_view('input/submit', array('value' => elgg_echo("save")));