aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/videolist/edit.php30
-rw-r--r--pages/videolist/edit.php1
-rw-r--r--views/default/forms/videolist/edit.php2
3 files changed, 22 insertions, 11 deletions
diff --git a/actions/videolist/edit.php b/actions/videolist/edit.php
index f9db7b6a2..6670ceadb 100644
--- a/actions/videolist/edit.php
+++ b/actions/videolist/edit.php
@@ -18,23 +18,33 @@ foreach ($variables as $name => $type) {
}
// Get guids
-$videolist_guid = (int)get_input('videolist_guid');
+$video_guid = (int)get_input('video_guid');
$container_guid = (int)get_input('container_guid');
elgg_make_sticky_form('videolist');
elgg_load_library('elgg:videolist');
-if (!$input['video_url']) {
- register_error(elgg_echo('videolist:error:no_url'));
- forward(REFERER);
-}
+// If new video, get data from video providers
+if(!$video_guid) {
+ if (!$input['video_url']) {
+ register_error(elgg_echo('videolist:error:no_url'));
+ forward(REFERER);
+ }
-$parsed_url = videolist_parseurl($input['video_url']);
+ $parsed_url = videolist_parseurl($input['video_url']);
-if(!$parsed_url) {
- register_error(elgg_echo('videolist:error:invalid_url'));
- forward(REFERER);
+ if(!$parsed_url) {
+ register_error(elgg_echo('videolist:error:invalid_url'));
+ forward(REFERER);
+ }
+
+ unset($input['title']);
+ unset($input['description']);
+ $input = array_merge(videolist_get_data($parsed_url), $input);
+
+} else {
+ unset($input['video_url']);
}
if ($video_guid) {
@@ -50,8 +60,6 @@ if ($video_guid) {
$new_video = true;
}
-$input = array_merge($input, videolist_get_data($parsed_url));
-
if (sizeof($input) > 0) {
foreach ($input as $name => $value) {
$video->$name = $value;
diff --git a/pages/videolist/edit.php b/pages/videolist/edit.php
index 5ca1e4b64..916d9d280 100644
--- a/pages/videolist/edit.php
+++ b/pages/videolist/edit.php
@@ -36,6 +36,7 @@ $body_vars = array('guid' => $guid);
foreach(array_keys(elgg_get_config('videolist')) as $variable) {
$body_vars[$variable] = $videolist_item->$variable;
}
+$body_vars['container_guid'] = $videolist_item->container_guid;
$content = elgg_view_form('videolist/edit', $form_vars, $body_vars);
diff --git a/views/default/forms/videolist/edit.php b/views/default/forms/videolist/edit.php
index 8bbbcffb7..18fb6ded4 100644
--- a/views/default/forms/videolist/edit.php
+++ b/views/default/forms/videolist/edit.php
@@ -10,6 +10,8 @@ $variables = elgg_get_config('videolist');
if(empty($vars['guid'])){
unset($variables['title']);
unset($variables['description']);
+} else {
+ unset($variables['video_url']);
}
foreach ($variables as $name => $type) {