summaryrefslogtreecommitdiff
path: root/admin/menus.php
blob: b5cdd3852e41ef2f0a0c920402ca8cfa083e19ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
use Bitweaver\KernelTools;
//
// (c) 2006 bitweaver.org - GNU LGPL
//
require_once( '../../kernel/includes/setup_inc.php' );
require_once( KERNEL_PKG_INCLUDE_PATH."simple_form_functions_lib.php" );

//$gBitSmarty->assign( 'loadDragDrop', true );
//$gBitSystem->setOnloadScript('initDragDrop();');
$gBitSystem->verifyPermission( 'p_admin' );

$formMenuSettings = [
// this feature is obsolete since we now have this in a module
//	'site_top_bar' => array(
//		'label' => 'Top bar menu',
//		'note' => 'Here you can enable or disable the menubar at the top of the page (available in most themes). Before you disable this bar, please make sure you have some means of navigation set up to access at least the administration page.',
//	),
	'site_top_bar_dropdown' => [
		'label' => 'Dropdown menu',
		'note' => 'Use the CSS driven dropdown menus in the top bar. Compatibility and further reading can be found at <a class="external" href="http://www.htmldog.com/articles/suckerfish/dropdowns/">Suckerfish Dropdowns</a>.',
	],
	'site_hide_my_top_bar_link' => [
		'label' => 'Hide "My" Link',
		'note' => 'Hide the <strong>My &lt;sitename&gt;</strong> link from users that are not logged in.',
	],
];
$gBitSmarty->assign( 'formMenuSettings',$formMenuSettings );

$formMenuJsSettings = [
	'site_top_bar_js' => [
		'label' => 'Enhance Dropdown with Javascript',
		'note' => 'This small javascript will delay the menu slightly making it easier to navigate. Also you can apply below effects. Please see <a class="external" href="http://www.twinhelix.com">TwinHelix</a> for details.',
	],
	'site_top_bar_js_fade' => [
		'label' => 'Fade Effect',
		'note' => 'Fade in menu dropdown elements.',
	],
	'site_top_bar_js_swipe' => [
		'label' => 'Swipe Effect',
		'note' => 'Sweep the menu from the top down.',
	],
	'site_top_bar_js_clip' => [
		'label' => 'Clip Effect',
		'note' => 'Similar to the swipe effect.',
	],
];

if( !empty( $_REQUEST['menu_settings'] ) ) {
	foreach( array_keys( $formMenuSettings ) as $item ) {
		simple_set_toggle( $item, THEMES_PKG_NAME );
	}
	simple_set_value( 'site_menu_title', THEMES_PKG_NAME );
}

if( !empty( $_REQUEST['menu_js_settings'] ) ) {
	foreach( array_keys( $formMenuJsSettings ) as $item ) {
		simple_set_toggle( $item, THEMES_PKG_NAME );
	}
}

if( !empty( $_REQUEST['update_menus'] ) ) {
	foreach( array_keys( $gBitSystem->mAppMenu['bar'] ) as $menuPackage ) {
		if( empty( $_REQUEST["menu_$menuPackage"] ) ) {
			// the package menu is off - store it off
			$gBitSystem->storeConfig( "menu_$menuPackage", 'n', THEMES_PKG_NAME );
		} elseif( $gBitSystem->getConfig( "menu_$menuPackage" ) == 'n' ) {
			// the package menu was off and now is on. Just delete the pref since on is the assumed state
			$gBitSystem->storeConfig( "menu_$menuPackage", null, THEMES_PKG_NAME );
		}

		if( !empty( $_REQUEST["{$menuPackage}_menu_text"] ) ) {
			// someone thinks that our default package names aren't good enough! HA!
			$gBitSystem->storeConfig( "{$menuPackage}_menu_text", $_REQUEST["{$menuPackage}_menu_text"], constant( strtoupper( $menuPackage ).'_PKG_NAME' ));
		}

		if( !empty( $_REQUEST["{$menuPackage}_menu_position"] ) ) {
			// someone thinks that our default package names aren't good enough! HA!
			$gBitSystem->storeConfig( "{$menuPackage}_menu_position", $_REQUEST["{$menuPackage}_menu_position"], constant( strtoupper( $menuPackage ).'_PKG_NAME' ));
		} else {
			$gBitSystem->storeConfig( "{$menuPackage}_menu_position", null, constant( strtoupper( $menuPackage ).'_PKG_NAME' ));
		}
	}

	// need to reload page to apply settings
	KernelTools::bit_redirect( THEMES_PKG_URL."admin/menus.php" );
}

if( $gBitSystem->isFeatureActive( 'site_top_bar_dropdown' ) ) {
	$gBitSmarty->assign( 'formMenuJsSettings',$formMenuJsSettings );
}

$gBitSystem->display( 'bitpackage:themes/admin_themes_menus.tpl', 'Themes Manager' , [ 'display_mode' => 'admin' ]);
?>