- Poder dedicar un video ya hecho

git-svn-id: https://192.168.0.254/svn/Proyectos.ASong2U_Web/trunk@20 cd1a4ea2-8c7f-e448-aada-19d1fee9e1d6
This commit is contained in:
David Arranz 2012-07-19 11:32:53 +00:00
parent 2f1260aac4
commit 6b401dd02f
5 changed files with 66 additions and 26 deletions

View File

@ -56,6 +56,10 @@ jQuery(document).ready(function(){
}
});
if (j('#video_url').val()) {
j('#video_url').trigger('change');
}
j("#user-list li a.remove").live("click", function() {
var friend_id = j(this).prop('id');

View File

@ -1,19 +1,47 @@
<?php
global $bp;
global $members_template;
?>
<?php
$friend_id = (int)bp_action_variable( 0 );
if ($friend_id != 0) :
$friend_id_txt = ',' . $friend_id;
$friend_name = bp_core_get_user_displayname($friend_id);
$friend_username = bp_core_get_username($friend_id);
$friend = $friend_name . ' (' . $friend_username . ')';
endif;
$friend_id = '';
$friend_id_txt = '';
$friend_name = '';
$friend_username = '';
$friend = '';
$post_id = '';
$video_url = '';
$artist = '';
$song = '';
$action = (string)bp_action_variable( 0 );
switch ($action) {
case 'user' :
$friend_id = (int)bp_action_variable( 1 );
if ($friend_id != 0) :
$friend_username = bp_core_get_username($friend_id);
if ($friend_username) :
$friend_name = bp_core_get_user_displayname($friend_id);
$friend_id_txt = ',' . $friend_id;
$friend = $friend_name . ' (' . $friend_username . ')';
endif;
endif;
break;
case 'id' :
$post_id = (int)bp_action_variable( 1 );
$video_url = get_post_meta($post_id, 'ghostpool_dedication_url', true);
$artist = get_post_meta($post->ID, 'ghostpool_dedication_artist', true);
$song = get_post_meta($post->ID, 'ghostpool_dedication_song', true);
break;
default : die();
}
?>
<?php if ($event != 'create') : ?>
<p id="welcome-message"><?php _e("Create your dedication by following these steps:", 'bp-dedication'); ?></p>
<form action="<?php bp_dedication_new_dedication_form_action() ?>" method="post" id="new-dedication-form" enctype="multipart/form-data" class="standard-form">
@ -29,7 +57,6 @@ global $members_template;
<input type="hidden" name="friend_ids" id="friend_ids" class="required" value="<?php echo ($friend_id != 0) ? $friend_id_txt : ''; ?>" />
</li>
</ul>
</li>
<li>
<label for="dedication_text">Dedication text</label>
@ -38,15 +65,15 @@ global $members_template;
</li>
<li>
<label for="video_url">Video for dedication</label>
<input type="text" name="video_url" class="video_url required url" id="video_url" />
<input type="text" name="video_url" class="video_url required url" id="video_url" value="<?php echo $video_url; ?>"/>
</li>
<li>
<label for="artist_name">Artist name</label>
<input type="text" name="artist_name" class="artist_name" id="artist_name"/>
<input type="text" name="artist_name" class="artist_name" id="artist_name" value="<?php echo $artist; ?>"/>
</li>
<li>
<label for="song_name">Song name</label>
<input type="text" name="song_name" class="song_name" id="song_name"/>
<input type="text" name="song_name" class="song_name" id="song_name" value="<?php echo $song; ?>"/>
</li>
<?php /*
<li>

View File

@ -523,7 +523,7 @@ function bp_member_add_dedicate_a_song_button() {
'block_self' => true,
'wrapper_class' => 'dedicate-button dedicate-song',
'wrapper_id' => 'dedicate-button-' . $friend_id,
'link_href' => wp_nonce_url( $bp->loggedin_user->domain . bp_get_dedication_slug() . '/new-dedication/' . $friend_id . '/', 'dedications_new_dedication' ),
'link_href' => wp_nonce_url( $bp->loggedin_user->domain . bp_get_dedication_slug() . '/new-dedication/user/' . $friend_id . '/', 'dedications_new_dedication' ),
'link_text' => __( 'Dedicate a song', 'buddypress' ),
'link_title' => __( 'Dedicate a song', 'buddypress' ),
'link_id' => 'member-' . $friend_id,

View File

@ -1,4 +1,3 @@
<?php require('video-slider.php'); ?>
<?php /* if($gp_settings['title'] == "Show") { ?><h1><?php the_title(); ?></h1><?php } */ ?>

View File

@ -5,10 +5,10 @@ require(ghostpool_inc . 'options.php');
if ( is_user_logged_in() ):
global $gp_settings, $current_user, $bp;
global $current_user, $bp;
get_currentuserinfo();
//if (is_home() || is_front_page()) {
if (is_home() || is_front_page() || ( $bp->current_component == 'dedications' )) {
$posts_per_page = $theme_video_slides;
$dedication_orderby = "date";
@ -24,14 +24,14 @@ get_currentuserinfo();
'post_status' => $post_status,
'category_name' => $category_name,
);
query_posts($args);
}
//}
query_posts($args);
if (is_singular()) {
//
}
if (have_posts()) {
$slide_counter = 0;
?>
@ -67,13 +67,13 @@ if (have_posts()) {
$to_user_email = get_post_meta($post->ID, 'ghostpool_destination_user_email', true);
$displayed_id = bp_displayed_user_id();
echo "post->ID => " . $post->ID;
/*echo "post->ID => " . $post->ID;
echo "from_user_id => " . $from_user_id;
echo "to_user_id => " . $to_user_id;
echo "displayed_id " . $displayed_id;
echo "displayed_id " . $displayed_id;*/
// En el perfil del usuario sólo mostrar las dedicadas por él y para él. El resto se descartan.
if ( bp_is_active( 'dedications' ) ) {
if ( $bp->current_component == 'dedications' ) {
if (($displayed_id != $from_user_id) && ($displayed_id != $to_user_id)) {
continue; // me salto esta dedicatoria
}
@ -115,6 +115,7 @@ if (have_posts()) {
?>
<li data-type='<?php echo $data_type; ?>' data-path='<?php echo $data_path; ?>'>
<span id="postdata-id-<?php echo $slide_counter; ?>"><?php the_ID(); ?></span>
<span id="postdata-title-<?php echo $slide_counter; ?>"><?php the_title(); ?></span>
<span id="postdata-artist-<?php echo $slide_counter; ?>"><?php echo $artist; ?></span>
<span id="postdata-song-<?php echo $slide_counter; ?>"><?php echo $song; ?></span>
@ -166,7 +167,7 @@ if (have_posts()) {
</div>
<div class="columns two last">
<?php if(function_exists('bp_is_active')) { ?>
<a href="<?php echo bp_loggedin_user_domain() . bp_get_dedication_slug() ?>/new-dedication/" class="button">Dedicate this song</a>
<a id="dedicate_this_song_button" href="<?php echo bp_loggedin_user_domain() . bp_get_dedication_slug() ?>/new-dedication/" class="button">Dedicate this song</a>
<a href="<?php echo bp_loggedin_user_domain() . bp_get_dedication_slug() ?>/new-dedication/" class="button">Dedicate a song</a>
<?php } ?>
</div>
@ -178,6 +179,7 @@ if (have_posts()) {
<script type="text/javascript">
var aIndex=-1;
var oUrl='';
jQuery.noConflict();
jQuery(window).load(function() {
@ -228,12 +230,20 @@ if (have_posts()) {
if ((aIndex != id) && (id >= 0)) {
aIndex = id;
if (oUrl == '') {
oUrl = jQuery('#dedicate_this_song_button').attr("href");
}
var the_id = jQuery('#postdata-id-' + id).text();
var new_title = jQuery('#postdata-title-' + id).text();
var from_to = jQuery('#postdata-from-to-' + id).html();
var artist = jQuery('#postdata-artist-' + id).html();
var song = jQuery('#postdata-song-' + id).html();
var comments = jQuery('#postdata-comments-' + id).html();
var nUrl = oUrl + 'id/' + the_id;
jQuery('#dedicate_this_song_button').attr("href", nUrl);
jQuery('#dedication-data-panel').hide('fast');
jQuery('#dedication-data-panel').slideUp(
'fast',