diff options
-rw-r--r-- | lib/class/update.class.php | 3 | ||||
-rw-r--r-- | server/ajax.server.php | 4 | ||||
-rw-r--r-- | server/index.ajax.php | 44 | ||||
-rw-r--r-- | templates/show_index.inc.php | 6 | ||||
-rw-r--r-- | templates/show_random_albums.inc.php | 3 |
5 files changed, 55 insertions, 5 deletions
diff --git a/lib/class/update.class.php b/lib/class/update.class.php index 58da8330..9e902d52 100644 --- a/lib/class/update.class.php +++ b/lib/class/update.class.php @@ -1138,6 +1138,9 @@ class Update { $sql = "ALTER TABLE `rating` CHANGE `rating` TINYINT ( 4 ) NOT NULL"; $db_results = Dba::query($sql); +// $sql = "ALTER TABLE `user` CHANGE `validation` VARCHAR ( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL"; +// $db_results = Dba::query($sql); + self::set_version('db_version','340015'); } // update_340015 diff --git a/server/ajax.server.php b/server/ajax.server.php index d231d9d8..9d6ccb83 100644 --- a/server/ajax.server.php +++ b/server/ajax.server.php @@ -73,6 +73,10 @@ switch ($_REQUEST['page']) { require_once Config::get('prefix') . '/server/democratic.ajax.php'; exit; break; + case 'index': + require_once Config::get('prefix') . '/server/index.ajax.php'; + exit; + break; default: // A taste of compatibility break; diff --git a/server/index.ajax.php b/server/index.ajax.php new file mode 100644 index 00000000..f7bf9ea5 --- /dev/null +++ b/server/index.ajax.php @@ -0,0 +1,44 @@ +<?php +/* + + Copyright (c) 2001 - 2007 Ampache.org + All rights reserved. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License v2 + as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +/** + * Sub-Ajax page, requires AJAX_INCLUDE as one + */ +if (AJAX_INCLUDE != '1') { exit; } + +switch ($_REQUEST['action']) { + case 'random_albums': + $albums = get_random_albums('6'); + if (count($albums)) { + ob_start(); + require_once Config::get('prefix') . '/templates/show_random_albums.inc.php'; + $results['random_selection'] = ob_get_contents(); + ob_end_clean(); + } + break; + default: + $results['rfc3514'] = '0x1'; + break; +} // switch on action; + +// We always do this +echo xml_from_array($results); +?> diff --git a/templates/show_index.inc.php b/templates/show_index.inc.php index 50637547..ee231859 100644 --- a/templates/show_index.inc.php +++ b/templates/show_index.inc.php @@ -29,11 +29,9 @@ if (isset($_REQUEST['xspf']) && isset ($_REQUEST['play_info'])){ <?php show_now_playing(); ?> </div> <!-- Close Now Playing Div --> <!-- Randomly selected albums of the moment --> + <?php echo Ajax::observe('window','load',Ajax::action('?page=index&action=random_albums','random_albums')); ?> <div id="random_selection"> - <?php - $albums = get_random_albums('6'); - if (count($albums)) { require_once Config::get('prefix') . '/templates/show_random_albums.inc.php'; } - ?> + <?php show_box_top(_('Albums of the Moment')); echo _('Loading...'); show_box_bottom(); ?> </div> <!-- Recently Played --> <div id="recently_played"> diff --git a/templates/show_random_albums.inc.php b/templates/show_random_albums.inc.php index 8a879f9e..fe8c4972 100644 --- a/templates/show_random_albums.inc.php +++ b/templates/show_random_albums.inc.php @@ -19,8 +19,9 @@ */ $web_path = Config::get('web_path'); +$button = Ajax::button('?page=index&action=random_albums','random',_('Refresh'),'random_refresh'); ?> -<?php show_box_top(_('Albums of the Moment')); ?> +<?php show_box_top(_('Albums of the Moment') . ' ' . $button); ?> <?php foreach ($albums as $album_id) { |