From df7ae7792a78e33d1cd31bc99ad34f4e0940eb21 Mon Sep 17 00:00:00 2001 From: Sem Date: Thu, 3 Nov 2011 21:18:37 +0100 Subject: Upgraded pagehandler. --- all.php | 44 ----------------------- browse.php | 49 ------------------------- edit.php | 43 ---------------------- friends.php | 45 ----------------------- index.php | 68 ----------------------------------- new.php | 49 ------------------------- pages/videolist/add.php | 49 +++++++++++++++++++++++++ pages/videolist/all.php | 44 +++++++++++++++++++++++ pages/videolist/browse.php | 49 +++++++++++++++++++++++++ pages/videolist/edit.php | 43 ++++++++++++++++++++++ pages/videolist/friends.php | 45 +++++++++++++++++++++++ pages/videolist/owner.php | 68 +++++++++++++++++++++++++++++++++++ pages/videolist/watch.php | 79 ++++++++++++++++++++++++++++++++++++++++ start.php | 87 +++++++++++++++++++++++++-------------------- watch.php | 79 ---------------------------------------- 15 files changed, 426 insertions(+), 415 deletions(-) delete mode 100644 all.php delete mode 100644 browse.php delete mode 100644 edit.php delete mode 100644 friends.php delete mode 100644 index.php delete mode 100644 new.php create mode 100644 pages/videolist/add.php create mode 100644 pages/videolist/all.php create mode 100644 pages/videolist/browse.php create mode 100644 pages/videolist/edit.php create mode 100644 pages/videolist/friends.php create mode 100644 pages/videolist/owner.php create mode 100644 pages/videolist/watch.php delete mode 100644 watch.php diff --git a/all.php b/all.php deleted file mode 100644 index caccd7c3e..000000000 --- a/all.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright Prateek Choudhary - */ - -// Render the video upload page -// Load Elgg engine -require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - -// Get the current page's owner -$page_owner = page_owner_entity(); -if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($_SESSION['guid']); -} - -$title = sprintf(elgg_echo("videolist:search")); -// get the filter menu -$friend_link = elgg_get_site_url() . "videolist/friends/" . $page_owner->username; -// Get objects -$area1 = elgg_view('page_elements/content_header', array('context' => "everyone", 'type' => 'videolist', 'friend_link' => $friend_link)); -set_input('show_viewtype', 'all'); -$area2 .= elgg_list_entities(array('types' => 'object', 'subtypes' => 'videolist', 'limit' => 10, 'full_view' => TRUE, 'view_type_toggle' => FALSE, 'pagination' => 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'); - -set_context('videolist'); -$body = elgg_view_layout('one_column_with_sidebar', $area1.$area2, $area3); - -// Finally draw the page -page_draw($title, $body); diff --git a/browse.php b/browse.php deleted file mode 100644 index 2392ef19a..000000000 --- a/browse.php +++ /dev/null @@ -1,49 +0,0 @@ - -* @copyright Prateek Choudhary -*/ - -require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - -//get videolist GUID -$container_guid = get_input('container'); -$parent_container = ""; -if(isset($container_guid) && !empty($container_guid)) { - $container_guid = explode(":", $container_guid); - - if ($container_guid[0] == "group") { - $container = get_entity($container_guid[1]); - set_page_owner($container->getGUID()); - $page_owner = page_owner_entity(); - set_context("groupsvideos"); - } else { - $page_owner = page_owner_entity(); - if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($_SESSION['guid']); - } - } -} - -elgg_push_breadcrumb(elgg_echo('videolist:find'), elgg_get_site_url()."videolist/all/"); -elgg_push_breadcrumb(elgg_echo("videolist:browsemenu")); - -$title = elgg_echo("videolist:browsemenu"); - -$area1 = elgg_view('navigation/breadcrumbs'); -$area1 .= elgg_view_title($title); -$area2 .= elgg_view("forms/browsetube"); - -// 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)); - -$body = elgg_view_layout('one_column_with_sidebar', $area1.$area2, $area3); - -page_draw($title, $body); diff --git a/edit.php b/edit.php deleted file mode 100644 index cc06dd9c4..000000000 --- a/edit.php +++ /dev/null @@ -1,43 +0,0 @@ -container_guid; - if (!empty($container_guid)) - if ($page_owner = get_entity($container_guid)) { - set_page_owner($container_guid->guid); - } - if (empty($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($_SESSION['guid']); - } - } - - if ($video_file->canEdit()) { - // set up breadcrumbs - 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(elgg_echo("videolist:edit"))); - - $area1 = elgg_view('navigation/breadcrumbs'); - $area1 .= elgg_view_title($title = elgg_echo('videolist:edit')); - $area2 = elgg_view("forms/edit",array('entity' => $video_file)); - $body = elgg_view_layout('one_column_with_sidebar', $area1.$area2, $area3); - page_draw(elgg_echo("videolist:edit"), $body); - } -} else { - forward(); -} - -?> diff --git a/friends.php b/friends.php deleted file mode 100644 index 8d90ae1a3..000000000 --- a/friends.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @copyright Prateek Choudhary - */ - -// Start engine -require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - -$page_owner = page_owner_entity(); -if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($page_owner->getGUID()); -} - -// get the filter menu -$friend_link = elgg_get_site_url() . "videolist/friends/" . $page_owner->username; -// get the filter menu -$area1 = elgg_view("page_elements/content_header", array('context' => "friends", 'type' => 'videolist', 'friend_link' => $friend_link)); - -// List videos -set_context('search'); -$area2 .= list_user_friends_objects($page_owner->getGUID(), 'videolist', 10, false, false); -set_context('videolist'); - -// include a view for plugins to extend -$area3 = elgg_view("videolist/sidebar", array("object_type" => 'videolist')); - -// fetch & display latest comments on friends 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'); - -// Format page -$body = elgg_view_layout('one_column_with_sidebar', $area1.$area2, $area3); - -// Draw it -echo page_draw(elgg_echo('videolist:friends'),$body); diff --git a/index.php b/index.php deleted file mode 100644 index 4ca5495e1..000000000 --- a/index.php +++ /dev/null @@ -1,68 +0,0 @@ - - * @copyright Prateek Choudhary - */ - -require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - -if (is_callable('group_gatekeeper')) group_gatekeeper(); - -$page_owner = page_owner_entity(); -if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($page_owner->getGUID()); -} - -//get videolist GUID -$container_guid = get_input('username'); -if(isset($container_guid) && !empty($container_guid)) { - $container_guid = explode(":", $container_guid); - - if ($container_guid[0] == "group") { - $container = get_entity($container_guid[1]); - set_context("groupsvideos"); - } -} - -elgg_push_breadcrumb(elgg_echo('videolist:find'), elgg_get_site_url()."videolist/all"); -elgg_push_breadcrumb(sprintf(elgg_echo("videolist:home"),$page_owner->name)); -$title = sprintf(elgg_echo("videolist:home"), "$owner->name"); - -//set videolist header -if(page_owner() == get_loggedin_userid()) { - // get the filter menu - $friend_link = elgg_get_site_url() . "videolist/friends/" . $page_owner->username; - $area1 .= elgg_view('page_elements/content_header', array('context' => "mine", 'type' => 'videolist', 'friend_link' => $friend_link)); -}elseif(page_owner_entity() instanceof ElggGroup){ - $area1 .= elgg_view('navigation/breadcrumbs'); - $area1 .= elgg_view('videolist/group_video_header'); -} else { - $area1 .= elgg_view('navigation/breadcrumbs'); - $area1 .= elgg_view('page_elements/content_header_member', array('type' => 'videolist')); -} - - -// 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'); - -// Get objects -$area2 = elgg_list_entities(array('types' => 'object', 'subtypes' => 'videolist', 'container_guids' => page_owner(), 'limit' => 10)); - -set_context('videolist'); -$body = elgg_view_layout('one_column_with_sidebar', $area1.$area2, $area3); - -// Finally draw the page -page_draw($title, $body); diff --git a/new.php b/new.php deleted file mode 100644 index 881fba6ff..000000000 --- a/new.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @copyright Prateek Choudhary - */ - -// Render the video upload page -// Load Elgg engine -require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); -gatekeeper(); - -//get videolist GUID -$container_guid = get_input('container'); -if(isset($container_guid) && !empty($container_guid)){ - $container_guid = explode(":", $container_guid); - if ($container_guid[0] == "group") { - $container = get_entity($container_guid[1]); - set_page_owner($container->getGUID()); - $page_owner = page_owner_entity(); - set_context("groupsvideos"); - set_input("container_guid", $container->getGUID()); - } else { - // Get the current page's owner - $page_owner = page_owner_entity(); - if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($_SESSION['guid']); - set_input("container_guid", $_SESSION['guid']); - } - } -} - -$title = sprintf(elgg_echo("videolist:add")); - -//set up breadcrumbs -elgg_push_breadcrumb(elgg_echo('videolist:all'), elgg_get_site_url()."videolist/all/"); -elgg_push_breadcrumb(elgg_echo("videolist:add")); - -$area1 = elgg_view('navigation/breadcrumbs'); -$area1 .= elgg_view('page_elements/content_header', array('context' => "action", 'type' => 'videolist')); -$area2 .= elgg_view("forms/add"); -$body = elgg_view_layout('one_column_with_sidebar', $area1 . $area2, $area3); - -page_draw($title, $body); diff --git a/pages/videolist/add.php b/pages/videolist/add.php new file mode 100644 index 000000000..881fba6ff --- /dev/null +++ b/pages/videolist/add.php @@ -0,0 +1,49 @@ + + * @copyright Prateek Choudhary + */ + +// Render the video upload page +// Load Elgg engine +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); +gatekeeper(); + +//get videolist GUID +$container_guid = get_input('container'); +if(isset($container_guid) && !empty($container_guid)){ + $container_guid = explode(":", $container_guid); + if ($container_guid[0] == "group") { + $container = get_entity($container_guid[1]); + set_page_owner($container->getGUID()); + $page_owner = page_owner_entity(); + set_context("groupsvideos"); + set_input("container_guid", $container->getGUID()); + } else { + // Get the current page's owner + $page_owner = page_owner_entity(); + if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($_SESSION['guid']); + set_input("container_guid", $_SESSION['guid']); + } + } +} + +$title = sprintf(elgg_echo("videolist:add")); + +//set up breadcrumbs +elgg_push_breadcrumb(elgg_echo('videolist:all'), elgg_get_site_url()."videolist/all/"); +elgg_push_breadcrumb(elgg_echo("videolist:add")); + +$area1 = elgg_view('navigation/breadcrumbs'); +$area1 .= elgg_view('page_elements/content_header', array('context' => "action", 'type' => 'videolist')); +$area2 .= elgg_view("forms/add"); +$body = elgg_view_layout('one_column_with_sidebar', $area1 . $area2, $area3); + +page_draw($title, $body); diff --git a/pages/videolist/all.php b/pages/videolist/all.php new file mode 100644 index 000000000..caccd7c3e --- /dev/null +++ b/pages/videolist/all.php @@ -0,0 +1,44 @@ + + * @copyright Prateek Choudhary + */ + +// Render the video upload page +// Load Elgg engine +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + +// Get the current page's owner +$page_owner = page_owner_entity(); +if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($_SESSION['guid']); +} + +$title = sprintf(elgg_echo("videolist:search")); +// get the filter menu +$friend_link = elgg_get_site_url() . "videolist/friends/" . $page_owner->username; +// Get objects +$area1 = elgg_view('page_elements/content_header', array('context' => "everyone", 'type' => 'videolist', 'friend_link' => $friend_link)); +set_input('show_viewtype', 'all'); +$area2 .= elgg_list_entities(array('types' => 'object', 'subtypes' => 'videolist', 'limit' => 10, 'full_view' => TRUE, 'view_type_toggle' => FALSE, 'pagination' => 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'); + +set_context('videolist'); +$body = elgg_view_layout('one_column_with_sidebar', $area1.$area2, $area3); + +// Finally draw the page +page_draw($title, $body); diff --git a/pages/videolist/browse.php b/pages/videolist/browse.php new file mode 100644 index 000000000..2392ef19a --- /dev/null +++ b/pages/videolist/browse.php @@ -0,0 +1,49 @@ + +* @copyright Prateek Choudhary +*/ + +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + +//get videolist GUID +$container_guid = get_input('container'); +$parent_container = ""; +if(isset($container_guid) && !empty($container_guid)) { + $container_guid = explode(":", $container_guid); + + if ($container_guid[0] == "group") { + $container = get_entity($container_guid[1]); + set_page_owner($container->getGUID()); + $page_owner = page_owner_entity(); + set_context("groupsvideos"); + } else { + $page_owner = page_owner_entity(); + if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($_SESSION['guid']); + } + } +} + +elgg_push_breadcrumb(elgg_echo('videolist:find'), elgg_get_site_url()."videolist/all/"); +elgg_push_breadcrumb(elgg_echo("videolist:browsemenu")); + +$title = elgg_echo("videolist:browsemenu"); + +$area1 = elgg_view('navigation/breadcrumbs'); +$area1 .= elgg_view_title($title); +$area2 .= elgg_view("forms/browsetube"); + +// 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)); + +$body = elgg_view_layout('one_column_with_sidebar', $area1.$area2, $area3); + +page_draw($title, $body); diff --git a/pages/videolist/edit.php b/pages/videolist/edit.php new file mode 100644 index 000000000..cc06dd9c4 --- /dev/null +++ b/pages/videolist/edit.php @@ -0,0 +1,43 @@ +container_guid; + if (!empty($container_guid)) + if ($page_owner = get_entity($container_guid)) { + set_page_owner($container_guid->guid); + } + if (empty($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($_SESSION['guid']); + } + } + + if ($video_file->canEdit()) { + // set up breadcrumbs + 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(elgg_echo("videolist:edit"))); + + $area1 = elgg_view('navigation/breadcrumbs'); + $area1 .= elgg_view_title($title = elgg_echo('videolist:edit')); + $area2 = elgg_view("forms/edit",array('entity' => $video_file)); + $body = elgg_view_layout('one_column_with_sidebar', $area1.$area2, $area3); + page_draw(elgg_echo("videolist:edit"), $body); + } +} else { + forward(); +} + +?> diff --git a/pages/videolist/friends.php b/pages/videolist/friends.php new file mode 100644 index 000000000..8d90ae1a3 --- /dev/null +++ b/pages/videolist/friends.php @@ -0,0 +1,45 @@ + + * @copyright Prateek Choudhary + */ + +// Start engine +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + +$page_owner = page_owner_entity(); +if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($page_owner->getGUID()); +} + +// get the filter menu +$friend_link = elgg_get_site_url() . "videolist/friends/" . $page_owner->username; +// get the filter menu +$area1 = elgg_view("page_elements/content_header", array('context' => "friends", 'type' => 'videolist', 'friend_link' => $friend_link)); + +// List videos +set_context('search'); +$area2 .= list_user_friends_objects($page_owner->getGUID(), 'videolist', 10, false, false); +set_context('videolist'); + +// include a view for plugins to extend +$area3 = elgg_view("videolist/sidebar", array("object_type" => 'videolist')); + +// fetch & display latest comments on friends 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'); + +// Format page +$body = elgg_view_layout('one_column_with_sidebar', $area1.$area2, $area3); + +// Draw it +echo page_draw(elgg_echo('videolist:friends'),$body); diff --git a/pages/videolist/owner.php b/pages/videolist/owner.php new file mode 100644 index 000000000..4ca5495e1 --- /dev/null +++ b/pages/videolist/owner.php @@ -0,0 +1,68 @@ + + * @copyright Prateek Choudhary + */ + +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + +if (is_callable('group_gatekeeper')) group_gatekeeper(); + +$page_owner = page_owner_entity(); +if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($page_owner->getGUID()); +} + +//get videolist GUID +$container_guid = get_input('username'); +if(isset($container_guid) && !empty($container_guid)) { + $container_guid = explode(":", $container_guid); + + if ($container_guid[0] == "group") { + $container = get_entity($container_guid[1]); + set_context("groupsvideos"); + } +} + +elgg_push_breadcrumb(elgg_echo('videolist:find'), elgg_get_site_url()."videolist/all"); +elgg_push_breadcrumb(sprintf(elgg_echo("videolist:home"),$page_owner->name)); +$title = sprintf(elgg_echo("videolist:home"), "$owner->name"); + +//set videolist header +if(page_owner() == get_loggedin_userid()) { + // get the filter menu + $friend_link = elgg_get_site_url() . "videolist/friends/" . $page_owner->username; + $area1 .= elgg_view('page_elements/content_header', array('context' => "mine", 'type' => 'videolist', 'friend_link' => $friend_link)); +}elseif(page_owner_entity() instanceof ElggGroup){ + $area1 .= elgg_view('navigation/breadcrumbs'); + $area1 .= elgg_view('videolist/group_video_header'); +} else { + $area1 .= elgg_view('navigation/breadcrumbs'); + $area1 .= elgg_view('page_elements/content_header_member', array('type' => 'videolist')); +} + + +// 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'); + +// Get objects +$area2 = elgg_list_entities(array('types' => 'object', 'subtypes' => 'videolist', 'container_guids' => page_owner(), 'limit' => 10)); + +set_context('videolist'); +$body = elgg_view_layout('one_column_with_sidebar', $area1.$area2, $area3); + +// Finally draw the page +page_draw($title, $body); diff --git a/pages/videolist/watch.php b/pages/videolist/watch.php new file mode 100644 index 000000000..4c92cc63b --- /dev/null +++ b/pages/videolist/watch.php @@ -0,0 +1,79 @@ + + * @copyright Prateek Choudhary + */ + +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + +// Get objects +$video_id = (int) get_input('video_id'); +$video = get_entity($video_id); + +// 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'); + + 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 .= "

".$title."

"; + if ($videos->canEdit()) { + $area1 .= "
+ getGUID()}\">".elgg_echo('edit').""; + + $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'))."
"; + } + $area1 .= "
"; + + // 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); +} else { + // video not found + $body = "

".elgg_echo('videolist:none:found')."

"; + $pagetitle = elgg_echo("video:none"); +} + +// Finally draw the page +page_draw($pagetitle, $body); diff --git a/start.php b/start.php index 2e371d8d1..724aad61d 100644 --- a/start.php +++ b/start.php @@ -71,49 +71,60 @@ function videolist_init() { } /** - * videolist page handler; allows the use of fancy URLs + * Dispatches blog pages. + * URLs take the form of + * All videos: videolist/all + * User's videos: videolist/owner/ + * Friends' videos: videolist/friends/ + * Video watch: videolist/watch// + * Video browse: videolist/browse + * New video: videolist/add/<guid> + * Edit video: videolist/edit/<guid>/<revision> + * Group videos: videolist/group/<guid>/all * - * @param array $page From the page_handler function - * @return true|false Depending on success + * Title is ignored + * + * @param array $page + * @return NULL */ function videolist_page_handler($page) { - if (isset($page[0])) { - switch($page[0]) { - case "owned": if (isset($page[1])) set_input('username',$page[1]); - @include(dirname(__FILE__) . "/index.php"); - break; - case "friends": @include(dirname(__FILE__) . "/friends.php"); - break; - case "search": @include(dirname(__FILE__) . "/all.php"); - break; - case "video": @include(dirname(__FILE__) . "/video.php"); - break; - case "new": if (isset($page[3])) set_input('add_videourl',$page[3]); - if (isset($page[5])) set_input('page',$page[5]); - if (isset($page[1])) set_input('container',$page[1]); - @include(dirname(__FILE__) . "/new.php"); - break; - case "watch": set_input('video_id',$page[1]); - @include(dirname(__FILE__) . "/watch.php"); - break; - case "browse": if (isset($page[1])) set_input('container',$page[1]); - @include(dirname(__FILE__) . "/browse.php"); - break; - default : if (isset($page[1])) set_input('username',$page[1]); - @include(dirname(__FILE__) . "/index.php"); - break; - } - // If the URL is just 'videolist/username', or just 'videolist/', load the standard index file - } else { - if (isset($page[1])) { - set_input('username',$page[1]); - } - - include(dirname(__FILE__) . "/index.php"); - return true; + + if (!isset($page[0])) { + $page[0] = 'all'; } - return false; + $videolist_dir = elgg_get_plugins_path() . 'videolist/pages/videolist'; + + $page_type = $page[0]; + switch ($page_type) { + case 'owner': + include "$videolist_dir/owner.php"; + break; + case 'friends': + include "$videolist_dir/friends.php"; + break; + case 'watch': + set_input('guid', $page[1]); + include "$videolist_dir/watch.php"; + break; + case 'add': + include "$videolist_dir/add.php"; + break; + case 'edit': + set_input('guid', $page[1]); + include "$videolist_dir/edit.php"; + break; + case 'browse': + include "$videolist_dir/browse.php"; + break; + case 'group': + include "$videolist_dir/owner.php"; + break; + case 'all': + default: + include "$videolist_dir/all.php"; + break; + } } diff --git a/watch.php b/watch.php deleted file mode 100644 index 4c92cc63b..000000000 --- a/watch.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php -/** - * Elgg Video Plugin - * This plugin allows users to create a library of youtube/vimeo/metacafe videos - * - * @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 - */ - -require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - -// Get objects -$video_id = (int) get_input('video_id'); -$video = get_entity($video_id); - -// 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'); - - 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>"; - - $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); -} else { - // video not found - $body = "<p class='margin_top'>".elgg_echo('videolist:none:found')."</p>"; - $pagetitle = elgg_echo("video:none"); -} - -// Finally draw the page -page_draw($pagetitle, $body); -- cgit v1.2.3