diff options
author | dipsol <dipsol@ampache> | 2008-12-02 12:29:09 +0000 |
---|---|---|
committer | dipsol <dipsol@ampache> | 2008-12-02 12:29:09 +0000 |
commit | b18f47b0e48762468a7a60c852b1f0936c7feda2 (patch) | |
tree | 9783e51151b17f0c2309bac9c3538f5228e2306a | |
parent | ee10d335e0108270250e212e092afa4ddf4a5507 (diff) | |
download | ampache-b18f47b0e48762468a7a60c852b1f0936c7feda2.tar.gz ampache-b18f47b0e48762468a7a60c852b1f0936c7feda2.tar.bz2 ampache-b18f47b0e48762468a7a60c852b1f0936c7feda2.zip |
fixed ticket 281, by changing the way the data was return. Now only the button will be updated instead of the whole line.
-rw-r--r-- | server/song.ajax.php | 9 | ||||
-rw-r--r-- | templates/show_duplicates.inc.php | 5 | ||||
-rw-r--r-- | templates/show_song.inc.php | 3 | ||||
-rw-r--r-- | templates/show_song_row.inc.php | 5 |
4 files changed, 15 insertions, 7 deletions
diff --git a/server/song.ajax.php b/server/song.ajax.php index 1409ff15..99f8d3d1 100644 --- a/server/song.ajax.php +++ b/server/song.ajax.php @@ -36,10 +36,11 @@ switch ($_REQUEST['action']) { $song->update_enabled($new_enabled,$song->id); $song->enabled = $new_enabled; $song->format(); - - ob_start(); - require Config::get('prefix') . '/templates/show_song_row.inc.php'; - $results['song_' . $song->id] = ob_get_clean(); + + //Return the new Ajax::button + $id = 'btnFlipState_' . $song->id; + $button = $song->enabled ? 'disable' : 'enable'; + $results[$id] = Ajax::button('?page=song&action=flip_state&song_id=' . $song->id,$button,_(ucfirst($button)),'flip_state_' . $song->id); break; default: diff --git a/templates/show_duplicates.inc.php b/templates/show_duplicates.inc.php index 73e48dc3..89837a6f 100644 --- a/templates/show_duplicates.inc.php +++ b/templates/show_duplicates.inc.php @@ -50,12 +50,13 @@ foreach ($songs as $key=>$song_id) { $song = new Song($song_id); $song->format(); - $row_key = 'duplicate_' . $song_id; + $row_key = 'duplicate_' . $song_id; + $row_btnFlipState = 'btnFlipState_' . $song_id; $current_class = ($key == '0') ? 'row-highlight' : flip_class(); $button = $song->enabled ? 'disable' : 'enable'; ?> <tr id="<?php echo $row_key; ?>" class="<?php echo $current_class; ?>"> - <td class="cel_disable"> + <td class="cel_disable" id="<?php echo($row_btnFlipState); ?>"> <?php echo Ajax::button('?page=song&action=flip_state&song_id=' . $song_id,$button,_(ucfirst($button)),'flip_state_' . $song_id); ?> </td> <td class="cel_song"><?php echo $song->f_link; ?></td> diff --git a/templates/show_song.inc.php b/templates/show_song.inc.php index e8857f64..8c1911f4 100644 --- a/templates/show_song.inc.php +++ b/templates/show_song.inc.php @@ -20,6 +20,7 @@ */ $rowparity = flip_class(); $icon = $song->enabled ? 'disable' : 'enable'; +$row_btnFlipState = 'btnFlipState_' . $song->id; ?> <?php show_box_top($song->title . ' ' . _('Details')); ?> <dl class="song_details"> @@ -31,7 +32,9 @@ $icon = $song->enabled ? 'disable' : 'enable'; <a href="<?php echo Config::get('web_path'); ?>/stream.php?action=download&song_id=<?php echo $song->id; ?>"><?php echo get_user_icon('download'); ?></a> <?php } ?> <?php if (Access::check('interface','75')) { ?> + <span id="<?php echo($row_btnFlipState); ?>"> <?php echo Ajax::button('?page=song&action=flip_state&song_id=' . $song->id,$icon,_(ucfirst($icon)),'flip_song_' . $song->id); ?> + </span> <?php } ?> </dd> <?php diff --git a/templates/show_song_row.inc.php b/templates/show_song_row.inc.php index 2685417b..3129b5d4 100644 --- a/templates/show_song_row.inc.php +++ b/templates/show_song_row.inc.php @@ -48,6 +48,9 @@ <?php if (Access::check('interface','75')) { ?> <?php echo Ajax::button('?action=show_edit_object&type=song&id=' . $song->id,'edit',_('Edit'),'edit_song_' . $song->id); ?> <?php $icon = $song->enabled ? 'disable' : 'enable'; ?> - <?php echo Ajax::button('?page=song&action=flip_state&song_id=' . $song->id,$icon,_(ucfirst($icon)),'flip_song_' . $song->id); ?> + <?php $row_btnFlipState = 'btnFlipState_' . $song_id; ?> + <span id="<?php echo($row_btnFlipState); ?>"> + <?php echo Ajax::button('?page=song&action=flip_state&song_id=' . $song->id,$icon,_(ucfirst($icon)),'flip_song_' . $song->id); ?> + </span> <?php } ?> </td> |