diff options
-rw-r--r-- | pages/videolist/watch.php | 91 | ||||
-rw-r--r-- | start.php | 58 | ||||
-rw-r--r-- | views/default/object/videolist_item.php | 7 |
3 files changed, 44 insertions, 112 deletions
diff --git a/pages/videolist/watch.php b/pages/videolist/watch.php index 4c92cc63b..fc9bd1a68 100644 --- a/pages/videolist/watch.php +++ b/pages/videolist/watch.php @@ -1,79 +1,36 @@ <?php /** - * Elgg Video Plugin - * This plugin allows users to create a library of youtube/vimeo/metacafe videos + * View a file * - * @package Elgg - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Prateek Choudhary <synapticfield@gmail.com> - * @copyright Prateek Choudhary + * @package ElggFile */ -require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); +$videolist_item = get_entity(get_input('guid')); -// Get objects -$video_id = (int) get_input('video_id'); -$video = get_entity($video_id); +elgg_set_page_owner_guid($videolist_item->container_guid); -// If we can get out the video corresponding to video_id object ... -if ($videos = get_entity($video_id)) { - set_page_owner($videos->container_guid); - $videos_container = get_entity($videos->container_guid); - // set up breadcrumbs - $page_owner = page_owner_entity(); - if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($page_owner->getGUID()); - } - elgg_push_breadcrumb(elgg_echo('videolist:all'), elgg_get_site_url()."videolist/all.php"); - elgg_push_breadcrumb(sprintf(elgg_echo("videolist:user"),$page_owner->name), elgg_get_site_url()."videolist/".$page_owner->username); - elgg_push_breadcrumb(sprintf($video->title)); - $area1 = elgg_view('navigation/breadcrumbs'); +$page_owner = elgg_get_page_owner_entity(); - if($videos_container->type == "group") { - set_context("groupsvideos"); - } - $page_owner = page_owner_entity(); - $pagetitle = sprintf(elgg_echo("videolist:home"),page_owner_entity()->name); - $title = $videos->title; - - $area1 .= "<div id='content_header' class='clearfloat'><div class='content_header_title'><h2>".$title."</h2></div>"; - if ($videos->canEdit()) { - $area1 .= "<div class='content_header_options'> - <a class='action_button' href=\"".elgg_get_site_url()."videolist/edit.php?video={$videos->getGUID()}\">".elgg_echo('edit')."</a>"; +elgg_push_breadcrumb(elgg_echo('videolist'), 'videolist/all'); - $area1 .= elgg_view('output/confirmlink',array( - 'href' => elgg_get_site_url() . "action/videolist/delete?video=" . $videos->getGUID(), - 'text' => elgg_echo('delete'), - 'is_action' => true, - 'confirm' => elgg_echo('document:delete:confirm'), - 'class' => 'action_button disabled'))."</div>"; - } - $area1 .= "</div>"; - - // Display it - $area2 .= elgg_view("object/watch",array( - 'entity' => $video_id, - 'entity_owner' => $page_owner, - 'full' => true - )); - - // include a view for plugins to extend - $area3 .= elgg_view("videolist/sidebar", array("object_type" => 'videolist')); - - // get the latest comments on all videos - $comments = get_annotations(0, "object", "videolist", "generic_comment", "", 0, 4, 0, "desc"); - $area3 .= elgg_view('annotation/latest_comments', array('comments' => $comments)); - - // tag-cloud display - $area3 .= display_tagcloud(0, 50, 'tags', 'object', 'videolist'); - - $body = elgg_view_layout("one_column_with_sidebar", $area1.$area2, $area3); +$crumbs_title = $page_owner->name; +if (elgg_instanceof($page_owner, 'group')) { + elgg_push_breadcrumb($crumbs_title, "videolist/group/$page_owner->guid/all"); } else { - // video not found - $body = "<p class='margin_top'>".elgg_echo('videolist:none:found')."</p>"; - $pagetitle = elgg_echo("video:none"); + elgg_push_breadcrumb($crumbs_title, "videolist/owner/$page_owner->username"); } -// Finally draw the page -page_draw($pagetitle, $body); +$title = $videolist_item->title; + +elgg_push_breadcrumb($title); + +$content = elgg_view_entity($videolist_item, array('full_view' => true)); +$content .= elgg_view_comments($videolist_item); + +$body = elgg_view_layout('content', array( + 'content' => $content, + 'title' => $title, + 'filter' => '', +)); + +echo elgg_view_page($title, $body); @@ -50,15 +50,15 @@ function videolist_init() { // Register a handler for delete videos elgg_register_event_handler('delete', 'videolist', 'videolist_delete_event_listener'); - elgg_register_event_handler('pagesetup','system','videolist_pagesetup'); + // Register entity type for search + elgg_register_entity_type('object', 'videolist_item'); + + // add a file link to owner blocks + elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'videolist_owner_block_menu'); elgg_register_event_handler('annotate','all','videolist_object_notifications'); elgg_register_plugin_hook_handler('object:notifications','object','videolist_object_notifications_intercept'); - // Register URL handler - elgg_register_entity_url_handler('object', 'videolist', 'video_url'); - elgg_register_entity_url_handler('object', 'watch', 'video_url'); - //register entity url handler elgg_register_entity_url_handler('object', 'videolist_item', 'videolist_url'); elgg_register_plugin_hook_handler('entity:icon:url', 'object', 'videolist_icon_url_override'); @@ -66,8 +66,6 @@ function videolist_init() { // Register entity type elgg_register_entity_type('object','videolist'); - elgg_register_plugin_hook_handler('profile_menu', 'profile', 'videolist_profile_menu'); - // register for embed elgg_register_plugin_hook_handler('embed_get_sections', 'all', 'videolist_embed_get_sections'); elgg_register_plugin_hook_handler('embed_get_items', 'videolist', 'videolist_embed_get_items'); @@ -137,30 +135,23 @@ function videolist_page_handler($page) { } } - -function videolist_pagesetup() { - $page_owner = elgg_get_page_owner_entity(); - - if ($page_owner instanceof ElggGroup && elgg_in_context("groups")) { - //add_submenu_item(sprintf(elgg_echo("videolist:group"), page_owner_entity()->name), elgg_get_site_url() . "videolist/owned/" . page_owner_entity()->username); - } else if (elgg_in_context("videolist")) { - /********************************************************************************************** - ****if user is OR is not registered user then show him following page menus to choose from - ***********************************************************************************************/ - /* - add_submenu_item(elgg_echo('videolist:home'),elgg_get_site_url()."videolist/". $page_owner->username); - - add_submenu_item(elgg_echo('videolist:new'),elgg_get_site_url()."videolist/new"); - - add_submenu_item(elgg_echo('videolist:find'),elgg_get_site_url()."videolist/search/"); - */ - } else if (elgg_get_context("group")) { - //add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), elgg_get_site_url() . "videolist/owned/" . page_owner_entity()->username); - if ($page_owner && $page_owner->canEdit()) { - //add_submenu_item(sprintf(elgg_echo('videolist:browsemenu'),page_owner_entity()->name), elgg_get_site_url() . "videolist/browse/". page_owner_entity()->username); - //add_submenu_item(sprintf(elgg_echo('videolist:new'),page_owner_entity()->name), elgg_get_site_url() . "videolist/new/". page_owner_entity()->username); +/** + * Add a menu item to the user ownerblock + */ +function videolist_owner_block_menu($hook, $type, $return, $params) { + if (elgg_instanceof($params['entity'], 'user')) { + $url = "videolist/owner/{$params['entity']->username}"; + $item = new ElggMenuItem('videolist', elgg_echo('videolist'), $url); + $return[] = $item; + } else { + if ($params['entity']->videolist_enable != "no") { + $url = "videolist/group/{$params['entity']->guid}/all"; + $item = new ElggMenuItem('videolist', elgg_echo('videolist:group'), $url); + $return[] = $item; } } + + return $return; } function video_url($entity) { @@ -217,15 +208,6 @@ function videolist_object_notifications_intercept($hook, $entity_type, $returnva return null; } -function videolist_profile_menu($hook, $entity_type, $return_value, $params) { - $return_value[] = array( - 'text' => elgg_echo('videolist'), - 'href' => elgg_get_site_url() . "videolist/owned/{$params['owner']->username}", - ); - - return $return_value; -} - /** * Register videolist as an embed type. diff --git a/views/default/object/videolist_item.php b/views/default/object/videolist_item.php index 2be1f2a9a..f2543dd19 100644 --- a/views/default/object/videolist_item.php +++ b/views/default/object/videolist_item.php @@ -61,12 +61,6 @@ if (elgg_in_context('widgets')) { if ($full && !elgg_in_context('gallery')) { - $title = $entity->title; - $url = $entity->video_url; - $video_id = $entity->video_id; - - $header = elgg_view_title($entity->title); - $content= elgg_view("videolist/watch/{$entity->videotype}", array( 'video_id' => $entity->video_id, 'width' => 600, @@ -87,7 +81,6 @@ if ($full && !elgg_in_context('gallery')) { $entity_info = elgg_view_image_block($owner_icon, $list_body); echo <<<HTML -$header $entity_info $body HTML; |