check these in so I can go back and find out why the stylsheet is horked

This commit is contained in:
friendica 2013-08-11 19:04:07 -07:00
parent 4eca591aed
commit 6191cfef2a
5 changed files with 74 additions and 3 deletions

View File

@ -43,7 +43,7 @@ require_once('include/taxonomy.php');
define ( 'RED_PLATFORM', 'Red Matrix' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
define ( 'DB_UPDATE_VERSION', 1058 );
define ( 'DB_UPDATE_VERSION', 1059 );
define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@ -288,6 +288,10 @@ define ( 'ATTACH_FLAG_OS', 0x0002);
define ( 'MENU_ITEM_ZID', 0x0001);
/**
* Maximum number of "people who like (or don't like) this" that we will list by name
*/

40
include/menu.php Normal file
View File

@ -0,0 +1,40 @@
<?php /** @file */
require_once('include/security.php');
function menu_fetch($name,$uid,$observer_xchan) {
$sql_options = permission_sql($uid);
$r = q("select * from menu where menu_channel_id = %d and menu_name = '%s' limit 1",
intval($uid),
dbesc($name)
);
if($r) {
$x = q("select * from menu_item where mitem_menu_id = %d and mitem_channel_id = %d
$sql_options
order by mitem_order asc, mitem_desc asc",
intval($x[0]['menu_id']),
intval($uid)
);
$result = array('menu' => $r[0], 'items' => $x );
}
return null;
}
function menu_render($menu) {
if(! $menu)
return '';
for($x = 0; $x < count($menu['items']); $x ++)
if($menu['items']['mitem_flags'] & MENU_ITEM_ZID)
$menu['items']['link'] = zid($menu['items']['link']);
return replace_macros(get_markup_template('usermenu.tpl'),array(
'$menu' => $menu['menu'],
'$items' => $menu['items']
));
}

View File

@ -530,15 +530,18 @@ CREATE TABLE IF NOT EXISTS `manage` (
CREATE TABLE IF NOT EXISTS `menu` (
`menu_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`menu_channel_id` int(10) unsigned NOT NULL DEFAULT '0',
`menu_name` char(255) NOT NULL DEFAULT '',
`menu_desc` char(255) NOT NULL DEFAULT '',
PRIMARY KEY (`menu_id`),
KEY `menu_channel_id` (`menu_channel_id`)
KEY `menu_channel_id` (`menu_channel_id`),
KEY `menu_name` (`menu_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `menu_item` (
`mitem_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`mitem_link` char(255) NOT NULL DEFAULT '',
`mitem_desc` char(255) NOT NULL DEFAULT '',
`mitem_flags` int(11) NOT NULL DEFAULT '0',
`allow_cid` mediumtext NOT NULL,
`allow_gid` mediumtext NOT NULL,
`deny_cid` mediumtext NOT NULL,
@ -547,6 +550,7 @@ CREATE TABLE IF NOT EXISTS `menu_item` (
`mitem_menu_id` int(10) unsigned NOT NULL DEFAULT '0',
`mitem_order` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`mitem_id`),
KEY `mitem_flags` (`mitem_flags`),
KEY `mitem_channel_id` (`mitem_channel_id`),
KEY `mitem_menu_id` (`mitem_menu_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

View File

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1058 );
define( 'UPDATE_VERSION' , 1059 );
/**
*
@ -670,3 +670,15 @@ function update_r1057() {
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
function update_r1058() {
$r1 = q("ALTER TABLE `menu` ADD `menu_name` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `menu_channel_id` ,
ADD INDEX ( `menu_name` ) ");
$r2 = q("ALTER TABLE `menu_item` ADD `mitem_flags` INT NOT NULL DEFAULT '0' AFTER `mitem_desc` ,
ADD INDEX ( `mitem_flags` ) ");
if($r1 && $r2)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}

11
view/tpl/usermenu.tpl Normal file
View File

@ -0,0 +1,11 @@
<div class="pmenu">
<div class="pmenu-title">{{$menu.menu_desc}}</div>
{{if $items }}
<ul class="pmenu-body">
{{foreach $items as $mitem }}
<li class="pmenu-item"><a href="{{$mitem.mitem_link}}">{{$mitem.mitem_desc}}</a></li>
{{/foreach }}
</ul>
{{/if}}
<div class="pmenu-end"></div>
</div>