diff options
| author | Lester Caine <lester@lsces.co.uk> | 2009-02-21 19:19:12 +0000 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2009-02-21 19:19:12 +0000 |
| commit | 38242268f4953db663a94bff95c1eb19cf7cfaee (patch) | |
| tree | 52e14667f6f647453362a15741ca6bd97ac6c4e9 | |
| parent | 7200751507ee36a0018a571c2a095de54540a198 (diff) | |
| download | liberty-38242268f4953db663a94bff95c1eb19cf7cfaee.tar.gz liberty-38242268f4953db663a94bff95c1eb19cf7cfaee.tar.bz2 liberty-38242268f4953db663a94bff95c1eb19cf7cfaee.zip | |
Tidy dbreport_direct and dbreport_manage - still need to add tools to create managed dsn entries
| -rw-r--r-- | admin/plugins/data_dbreport.php | 39 | ||||
| -rw-r--r-- | plugins/data.dbreport.php | 11 | ||||
| -rw-r--r-- | templates/plugins/data_dbreport_admin.tpl | 20 |
3 files changed, 52 insertions, 18 deletions
diff --git a/admin/plugins/data_dbreport.php b/admin/plugins/data_dbreport.php index 6cf4ebd..fbbde34 100644 --- a/admin/plugins/data_dbreport.php +++ b/admin/plugins/data_dbreport.php @@ -3,11 +3,44 @@ require_once( '../../../bit_setup_inc.php' ); require_once( KERNEL_PKG_PATH.'/simple_form_functions_lib.php' ); $gBitSystem->verifyPermission( 'p_admin' ); +$formEnable = array( + 'dbreport_direct' => array( + 'label' => 'Allow Direct DSN Entries', + 'note' => 'Allow direct input of DSN connection data to allow remote report generation.', + 'page' => 'DBReportDirect', + ), + 'dbreport_manage' => array( + 'label' => 'Allow Managed DB Entries', + 'note' => 'Allow DSN information from the managed list of tables and querirs.', + 'page' => 'DBReportManage', + ), +); +$gBitSmarty->assign( 'formEnable',$formEnable ); + +$formStyle = array( + 'dbreport_group' => array( + 'label' => 'Allow Group entries', + 'note' => 'Allow generation of group footers.', + 'page' => 'DBReportGroup', + ), + 'dbreport_total' => array( + 'label' => 'Allow Total Entries', + 'note' => 'Allow generation of total footer.', + 'page' => 'DBReportTotal', + ), +); +$gBitSmarty->assign( 'formStyle',$formStyle ); $feedback = array(); -if( !empty( $_REQUEST['plugin_settings'] )) { - simple_set_value( 'liberty_plugin_code_default_source', LIBERTY_PKG_NAME ); - $feedback['success'] = tra( 'The plugin was successfully updated' ); +if( !empty( $_REQUEST['change_prefs'] ) ) { + $featureToggles = array_merge( $formEnable, $formStyle ); + foreach( $featureToggles as $item => $info ) { + if( empty( $info['type'] ) || $info['type'] == 'checkbox' ) { + simple_set_toggle( $item, KERNEL_PKG_NAME ); + } elseif( $info['type'] == 'text' ) { + simple_set_value( $item, KERNEL_PKG_NAME ); + } + } } $gBitSmarty->assign( 'feedback', $feedback ); diff --git a/plugins/data.dbreport.php b/plugins/data.dbreport.php index dd9e630..152654a 100644 --- a/plugins/data.dbreport.php +++ b/plugins/data.dbreport.php @@ -1,6 +1,6 @@ <?php /** - * $Header: /cvsroot/bitweaver/_bit_liberty/plugins/Attic/data.dbreport.php,v 1.1 2009/02/21 18:18:42 lsces Exp $ + * $Header: /cvsroot/bitweaver/_bit_liberty/plugins/Attic/data.dbreport.php,v 1.2 2009/02/21 19:19:12 lsces Exp $ * @package liberty * @subpackage plugins_data * @@ -23,6 +23,7 @@ $pluginParams = array ( 'requires_pair' => TRUE, 'syntax' => '{dbreport dsn=dsnname db=dbname csv=0|1 wiki=0|1 debug=0|1 }', 'plugin_type' => DATA_PLUGIN, + 'plugin_settings_url' => LIBERTY_PKG_URL.'admin/plugins/data_dbreport.php', // display icon in quicktags bar 'biticon' => '{biticon ilocation=quicktag iname=image-x-generic iexplain="DBReport"}', @@ -31,7 +32,6 @@ $pluginParams = array ( // functions 'help_function' => 'data_dbreport_help', 'load_function' => 'wikiplugin_dbreport', - 'plugin_settings_url' => LIBERTY_PKG_URL.'admin/plugins/data_dbreport.php', ); $gLibertySystem->registerPlugin( PLUGIN_GUID_DATADBREPORT, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATADBREPORT ); @@ -1504,14 +1504,11 @@ function wikiplugin_dbreport($data, $params) { } } // translate db name into dsn -//TODO - convert to bw permissions if (isset($db)) { - $perm_name = 'tiki_p_dsn_' . $db; - global $$perm_name; - // check permissions - if ($$perm_name != 'y') { + if ( !$gBitSystem->isFeatureActive( 'dbreport_manage' ) ) { return ( tra('You do not have permission to use this DSN') ); } +//TODO - convert to bw managed library // retrieve the dsn string $dsn = $tikilib->get_dsn_by_name($db); } else { diff --git a/templates/plugins/data_dbreport_admin.tpl b/templates/plugins/data_dbreport_admin.tpl index 044258d..ef781a4 100644 --- a/templates/plugins/data_dbreport_admin.tpl +++ b/templates/plugins/data_dbreport_admin.tpl @@ -7,17 +7,21 @@ <div class="body"> {form legend="DBReport specific settings"} {formfeedback hash=$feedback} - <div class="row"> - {formlabel label="Direct DSN Access" for="dbreports_direct"} - {forminput} - <input type="text" id="dbreports_direct" name="dbreports_direct" size="2" maxlength="2" value="{$gBitSystem->getConfig('dbreports_direct')|escape}" /> - {formhelp note="Enable direct DSN entries in reports."} - {/forminput} - </div> + {legend legend="DBReport Access Settings"} + {foreach from=$formEnable key=feature item=output} + <div class="row"> + {formlabel label=`$output.label` for=$feature} + {forminput} + {html_checkboxes name="$feature" values="y" checked=$gBitSystem->getConfig($feature) labels=false id=$feature} + {formhelp note=`$output.note` page=`$output.page`} + {/forminput} + </div> + {/foreach} + {/legend} <div class="row submit"> - <input type="submit" name="plugin_settings" value="{tr}Save Plugin Settings{/tr}" /> + <input type="submit" name="change_prefs" value="{tr}Change preferences{/tr}" /> </div> {/form} </div><!-- end .body --> |
