Changeset 157

Show
Ignore:
Timestamp:
11/02/07 19:54:40 (14 months ago)
Author:
chris
Message:

Added further automatic refresh support for remaining non-refreshing data 17

Location:
trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/CHANGELOG

    r155 r157  
    2828  change has added options to the configuration file, please see the 
    2929  README for details 
     30 
     31* Added further automatic refresh support for remaining data that wasn't 
     32  already being refreshed by the 15 second automatic refresher [ticket:17] 
    3033 
    31341.8 
  • trunk/index.php

    r156 r157  
    174174                                case 11: 
    175175                                        $c->shutdown(); 
     176                                        throw new Exception('HellaNZB Has been shut down'); 
    176177                        } 
    177178                        header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . $self); 
  • trunk/js/hellaworld.php

    r153 r157  
    7575 
    7676        function updateData(json) { 
     77                var status = "<h1>HellaWorld</h1>"; 
     78                status += '<div><p><?php printf(_('HellaNZB %s - Uptime: %s'), "' + json.status.version + '", "' + json.status.uptime + '"); ?></p>'; 
     79                status += '<p><?php printf(_('Downloaded: %s files in %s segments totalling %sMB via %s NZB files'), "' + json.status.files + '", "' + json.status.segments + '", "' + json.status.totalmb + '", "' + json.status.totalnzbs + '"); ?></p></div>'; 
     80                $('#masthead').html(status); 
    7781                var info = "<h2><?php echo _('Currently Downloading'); ?></h2>"; 
    7882                if (json.downloading != null) { 
     
    99103                } 
    100104                $('#info').html(info); 
     105                status = '<?php printf(_('Queued: %s items totalling %sMB'), "' + json.queuelength + '", "' + json.queuesize + '"); ?>'; 
     106                $('#queuestatus').html(status) 
     107                var queue = ''; 
    101108                if (json.queuelength > 0) { 
    102                         var queue = ''; 
    103109                        for (i = 0; i < json.queuelength; i ++) { 
    104110                                queue += '<li id="order_' + json.queue[i].id + '" class="queuebox">'; 
     
    112118                                        queue += '</div>'; 
    113119                                } 
    114                                 queue += '</li>'; 
    115                         } 
    116                         $('#queue').html(queue); 
    117                         makeSortable(); 
    118                 } else { 
    119                         $('#queue').html(''); 
    120                 } 
    121                 if (json.finished && json.finished.length > 0) { 
     120                                        queue += '</li>'; 
     121                        } 
     122                } else { 
     123                        queue += '<li class="queuebox" style="text-align: center; font-weight: bold;"><?php echo _('Queue is empty'); ?></li>'; 
     124                } 
     125                $('#queue').html(queue); 
     126                makeSortable(); 
     127                if (json.showfinished) { 
     128                        $('#finishedcount').html('<?php printf(_('Finished items: %s'), "' + json.finishedlength + '"); ?>'); 
     129                } 
     130                if (json.showfinished) { 
    122131                        var finished = ''; 
    123                         for (i = 0; i < json.finished.length; i++) { 
    124                                 finished += '<li class="queuebox ' + json.finished[i].type + '">'; 
    125                                 finished += '<div class="queuetitle">' + json.finished[i].archiveName + '</div>'; 
    126                                 finished += '<ul class="queuecontrols"><li class="control"><a href="index.php?removefinished=' + json.finished[i].index + '"><?php echo _('Remove'); ?></a></li></ul>'; 
    127                                 finished += '<div class="queuestats"><?php printf(_('Finished on: %s Processing Time: %s'), "' + json.finished[i].finishedTime + '", "' + json.finished[i].elapsedTime"); ?>; 
    128                                 if (json.finished[i].parMessage != '') { 
    129                                         finished += '<?php printf(_(' Par message: %s'), "' + json.finished[i].parMessage"); ?>; 
     132                        if (json.finished.length > 0) { 
     133                                for (i = 0; i < json.finished.length; i++) { 
     134                                        finished += '<li class="queuebox ' + json.finished[i].type + '">'; 
     135                                        finished += '<div class="queuetitle">' + json.finished[i].archiveName + '</div>'; 
     136                                        finished += '<ul class="queuecontrols"><li class="control"><a href="index.php?removefinished=' + json.finished[i].index + '"><?php echo _('Remove'); ?></a></li></ul>'; 
     137                                        finished += '<div class="queuestats"><?php printf(_('Finished on: %s Processing Time: %s'), "' + json.finished[i].finishedTime + '", "' + json.finished[i].elapsedTime"); ?>; 
     138                                        if (json.finished[i].parMessage != '') { 
     139                                                finished += '<?php printf(_(' Par message: %s'), "' + json.finished[i].parMessage"); ?>; 
     140                                        } 
     141                                        finished += '</div></li>'; 
    130142                                } 
    131                                 finished += '</div></li>'; 
     143                        } else { 
     144                                finished += '<li class="queuebox" style="text-align: center; font-weight: bold;"><?php echo _('No Finished Items'); ?></li>'; 
    132145                        } 
    133146                        $('#finished').html(finished); 
  • trunk/templates/default.php

    r152 r157  
    117117                        </div> 
    118118                        <div id="content"> 
    119                                 <div class="queuebox first"> 
     119                                <div id="queuestatus" class="queuebox first"> 
    120120                                        <?php printf(_('Queued: %s items totalling %sMB'), $c->queueLength, $c->queueSize); ?> 
    121121                                </div> 
    122                                 <?php if ($c->queueLength > 0): ?> 
    123122                                <form method="post" action="<?php echo $self; ?>" onsubmit="confirmorder(this)"> 
    124123<ul id="queue"> 
     124<?php if ($c->queueLength == 0): ?> 
     125        <li class="queuebox" style="text-align: center; font-weight: bold;"><?php echo _('Queue is empty'); ?></li> 
     126<?php endif; ?> 
    125127<?php $i = 0; foreach ($c->queue as $queue): $i++ ?> 
    126128        <li class="queuebox" id="order_<?php echo $queue['id']; ?>"> 
     
    134136<?php endforeach; ?> 
    135137</ul> 
    136                                 <?php endif; ?> 
    137138                                <div id="controls"> 
    138139                                        <span id="refresher"> 
    139140                                        <input type="checkbox" name="refresh" id="refresh" onclick="if (this.checked) { createCookie('HHRefresh', 1, 30);startRefresher(); } else { createCookie('HHRefresh', 0, 30);stopRefresher(); }" /> <label for="refresh" class="refresher"><?php echo _('Refresh every 15 seconds'); ?></label> <input type="button" value="<?php echo _('Refresh Now'); ?>" onclick="refreshNow();" /> 
    140141                                        </span> 
    141                                         <?php if ($c->queueLength > 0): ?> 
    142142                                        <input type="submit" name="reorder" value="<?php echo _('Reorder Items'); ?>" /> <?php echo _('by'); ?> <select name="sorttype" id="sorttype" onchange="showstatus(this);"><option value="1"><?php echo _('Provided Order'); ?></option><option value="2"><?php echo _('Name'); ?></option><option value="3"><?php echo _('Size'); ?></option></select> <select name="sortdirection" id="sortdirection"><option value="1"><?php echo _('Ascending'); ?></option><option value="2"><?php echo _('Descending'); ?></option></select> 
    143                                         <?php endif; ?> 
    144143                                </div> 
    145                                 <?php if ($c->queueLength > 0): ?> 
    146144                                </form> 
    147                                 <?php endif; ?> 
    148145                </div> 
    149146        </div> 
     
    168165                </div> 
    169166        </form> 
    170         <?php if ($finishedcount > 0): ?> 
    171167        <ul id="finished"> 
    172                 <?php $i = 0; foreach($x->item as $item): $i++; ?> 
    173                 <li class="queuebox <?php echo (((string)$item->type == 'SUCCESS') ? 'good' : 'bad'); ?>"> 
    174                         <div class="queuetitle"> 
    175                                 <?php echo (string)$item->archiveName; ?> 
    176                         </div> 
    177                         <ul class="queuecontrols"> 
    178                                 <li class="control"><a href="<?php echo $self; ?>?removefinished=<?php echo $i; ?>"><?php echo _('Remove'); ?></a></li> 
    179                         </ul> 
    180                         <div class="queuestats"><?php printf(_('Finished on: %s Processing Time: %s'), date('M dS - H:i:s', (int)$item->finishedTime), (string)$item->elapsedTime); if (trim((string)$item->parMessage) != ''): printf(_(' Par message: %s'), (string)$item->parMessage); endif; ?></div> 
    181                 </li> 
    182                 <?php endforeach; ?> 
     168                <?php if ($finishedcount == 0): ?> 
     169                        <li class="queuebox" style="text-align: center; font-weight: bold;"><?php echo _('No Finished Items'); ?></li> 
     170                <?php else: ?> 
     171                        <?php $i = 0; foreach($x->item as $item): $i++; ?> 
     172                        <li class="queuebox <?php echo (((string)$item->type == 'SUCCESS') ? 'good' : 'bad'); ?>"> 
     173                                <div class="queuetitle"> 
     174                                        <?php echo (string)$item->archiveName; ?> 
     175                                </div> 
     176                                <ul class="queuecontrols"> 
     177                                        <li class="control"><a href="<?php echo $self; ?>?removefinished=<?php echo $i; ?>"><?php echo _('Remove'); ?></a></li> 
     178                                </ul> 
     179                                <div class="queuestats"><?php printf(_('Finished on: %s Processing Time: %s'), date('M dS - H:i:s', (int)$item->finishedTime), (string)$item->elapsedTime); if (trim((string)$item->parMessage) != ''): printf(_(' Par message: %s'), (string)$item->parMessage); endif; ?></div> 
     180                        </li> 
     181                        <?php endforeach; ?> 
     182                <?php endif; ?> 
    183183        </ul> 
    184         <?php endif; ?> 
    185184</div> 
    186185</div> 
  • trunk/templates/json.php

    r151 r157  
    3939 
    4040$hellainfo = array(); 
    41  
    4241$hellainfo['path'] = $self; 
     42$hellainfo['status']['version'] = $c->version; 
     43$hellainfo['status']['uptime'] = $c->uptime; 
     44$hellainfo['status']['files'] = $c->totalFiles; 
     45$hellainfo['status']['segments'] = $c->totalSegments; 
     46$hellainfo['status']['totalmb'] = $c->totalMB; 
     47$hellainfo['status']['totalnzbs'] = $c->totalNZBs; 
    4348if ($c->downloadCount > 0) { 
    4449        $hellainfo['downloading'] = htmlspecialchars($c->downloads[0]['nzbName']); 
     
    5762} 
    5863$hellainfo['queuelength'] = $c->queueLength; 
     64$hellainfo['queuesize'] = $c->queueSize; 
    5965$i = 0; 
    6066$hellainfo['queue'] = array(); 
     
    6975} 
    7076if ($config['showfinished']) { 
     77        $hellainfo['showfinished'] = true; 
    7178        $hellainfo['finished'] = array(); 
    7279        $i = 0; 
     
    8289                $hellainfo['finished'][] = $tmp; 
    8390        } 
     91        $hellainfo['finishedlength'] = $i; 
    8492} else { 
    85         $hellainfo['finished'] = false; 
     93        $hellainfo['showfinished'] = false; 
    8694} 
    8795$hellainfo['log'] = $c->log;