features management page for hubmins
This commit is contained in:
parent
c076e72cbf
commit
93565ea768
@ -1217,6 +1217,7 @@ function widget_admin($arr) {
|
||||
'site' => array(z_root() . '/admin/site/', t('Site'), 'site'),
|
||||
'users' => array(z_root() . '/admin/users/', t('Accounts'), 'users'),
|
||||
'channels' => array(z_root() . '/admin/channels/', t('Channels'), 'channels'),
|
||||
'features' => array(z_root() . '/admin/features/', t('Features'), 'features'),
|
||||
'plugins' => array(z_root() . '/admin/plugins/', t('Plugins'), 'plugins'),
|
||||
'themes' => array(z_root() . '/admin/themes/', t('Themes'), 'themes'),
|
||||
'queue' => array(z_root() . '/admin/queue', t('Inspect queue'), 'queue'),
|
||||
|
@ -62,6 +62,9 @@ function admin_post(&$a){
|
||||
case 'hubloc':
|
||||
admin_page_hubloc_post($a);
|
||||
break;
|
||||
case 'features':
|
||||
admin_page_features_post($a);
|
||||
break;
|
||||
case 'dbsync':
|
||||
admin_page_dbsync_post($a);
|
||||
break;
|
||||
@ -113,6 +116,9 @@ function admin_content(&$a) {
|
||||
// case 'hubloc':
|
||||
// $o = admin_page_hubloc($a);
|
||||
// break;
|
||||
case 'features':
|
||||
$o = admin_page_features($a);
|
||||
break;
|
||||
case 'logs':
|
||||
$o = admin_page_logs($a);
|
||||
break;
|
||||
@ -530,6 +536,74 @@ function admin_page_hubloc_post(&$a){
|
||||
goaway($a->get_baseurl(true) . '/admin/hubloc' );
|
||||
}
|
||||
|
||||
|
||||
function admin_page_features_post(&$a) {
|
||||
|
||||
check_form_security_token_redirectOnErr('/admin/features', 'admin_manage_features');
|
||||
|
||||
logger('postvars: ' . print_r($_POST,true));
|
||||
|
||||
$arr = array();
|
||||
$features = get_features(false);
|
||||
|
||||
foreach($features as $fname => $fdata) {
|
||||
foreach(array_slice($fdata,1) as $f) {
|
||||
$feature = $f[0];
|
||||
|
||||
if(array_key_exists('feature_' . $feature,$_POST))
|
||||
$val = intval($_POST['feature_' . $feature]);
|
||||
else
|
||||
$val = 0;
|
||||
set_config('feature',$feature,$val);
|
||||
|
||||
if(array_key_exists('featurelock_' . $feature,$_POST))
|
||||
set_config('feature_lock',$feature,$val);
|
||||
else
|
||||
del_config('feature_lock',$feature);
|
||||
}
|
||||
}
|
||||
|
||||
goaway(z_root() . '/admin/features' );
|
||||
|
||||
}
|
||||
|
||||
function admin_page_features(&$a) {
|
||||
|
||||
if((argc() > 1) && (argv(1) === 'features')) {
|
||||
$arr = array();
|
||||
$features = get_features(false);
|
||||
|
||||
foreach($features as $fname => $fdata) {
|
||||
$arr[$fname] = array();
|
||||
$arr[$fname][0] = $fdata[0];
|
||||
foreach(array_slice($fdata,1) as $f) {
|
||||
|
||||
$set = get_config('feature',$f[0]);
|
||||
if($set === false)
|
||||
$set = $f[3];
|
||||
$arr[$fname][1][] = array(
|
||||
array('feature_' .$f[0],$f[1],$set,$f[2],array(t('Off'),t('On'))),
|
||||
array('featurelock_' .$f[0],sprintf( t('Lock feature %s'),$f[1]),(($f[4] !== false) ? 1 : 0),'',array(t('Off'),t('On')))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$tpl = get_markup_template("admin_settings_features.tpl");
|
||||
$o .= replace_macros($tpl, array(
|
||||
'$form_security_token' => get_form_security_token("admin_manage_features"),
|
||||
'$title' => t('Manage Additional Features'),
|
||||
'$features' => $arr,
|
||||
'$submit' => t('Submit'),
|
||||
));
|
||||
|
||||
return $o;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function admin_page_hubloc(&$a) {
|
||||
$hubloc = q("SELECT hubloc_id, hubloc_addr, hubloc_host, hubloc_status FROM hubloc");
|
||||
|
||||
|
@ -1 +1 @@
|
||||
2016-01-05.1269H
|
||||
2016-01-06.1270H
|
||||
|
@ -19,6 +19,7 @@
|
||||
<li><a href='{{$admin.queue.0}}'>{{$admin.queue.1}}</a></li>
|
||||
<li><a href='{{$admin.plugins.0}}'>{{$admin.plugins.1}}</a></li>
|
||||
<li><a href='{{$admin.themes.0}}'>{{$admin.themes.1}}</a></li>
|
||||
<li><a href='{{$admin.features.0}}'>{{$admin.features.1}}</a></li>
|
||||
<li><a href='{{$admin.dbsync.0}}'>{{$admin.dbsync.1}}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
31
view/tpl/admin_settings_features.tpl
Normal file
31
view/tpl/admin_settings_features.tpl
Normal file
@ -0,0 +1,31 @@
|
||||
<div class="generic-content-wrapper">
|
||||
<div class="section-title-wrapper">
|
||||
<h2>{{$title}}</h2>
|
||||
</div>
|
||||
<form action="admin/features" method="post" autocomplete="off">
|
||||
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
|
||||
<div class="panel-group" id="settings" role="tablist" aria-multiselectable="true">
|
||||
{{foreach $features as $g => $f}}
|
||||
<div class="panel">
|
||||
<div class="section-subtitle-wrapper" role="tab" id="{{$g}}-settings-title">
|
||||
<h3>
|
||||
<a data-toggle="collapse" data-parent="#settings" href="#{{$g}}-settings-content" aria-expanded="true" aria-controls="{{$g}}-settings-collapse">
|
||||
{{$f.0}}
|
||||
</a>
|
||||
</h3>
|
||||
</div>
|
||||
<div id="{{$g}}-settings-content" class="panel-collapse collapse{{if $g == 'general'}} in{{/if}}" role="tabpanel" aria-labelledby="{{$g}}-settings-title">
|
||||
<div class="section-content-tools-wrapper">
|
||||
{{foreach $f.1 as $fcat}}
|
||||
{{include file="field_checkbox.tpl" field=$fcat.0}}
|
||||
{{include file="field_checkbox.tpl" field=$fcat.1}}
|
||||
{{/foreach}}
|
||||
<div class="settings-submit-wrapper" >
|
||||
<button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/foreach}}
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user