update save to a button tag, and add a saveas functionality

This commit is contained in:
Isaac Connor 2017-11-23 08:26:55 -08:00
parent 485567349d
commit 900fbe1e0f
3 changed files with 7 additions and 6 deletions

View File

@ -151,7 +151,7 @@ Warning("Addterm");
if ( ! empty($_REQUEST['Id']) ) { if ( ! empty($_REQUEST['Id']) ) {
dbQuery( 'DELETE FROM Filters WHERE Id=?', array( $_REQUEST['Id'] ) ); dbQuery( 'DELETE FROM Filters WHERE Id=?', array( $_REQUEST['Id'] ) );
} }
} else if ( ( $action == 'save' ) or ( $action == 'execute' ) or ( $action == 'submit' ) ) { } else if ( ( $action == 'Save' ) or ( $action == 'SaveAs' ) or ( $action == 'execute' ) or ( $action == 'submit' ) ) {
$sql = ''; $sql = '';
$_REQUEST['filter']['Query']['sort_field'] = validStr($_REQUEST['filter']['Query']['sort_field']); $_REQUEST['filter']['Query']['sort_field'] = validStr($_REQUEST['filter']['Query']['sort_field']);
@ -175,7 +175,7 @@ Warning("Addterm");
$sql .= ', Background = '. ( !empty($_REQUEST['filter']['Background']) ? 1 : 0); $sql .= ', Background = '. ( !empty($_REQUEST['filter']['Background']) ? 1 : 0);
$sql .= ', Concurrent = '. ( !empty($_REQUEST['filter']['Concurrent']) ? 1 : 0); $sql .= ', Concurrent = '. ( !empty($_REQUEST['filter']['Concurrent']) ? 1 : 0);
if ( $_REQUEST['Id'] ) { if ( $_REQUEST['Id'] and ( $action == 'Save' ) ) {
dbQuery( 'UPDATE Filters SET ' . $sql. ' WHERE Id=?', array($_REQUEST['Id']) ); dbQuery( 'UPDATE Filters SET ' . $sql. ' WHERE Id=?', array($_REQUEST['Id']) );
} else { } else {
dbQuery( 'INSERT INTO Filters SET' . $sql ); dbQuery( 'INSERT INTO Filters SET' . $sql );

View File

@ -403,7 +403,8 @@ if ( ZM_OPT_MESSAGE ) {
<?php <?php
if ( canEdit( 'Events' ) ) { if ( canEdit( 'Events' ) ) {
?> ?>
<input type="button" value="<?php echo translate('Save') ?>" onclick="saveFilter( this );"/> <button value="Save" onclick="saveFilter(this);"><?php echo translate('Save') ?></button>
<button value="SaveAs" onclick="saveFilter(this);"><?php echo translate('SaveAs') ?></button>
<?php <?php
if ( $filter->Id() ) { if ( $filter->Id() ) {
?> ?>
@ -415,6 +416,6 @@ if ( canEdit( 'Events' ) ) {
<input type="button" value="<?php echo translate('Reset') ?>" onclick="submitToFilter( this, 1 );"/> <input type="button" value="<?php echo translate('Reset') ?>" onclick="submitToFilter( this, 1 );"/>
</div> </div>
</form> </form>
</div> </div><!--content-->
</div> </div><!--page-->
<?php xhtmlFooter() ?> <?php xhtmlFooter() ?>

View File

@ -63,7 +63,7 @@ function saveFilter( element ) {
//form.target = 'zmFilter'; //form.target = 'zmFilter';
form.target = window.name; form.target = window.name;
form.elements['action'].value = 'save'; form.elements['action'].value = element.value;
form.action = thisUrl + '?view=filter'; form.action = thisUrl + '?view=filter';
form.submit(); form.submit();
} }