diff options
Diffstat (limited to 'mod/bookmarks/views/default/bookmarks/form.php')
-rw-r--r-- | mod/bookmarks/views/default/bookmarks/form.php | 234 |
1 files changed, 103 insertions, 131 deletions
diff --git a/mod/bookmarks/views/default/bookmarks/form.php b/mod/bookmarks/views/default/bookmarks/form.php index 94897d0b0..0052cccf9 100644 --- a/mod/bookmarks/views/default/bookmarks/form.php +++ b/mod/bookmarks/views/default/bookmarks/form.php @@ -1,139 +1,111 @@ <?php - /** - * Elgg bookmarks plugin form - * - * @package ElggBookmarks - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ - - // Have we been supplied with an entity? - if (isset($vars['entity'])) { - - $guid = $vars['entity']->getGUID(); - $title = $vars['entity']->title; - $description = $vars['entity']->description; - $address = $vars['entity']->address; - $tags = $vars['entity']->tags; - $access_id = $vars['entity']->access_id; - $shares = $vars['entity']->shares; - $owner = $vars['entity']->getOwnerEntity(); - $highlight = 'default'; - - } else { - - $guid = 0; - $title = get_input('title',""); - $description = ""; - $address = get_input('address',""); - $highlight = 'all'; - - if ($address == "previous") - $address = $_SERVER['HTTP_REFERER']; - $tags = array(); - - if (defined('ACCESS_DEFAULT')) - $access_id = ACCESS_DEFAULT; - else - $access_id = 0; - $shares = array(); - $owner = $vars['user']; - - } +/** + * Elgg bookmarks plugin form + * + * @package ElggBookmarks + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ +if(isset($vars['entity'])){ + $guid = $vars['entity']->guid; + $title = $vars['entity']->title; + $address = $vars['entity']->address; + $access_id = $vars['entity']->access_id; + $tags = $vars['entity']->tags; + $notes = $vars['entity']->description; + $url = "action/bookmarks/edit"; +}else{ + //set some variables + $guid = ''; + $title = get_input('title',""); + $address = get_input('address',""); + $notes = ''; + if ($address == "previous") + $address = $_SERVER['HTTP_REFERER']; + $tags = array(); + if(page_owner_entity() instanceof ElggGroup){ + //if in a group, set the access level to default to the group + $access_id = page_owner_entity()->group_acl; + }else{ + $access_id = get_default_access(get_loggedin_user()); + } + $owner = $vars['user']; + $url = "action/bookmarks/add"; +} ?> -<div class="contentWrapper"> - <form action="<?php echo $vars['url']; ?>action/bookmarks/add" method="post"> - <?php echo elgg_view('input/securitytoken'); ?> - <p> - <label> - <?php echo elgg_echo('title'); ?> - <?php - - echo elgg_view('input/text',array( - 'internalname' => 'title', - 'value' => $title, - )); - - ?> - </label> - </p> - <p> - <label> - <?php echo elgg_echo('bookmarks:address'); ?> - <?php - - echo elgg_view('input/url',array( - 'internalname' => 'address', - 'value' => $address, - )); - - ?> - </label> - </p> - <p class="longtext_editarea"> - <label> - <?php echo elgg_echo('description'); ?> - <br /> - <?php - - echo elgg_view('input/longtext',array( - 'internalname' => 'description', - 'value' => $description, - )); - - ?> - </label> - </p> - <p> - <label> - <?php echo elgg_echo('tags'); ?> - <?php - - echo elgg_view('input/tags',array( - 'internalname' => 'tags', - 'value' => $tags, - )); - - ?> - </label> - </p> +<form class="action" action="<?php echo $vars['url'] . $url; ?>" method="post"> + <?php echo elgg_view('input/securitytoken'); ?> + <p> + <label> + <?php echo elgg_echo('title'); ?> + <?php + echo elgg_view('input/text',array( + 'internalname' => 'title', + 'value' => $title, + )); + ?> + </label> + </p> + <p> + <label> + <?php echo elgg_echo('bookmarks:address'); ?> + <?php + echo elgg_view('input/url',array( + 'internalname' => 'address', + 'value' => $address, + )); + ?> + </label> + </p> + <p> + <label> + <?php echo elgg_echo('bookmarks:addnote'); ?> + <br /> <?php - //echo elgg_view('bookmarks/sharing',array('shares' => $shares, 'owner' => $owner)); - if ($friends = elgg_get_entities_from_relationship(array('relationship' => 'friend', 'relationship_guid' => $owner->getGUID(), 'inverse_relationship' => FALSE, 'type' => 'user', 'limit' => 9999))) { -?> - <p> - <label><?php echo elgg_echo("bookmarks:with"); ?></label><br /> -<?php - echo elgg_view('friends/picker',array('entities' => $friends, 'internalname' => 'shares', 'highlight' => $highlight)); -?> - </p> -<?php - } + echo elgg_view('input/text',array( + 'internalname' => 'notes', + 'value' => $notes, + )); ?> - <p> - <label> - <?php echo elgg_echo('access'); ?> - <?php - - echo elgg_view('input/access',array( - 'internalname' => 'access', - 'value' => $access_id, - )); - - ?> - </label> - </p> - <p> - <?php echo $vars['container_guid'] ? elgg_view('input/hidden', array('internalname' => 'container_guid', 'value' => $vars['container_guid'])) : ""; ?> - <input type="hidden" name="bookmark_guid" value="<?php echo $guid; ?>" /> - <input type="submit" value="<?php echo elgg_echo('save'); ?>" /> - </p> - - </form> -</div>
\ No newline at end of file + </label> + </p> + <p> + <label> + <?php echo elgg_echo('tags'); ?> + <?php + echo elgg_view('input/tags',array( + 'internalname' => 'tags', + 'value' => $tags, + )); + ?> + </label> + </p> + <p> + <label> + <?php echo elgg_echo('access'); ?> + <?php + //if it is a group, pull out the group access view + if(page_owner_entity() instanceof ElggGroup){ + $access_options = group_access_options(page_owner_entity()); + echo elgg_view('input/access', array('internalname' => 'access', + 'value' => $access_id, + 'options' => $access_options)); + }else{ + echo elgg_view('input/access', array('internalname' => 'access', + 'value' => $access_id)); + } + ?> + </label> + </p> + <p> + <?php echo $vars['container_guid'] ? elgg_view('input/hidden', array('internalname' => 'container_guid', 'value' => $vars['container_guid'])) : ""; ?> + <input type="hidden" value="<?php echo $guid; ?>" name="guid" /> + <input type="submit" onfocus="blur()" value="<?php echo elgg_echo('save'); ?>" /> + </p> +</form>
\ No newline at end of file |