aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
Diffstat (limited to 'views')
-rw-r--r--views/default/forms/videolist/add.php79
-rw-r--r--views/default/forms/videolist/edit.php82
2 files changed, 44 insertions, 117 deletions
diff --git a/views/default/forms/videolist/add.php b/views/default/forms/videolist/add.php
deleted file mode 100644
index b03c18341..000000000
--- a/views/default/forms/videolist/add.php
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php
-
-/**
- * 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 <synapticfield@gmail.com>
- * @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');
-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());
-}
-//if it is a group, pull out the group access view
-if(page_owner_entity() instanceof ElggGroup){
- $options = group_access_options(page_owner_entity());
-}else{
- $options = '';
-}
-$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');
-
-
-$body = '<form action="'.$_SERVER['php_self'].'" method="post" id="add_video_form">';
-$body .= elgg_view('input/hidden',array('internalname'=>'video_action', 'value'=>'add_video'));
-$body .= elgg_view('input/hidden',array('internalname'=>'guid', 'value'=>$vars['guid']));
-
-
-$body .= '<p><label>'.elgg_echo("videolist:title_videourl").'<br />';
-$body .= elgg_view("input/text",array('internalname' => 'title_videourl','value'=>$title_add_videourl));
-if($error['no-video'] == 0) {
- $body .= '<div class="videolist_error">'.$error_msg['no-video'].'</div>';
-}
-$body .= '</label></p>';
-
-$body .= '<p><label>'.elgg_echo('videolist:tags');
-$body .= elgg_view('input/tags', array('internalname' => 'videolisttags', 'value' => $tags));
-$body .= '</label></p>';
-
-$body .= '<p><label>'.elgg_echo("videolist:title_access").'<br />';
-$body .= elgg_view('input/access',array('internalname'=>'access_id', 'value' => $access_id, 'options' => $options));
-$body .= '</label></p>';
-$body .= elgg_view('input/submit', array('internalname'=>'submit','value'=>elgg_echo('videolist:submit')));
-$body .= '</form>';
-
-print $body;
diff --git a/views/default/forms/videolist/edit.php b/views/default/forms/videolist/edit.php
index 9bcc64a7a..ba6141263 100644
--- a/views/default/forms/videolist/edit.php
+++ b/views/default/forms/videolist/edit.php
@@ -1,46 +1,52 @@
<?php
/**
-* Elgg Video Plugin > Edit view
-*/
-
-elgg_load_library('elgg:videolist');
-
-// Make sure we're logged in (send us to the front page if not)
-gatekeeper();
-$page_owner = page_owner_entity();
-$container_guid = $vars['entity']->container_guid;
-$owner = get_entity($container_guid);
-if($owner instanceof ElggGroup){
- $options = group_access_options($owner);
-}else{
- $options = '';
+ * Videolist edit form body
+ *
+ * @package ElggVideolist
+ */
+
+$variables = elgg_get_config('videolist');
+
+if(empty($vars['guid'])){
+ unset($variables['title']);
}
-?>
-<form action="<?php echo $vars['url']; ?>action/videolist/edit" enctype="multipart/form-data" method="post" id="edit_video_form">
-
- <p><label><?php echo elgg_echo("title"); ?><br />
- <?php echo elgg_view("input/text", array("internalname" => "title_videourl","value" => $vars['entity']->title));?>
- </label></p>
-
- <p><label><?php echo elgg_echo("tags"); ?><br />
- <?php echo elgg_view("input/tags", array("internalname" => "tags","value" => $vars['entity']->tags));?>
- </label></p>
-
- <p><label><?php echo elgg_echo('access'); ?><br />
- <?php echo elgg_view('input/access', array('internalname' => 'access_id','value' => $vars['entity']->access_id, 'options' => $options)); ?>
- </label></p>
-
- <p>
+foreach ($variables as $name => $type) {
+?>
+<div>
+ <label><?php echo elgg_echo("videolist:$name") ?></label>
<?php
- echo "<input type='hidden' name=\"container_guid\" value=\"{$container_guid}\" />";
-
- if (isset($vars['entity'])) {
- echo "<input type='hidden' name=\"video_guid\" value=\"{$vars['entity']->getGUID()}\" />";
+ if ($type != 'longtext') {
+ echo '<br />';
}
- echo elgg_view('input/securitytoken');
?>
- <input type="submit" value="<?php echo elgg_echo("save"); ?>" />
- </p>
+ <?php echo elgg_view("input/$type", array(
+ 'name' => $name,
+ 'value' => $vars[$name],
+ ));
+ ?>
+</div>
+<?php
+}
+
+$cats = elgg_view('categories', $vars);
+if (!empty($cats)) {
+ echo $cats;
+}
+
+
+echo '<div class="elgg-foot">';
+if ($vars['guid']) {
+ echo elgg_view('input/hidden', array(
+ 'name' => 'video_guid',
+ 'value' => $vars['guid'],
+ ));
+}
+echo elgg_view('input/hidden', array(
+ 'name' => 'container_guid',
+ 'value' => $vars['container_guid'],
+));
+
+echo elgg_view('input/submit', array('value' => elgg_echo('save')));
-</form>
+echo '</div>';