Added error trapping to log file exports.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@3463 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan
2011-06-23 22:33:07 +00:00
parent 1ce54fb0db
commit bf90ab8158
3 changed files with 22 additions and 2 deletions

View File

@@ -42,3 +42,12 @@ tr.log-dbg td {
margin-right: 4px;
vertical-align: middle;
}
#exportError {
display: none;
color: #dc143c;
margin-bottom: 8px;
}
#exportErrorText {
}

View File

@@ -191,13 +191,23 @@ function exportResponse( response )
}
}
function exportFail( request )
{
$('exportLog').unspin();
$('exportErrorText').set('text', request.status+" / "+request.statusText );
$('exportError').show();
Error( "Export request failed: "+request.status+" / "+request.statusText );
}
function exportRequest()
{
var form = $('exportForm');
$('exportErrorText').set('text', "" );
$('exportError').hide();
if ( form.validate() )
{
var exportParms = "view=request&request=log&task=export";
var exportReq = new Request.JSON( { url: thisUrl, method: 'post', link: 'cancel', onSuccess: exportResponse } );
var exportReq = new Request.JSON( { url: thisUrl, method: 'post', link: 'cancel', onSuccess: exportResponse, onFailure: exportFail } );
var selection = form.getElement('input[name=selector]:checked').get('value');
if ( selection == 'filter' || selection == 'current' )
{

View File

@@ -102,7 +102,8 @@ xhtmlHeaders(__FILE__, $SLANG['SystemLog'] );
<label for="formatXML">HTML</label><input type="radio" id="formatHTML" name="format" value="html"/>
<label for="formatXML">XML</label><input type="radio" id="formatXML" name="format" value="xml" title="<?= $SLANG['ChooseLogFormat'] ?>" class="validate-one-required"/>
</fieldset>
<div id="exportResult" class="hidden">
<div id="exportError">
<?= $SLANG['ExportFailed'] ?>: <span id="exportErrorText"></span>
</div>
<input type="button" id="exportButton" value="<?= $SLANG['Export'] ?>" onclick="exportRequest()"/>
<input type="button" value="<?= $SLANG['Cancel'] ?>" class="overlayCloser"/>