Ticket #2961: ajax_request_thing.2.diff
File ajax_request_thing.2.diff, 4.0 KB (added by , 17 years ago) |
---|
-
js/ajax_utils.js
1 /** 2 * The routines to allow a small ajax request counter 3 * 4 * @url $URL: http://svn.mythtv.org/svn/trunk/mythplugins/mythweb/js/utils.js $ 5 * @date $Date: 2006-07-07 23:05:05 -0700 (Fri, 07 Jul 2006) $ 6 * @version $Revision: 10427 $ 7 * @author $Author: xris $ 8 * @license LGPL 9 * 10 /**/ 11 12 var pending_ajax_requests = 0; 13 14 function ajax_add_request() { 15 pending_ajax_requests +=1; 16 get_element('ajax_num_requests').innerHTML = pending_ajax_requests; 17 remove_class('ajax_working', 'hidden'); 18 } 19 20 function ajax_remove_request() { 21 pending_ajax_requests -=1; 22 get_element('ajax_num_requests').innerHTML = pending_ajax_requests; 23 if (pending_ajax_requests == 0) 24 add_class('ajax_working', 'hidden'); 25 } 26 No newline at end of file -
modules/tv/tmpl/default/recorded.php
121 121 // Do the actual deletion 122 122 if (programs_shown == 1) 123 123 location.href = url; 124 else 124 else { 125 ajax_add_request(); 125 126 submit_url(url, http_success, http_failure, id, file); 127 } 126 128 // Debug statements - uncomment to verify that the right file is being deleted 127 129 //alert('row number ' + id + ' belonged to section ' + section + ' which now has ' + rowcount[section] + ' elements'); 128 130 //alert('just deleted an episode of "' + title + '" which now has ' + episode_count + ' episodes left'); … … 189 191 $('diskfree').innerHTML = nice_filesize(<?php echo disk_size ?> - diskused); 190 192 // Eventually, we should perform the removal-from-the-list here instead 191 193 // of in confirm_delete() 194 ajax_remove_request(); 192 195 } 193 196 194 197 function http_failure(err, errstr, args) { 195 198 var file = args[0]; 196 199 alert("Can't delete "+file.title+': '+file.subtitle+".\nHTTP Error: " + errstr + ' (' + err + ')'); 200 ajax_remove_request(); 197 201 } 198 202 199 203 // --> -
modules/_shared/tmpl/default/header.php
36 36 <script type="text/javascript" src="<?php echo root ?>js/visibility.js"></script> 37 37 <script type="text/javascript" src="<?php echo root ?>js/prototype.js"></script> 38 38 <script type="text/javascript" src="<?php echo root ?>js/ajax.js"></script> 39 <script type="text/javascript" src="<?php echo root ?>js/ajax_utils.js"></script> 39 40 40 41 <link rel="stylesheet" type="text/css" href="<?php echo skin_url ?>/style.css" /> 41 42 <link rel="stylesheet" type="text/css" href="<?php echo skin_url ?>/header.css" /> -
modules/_shared/tmpl/default/footer.php
21 21 } 22 22 ?> 23 23 24 <div id="ajax_working" class="hidden"> 25 <?php echo t('<span id="ajax_num_requests">0</span> requests pending.'); ?> 26 </div> 27 24 28 </body> 25 29 </html> -
skins/default/style.css
202 202 .clearfix {display: block;} 203 203 /* End hide from IE-mac */ 204 204 205 /* Ajax little popup request thing style */ 206 #ajax_working { 207 position: fixed; 208 background-color: green; 209 bottom: 0px; 210 left: 1em; 211 padding: 1em; 212 width: 10em; 213 text-align: center; 214 } 215