diff --git a/TODO b/TODO
index abb73f62..3330ec80 100644
--- a/TODO
+++ b/TODO
@@ -8,10 +8,6 @@
* php extension
* database table or column
* kathrine tickets - show/hide
- * admin panel Menus:
- * open in external window (_blank option)
- * color of the link
- * should the link blink?
* cache:
* hooks
* Menus in templates
diff --git a/common.php b/common.php
index 44e3ba0f..2484acdb 100644
--- a/common.php
+++ b/common.php
@@ -27,7 +27,7 @@ session_start();
define('MYAAC', true);
define('MYAAC_VERSION', '0.8.0-dev');
-define('DATABASE_VERSION', 22);
+define('DATABASE_VERSION', 23);
define('TABLE_PREFIX', 'myaac_');
define('START_TIME', microtime(true));
define('MYAAC_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'WINDOWS' : (strtoupper(PHP_OS) == 'DARWIN' ? 'MAC' : 'LINUX'));
diff --git a/system/migrations/23.php b/system/migrations/23.php
new file mode 100644
index 00000000..ee1e33f0
--- /dev/null
+++ b/system/migrations/23.php
@@ -0,0 +1,7 @@
+hasColumn(TABLE_PREFIX . 'menu', 'blank'))
+ $db->query('ALTER TABLE `' . TABLE_PREFIX . 'menu` ADD `blank` TINYINT(1) NOT NULL DEFAULT 0 AFTER `link`;');
+
+if(!$db->hasColumn(TABLE_PREFIX . 'menu', 'color'))
+ $db->query('ALTER TABLE `' . TABLE_PREFIX . 'menu` ADD `color` CHAR(6) NOT NULL DEFAULT "ffffff" AFTER `blank`;');
\ No newline at end of file
diff --git a/system/pages/admin/menus.php b/system/pages/admin/menus.php
index cf7ed13e..e5ec54fd 100644
--- a/system/pages/admin/menus.php
+++ b/system/pages/admin/menus.php
@@ -22,6 +22,8 @@ if(isset($_REQUEST['template'])) {
if(isset($_REQUEST['menu'])) {
$post_menu = $_REQUEST['menu'];
$post_menu_link = $_REQUEST['menu_link'];
+ $post_menu_blank = $_REQUEST['menu_blank'];
+ $post_menu_color = $_REQUEST['menu_color'];
if(count($post_menu) != count($post_menu_link)) {
echo 'Menu count is not equal menu links. Something went wrong when sending form.';
return;
@@ -34,7 +36,7 @@ if(isset($_REQUEST['template'])) {
continue;
try {
- $db->insert(TABLE_PREFIX . 'menu', array('template' => $template, 'name' => $menu, 'link' => $post_menu_link[$category][$i], 'category' => $category, 'ordering' => $i));
+ $db->insert(TABLE_PREFIX . 'menu', array('template' => $template, 'name' => $menu, 'link' => $post_menu_link[$category][$i], 'blank' => $post_menu_blank[$category][$i] == 'on', 'color' => str_replace('#', '', $post_menu_color[$category][$i]), 'category' => $category, 'ordering' => $i));
}
catch(PDOException $error) {
warning('Error while adding menu item (' . $menu . '): ' . $error->getMessage());
@@ -59,15 +61,18 @@ if(isset($_REQUEST['template'])) {
return;
}
- echo 'Hint: You can drag menu items.
Editing: ' . $template . ' template.';
+ echo 'Hint: You can drag menu items.
+ Hint: Add links to external sites using: http:// prefix.
+ Not all templates support blank and colorful links.
+ Editing: ' . $template . ' template.';
$menus = array();
- $menus_db = $db->query('SELECT `name`, `link`, `category`, `ordering` FROM `' . TABLE_PREFIX . 'menu` WHERE `enabled` = 1 AND `template` = ' . $db->quote($template) . ' ORDER BY `ordering` ASC;')->fetchAll();
+ $menus_db = $db->query('SELECT `name`, `link`, `blank`, `color`, `category`, `ordering` FROM `' . TABLE_PREFIX . 'menu` WHERE `enabled` = 1 AND `template` = ' . $db->quote($template) . ' ORDER BY `ordering` ASC;')->fetchAll();
foreach($menus_db as $menu) {
- $menus[$menu['category']][] = array('name' => $menu['name'], 'link' => $menu['link'], 'ordering' => $menu['ordering']);
+ $menus[$menu['category']][] = array('name' => $menu['name'], 'link' => $menu['link'], 'blank' => $menu['blank'], 'color' => $menu['color'], 'ordering' => $menu['ordering']);
}
-
+
$last_id = array();
- echo '