From 52255de580654f351205b19565be601bd4caaacb Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Fri, 26 Mar 2010 22:44:48 +0000 Subject: First pass at cleaning up videolist. --- views/default/forms/add.php | 322 +++++++++---------- views/default/forms/browsetube.php | 355 ++++++++++----------- views/default/forms/labels/googlevideos.php | 60 ++-- views/default/forms/labels/metacafe.php | 60 ++-- views/default/forms/labels/vimeo.php | 60 ++-- views/default/forms/labels/youtube.php | 60 ++-- views/default/object/videolist.php | 168 +++++----- views/default/object/watch.php | 59 ++-- views/default/river/object/videolist/annotate.php | 18 +- views/default/river/object/videolist/create.php | 33 +- views/default/staticvideo/index.php | 34 +- views/default/videolist/css.php | 270 ++++++++-------- views/default/videolist/groupprofile_videolist.php | 96 +++--- views/default/videolist/icon.php | 41 ++- views/default/videolist/notfound.php | 30 +- views/default/widgets/videolist_view/edit.php | 40 +-- views/default/widgets/videolist_view/view.php | 108 ++++--- 17 files changed, 881 insertions(+), 933 deletions(-) (limited to 'views/default') diff --git a/views/default/forms/add.php b/views/default/forms/add.php index b387731f8..f6d5ed4c2 100644 --- a/views/default/forms/add.php +++ b/views/default/forms/add.php @@ -1,176 +1,156 @@ - * @copyright Prateek Choudhary - */ +/** + * Elgg Video Plugin + * This plugin allows users to create a library of youtube/vimeo/metacafe videos + * @file - the add user interface + * @package Elgg + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Prateek Choudhary + * @copyright Prateek Choudhary + */ // Make sure we're logged in (send us to the front page if not) - gatekeeper(); - $page_owner = page_owner_entity(); - $error = array( - 'no-video' => 1 - ); - $error_msg = array( - 'no-video' => "Please enter a valid video url" - ); - - $container_guid = get_input("container_guid"); - set_page_owner($container_guid); - - $confirm_action = get_input('video_action'); - $guid = get_input('guid'); - $access_id = get_input('access_id'); - $title_videourl = get_input('title_videourl'); - $Pagecontainer = get_input('page'); - $get_addvideourl = get_input('add_videourl'); - $timestamp = time(); - $token = generate_action_token(time()); - if(!empty($get_addvideourl) && ($Pagecontainer == "youtube")) - $title_add_videourl = "http://www.youtube.com/watch?v=".$get_addvideourl; - else if(!empty($get_addvideourl) && ($Pagecontainer == "metacafe")) - $title_add_videourl = "http://www.metacafe.com/api/item/".$get_addvideourl; - else if(!empty($get_addvideourl) && ($Pagecontainer == "vimeo")) - $title_add_videourl = "http://vimeo.com/".$get_addvideourl; - else - $title_add_videourl = ""; - - - $tags = get_input('videolisttags'); - - function video_youtube_parse_url($url) - { - if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(youtube\.com\/)(.*)/', $url, $matches)) - { - return false; - } - - $domain = $matches[2] . $matches[3]; - $path = $matches[4]; - - if (!preg_match('/^(watch\?v=)([a-zA-Z0-9_-]*)(&.*)?$/',$path, $matches)) - { - return false; - } - - $hash = $matches[2]; - - - return $domain . 'v/' . $hash; - } - - function video_vimeo_parse_url($url) - { - if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(vimeo\.com\/)(.*)/', $url, $matches)) - { - return false; - } - - $domain = $matches[2] . $matches[3]; - $path = $matches[4]; - - $hash = $matches[2]; - - - return $domain . '/' . $hash; - } - - function video_metacafe_parse_url($url) - { - if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(metacafe\.com\/)(.*)/', $url, $matches)) - { - return false; - } - - $domain = $matches[2] . $matches[3]; - $path = $matches[4]; - - $hash = $matches[2]; - - - return $domain . '/' . $hash; - } - - if(isset($confirm_action) && ($confirm_action == 'add_video')) - { - if(isset($title_videourl) && ($title_videourl != '')) - { - if($Pagecontainer != "youtube" || $Pagecontainer != "vimeo" || $Pagecontainer != "metacafe"){ - if(preg_match("/youtube/i", $title_videourl)) - $Pagecontainer = "youtube"; - if(preg_match("/vimeo/i", $title_videourl)) - $Pagecontainer = "vimeo"; - if(preg_match("/metacafe/i", $title_videourl)) - $Pagecontainer = "metacafe"; - } - if($Pagecontainer == "youtube") - $is_valid_video = video_youtube_parse_url($title_videourl); - else if($Pagecontainer == "vimeo"){ - $is_valid_video = video_vimeo_parse_url($title_videourl); - $is_valid_video = $get_addvideourl; - } - else if($Pagecontainer == "metacafe"){ - $is_valid_video = video_metacafe_parse_url($title_videourl); - $is_valid_video = $get_addvideourl; - } - if($is_valid_video) - { - $error['no-video'] = 1; - $_SESSION['candidate_profile_video'] = $is_valid_video; - $_SESSION['candidate_profile_video_access_id'] = $access_id; - $_SESSION['videolisttags'] = $tags; - $_SESSION['Pagecontainer'] = $Pagecontainer; - $_SESSION['container_guid'] = $container_guid; - //echo $_SESSION['candidate_profile_video']; - $url = "action/videolist/addvideo?__elgg_ts={$timestamp}&__elgg_token={$token}"; - forward($url); - } - else - $error['no-video'] = 0; - } - else - { - $error['no-video'] = 0; +gatekeeper(); +$page_owner = page_owner_entity(); +$error = array( + 'no-video' => 1 + ); +$error_msg = array( + 'no-video' => "Please enter a valid video url" + ); + +$container_guid = get_input("container_guid"); +set_page_owner($container_guid); + +$confirm_action = get_input('video_action'); +$guid = get_input('guid'); +$access_id = get_input('access_id'); +$title_videourl = get_input('title_videourl'); +$Pagecontainer = get_input('page'); +$get_addvideourl = get_input('add_videourl'); +$timestamp = time(); +$token = generate_action_token(time()); +if (!empty($get_addvideourl) && ($Pagecontainer == "youtube")) { + $title_add_videourl = "http://www.youtube.com/watch?v=".$get_addvideourl; +} else if(!empty($get_addvideourl) && ($Pagecontainer == "metacafe")) { + $title_add_videourl = "http://www.metacafe.com/api/item/".$get_addvideourl; +} else if(!empty($get_addvideourl) && ($Pagecontainer == "vimeo")) { + $title_add_videourl = "http://vimeo.com/".$get_addvideourl; +} else { + $title_add_videourl = ""; +} + +$tags = get_input('videolisttags'); + +function video_youtube_parse_url($url) { + if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(youtube\.com\/)(.*)/', $url, $matches)) { + return false; + } + + $domain = $matches[2] . $matches[3]; + $path = $matches[4]; + + if (!preg_match('/^(watch\?v=)([a-zA-Z0-9_-]*)(&.*)?$/',$path, $matches)) { + return false; + } + + $hash = $matches[2]; + return $domain . 'v/' . $hash; +} + +function video_vimeo_parse_url($url) { + if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(vimeo\.com\/)(.*)/', $url, $matches)) { + return false; + } + + $domain = $matches[2] . $matches[3]; + $path = $matches[4]; + + $hash = $matches[2]; + + return $domain . '/' . $hash; +} + +function video_metacafe_parse_url($url) { + if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(metacafe\.com\/)(.*)/', $url, $matches)) { + return false; + } + + $domain = $matches[2] . $matches[3]; + $path = $matches[4]; + + $hash = $matches[2]; + + return $domain . '/' . $hash; +} + +if(isset($confirm_action) && ($confirm_action == 'add_video')) { + if(isset($title_videourl) && ($title_videourl != '')) { + if($Pagecontainer != "youtube" || $Pagecontainer != "vimeo" || $Pagecontainer != "metacafe"){ + if(preg_match("/youtube/i", $title_videourl)) { + $Pagecontainer = "youtube"; + } + + if(preg_match("/vimeo/i", $title_videourl)) { + $Pagecontainer = "vimeo"; + } + + if(preg_match("/metacafe/i", $title_videourl)) { + $Pagecontainer = "metacafe"; } - } - - - - $body = '
'; - - $body .= '
'; - $body .= elgg_view('input/hidden',array('internalname'=>'video_action', 'value'=>'add_video')); - $body .= elgg_view('input/hidden',array('internalname'=>'guid', 'value'=>$vars['guid'])); - - - $body .= '

'.$error_msg['no-video'].'
'; } - $body .= '

'; - - $body .= '

'; - - $body .= '

'; - $body .= elgg_view('input/submit', array('internalname'=>'submit','value'=>elgg_echo('videolist:submit'))); - $body .= '
'; - $body .= '
'; - - print $body."

"; - - -?> - - + if($Pagecontainer == "youtube") { + $is_valid_video = video_youtube_parse_url($title_videourl); + } else if($Pagecontainer == "vimeo") { + $is_valid_video = video_vimeo_parse_url($title_videourl); + $is_valid_video = $get_addvideourl; + } else if($Pagecontainer == "metacafe"){ + $is_valid_video = video_metacafe_parse_url($title_videourl); + $is_valid_video = $get_addvideourl; + } + + if($is_valid_video) { + $error['no-video'] = 1; + $_SESSION['candidate_profile_video'] = $is_valid_video; + $_SESSION['candidate_profile_video_access_id'] = $access_id; + $_SESSION['videolisttags'] = $tags; + $_SESSION['Pagecontainer'] = $Pagecontainer; + $_SESSION['container_guid'] = $container_guid; + //echo $_SESSION['candidate_profile_video']; + $url = "action/videolist/addvideo?__elgg_ts={$timestamp}&__elgg_token={$token}"; + forward($url); + } + else + $error['no-video'] = 0; + } + else { + $error['no-video'] = 0; + } +} + +$body = '
'; + +$body .= '
'; +$body .= elgg_view('input/hidden',array('internalname'=>'video_action', 'value'=>'add_video')); +$body .= elgg_view('input/hidden',array('internalname'=>'guid', 'value'=>$vars['guid'])); + + +$body .= '

'.$error_msg['no-video'].'
'; +} +$body .= '

'; + +$body .= '

'; + +$body .= '

'; +$body .= elgg_view('input/submit', array('internalname'=>'submit','value'=>elgg_echo('videolist:submit'))); +$body .= '
'; +$body .= '
'; + +print $body."

"; diff --git a/views/default/forms/browsetube.php b/views/default/forms/browsetube.php index 601fb4e6a..0a54f0d10 100644 --- a/views/default/forms/browsetube.php +++ b/views/default/forms/browsetube.php @@ -1,106 +1,105 @@ - * @copyright Prateek Choudhary - */ +/** + * Elgg Video Plugin + * This plugin allows users to create a library of youtube/vimeo/metacafe videos + * @file - load the browse view + * @package Elgg + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Prateek Choudhary + * @copyright Prateek Choudhary + */ $getcontainer_guid = get_input("container"); $container_guid = explode(":", $getcontainer_guid); if($container_guid[0] == "group"){ $container = $container_guid[1]; -} -else{ +} else{ $container = $getcontainer_guid; } - $error = array( - 'no-search' => 1 - ); - $error_msg = array( - 'no-search' => "Please enter a valid search term" - ); - $browseCat = get_input('q'); - if(empty($browseCat) || !isset($browseCat)) - $browseCat = "youtube"; - $confirm_action = get_input('video_action'); - - if(isset($confirm_action) && ($confirm_action == 'search_video')) - { - if(isset($title_search) && ($title_search != '')) - $error['no-search'] = 0; - else - $error['no-search'] = 1; - } +$error = array( + 'no-search' => 1 + ); +$error_msg = array( + 'no-search' => "Please enter a valid search term" + ); +$browseCat = get_input('q'); +if(empty($browseCat) || !isset($browseCat)) { + $browseCat = "youtube"; +} + +$confirm_action = get_input('video_action'); + +if(isset($confirm_action) && ($confirm_action == 'search_video')) { + if(isset($title_search) && ($title_search != '')) { + $error['no-search'] = 0; + } else { + $error['no-search'] = 1; + } +} + +//$body = '
'; +//Load youtube menu +$body .= "
"; +$body .= "
    "; +$body .= "
  • "; +$body .= "YouTube"; +$body .= "
  • "; +$body .= "
  • "; +$body .= "Metacafe"; +$body .= "
  • "; +$body .= "
  • "; +$body .= "Vimeo"; +$body .= "
  • "; +/* +$body .= "
  • "; +$body .= "Google Videos"; +$body .= "
  • "; +*/ +$body .= "
"; +$body .= "
"; + +$body .= "
"; + +//$body .= "
"; +$body .= '
'; +//$body .= ""; +$body .= elgg_view('input/hidden',array('internalname'=>'video_action', 'value'=>'search_video')); +$body .= elgg_view('input/hidden',array('internalname'=>'guid', 'value'=>$vars['guid'])); +//$body .= elgg_view('input/hidden',array('internalname'=>'start_index', 'value'=>1)); + +switch($browseCat) { + case "youtube" : + $body .= elgg_view('forms/labels/youtube'); + break; + case "metacafe" : + $body .= elgg_view('forms/labels/metacafe'); + break; + case "vimeo" : + $body .= elgg_view('forms/labels/vimeo'); + break; + case "googlevideos" : + $body .= elgg_view('forms/labels/googlevideos'); + break; + default : + $body .= elgg_view('forms/labels/youtube'); + break; +} +$body .= elgg_view('input/hidden',array('internalname'=>'page', 'value'=>$browseCat)); +$body .= '
'; +//$body .= '
'; +//$body .= '
'; + +$body .= '
'; +$body .= '
'; +$body .= '
'; +$body .= '
'; +$body .= '
'; +$body .= '
'; + +print $body."

"; + - - //$body = '
'; - //Load youtube menu - $body .= "
"; - $body .= "
    "; - $body .= "
  • "; - $body .= "YouTube"; - $body .= "
  • "; - $body .= "
  • "; - $body .= "Metacafe"; - $body .= "
  • "; - $body .= "
  • "; - $body .= "Vimeo"; - $body .= "
  • "; - /* - $body .= "
  • "; - $body .= "Google Videos"; - $body .= "
  • "; - */ - $body .= "
"; - $body .= "
"; - - $body .= "
"; - - //$body .= "
"; - $body .= '
'; - //$body .= ""; - $body .= elgg_view('input/hidden',array('internalname'=>'video_action', 'value'=>'search_video')); - $body .= elgg_view('input/hidden',array('internalname'=>'guid', 'value'=>$vars['guid'])); - //$body .= elgg_view('input/hidden',array('internalname'=>'start_index', 'value'=>1)); - - switch($browseCat) - { - case "youtube" : - $body .= elgg_view('forms/labels/youtube'); - break; - case "metacafe" : - $body .= elgg_view('forms/labels/metacafe'); - break; - case "vimeo" : - $body .= elgg_view('forms/labels/vimeo'); - break; - case "googlevideos" : - $body .= elgg_view('forms/labels/googlevideos'); - break; - default : - $body .= elgg_view('forms/labels/youtube'); - break; - } - $body .= elgg_view('input/hidden',array('internalname'=>'page', 'value'=>$browseCat)); - $body .= '
'; - //$body .= '
'; - //$body .= '
'; - - $body .= '
'; - $body .= '
'; - $body .= '
'; - $body .= '
'; - $body .= '
'; - $body .= '
'; - - print $body."

"; - - ?>