[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11950] frontend: experimental menu
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11950] frontend: experimental menu |
Date: |
Tue, 06 May 2014 13:30:07 +0000 |
Revision: 11950
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11950
Author: sigurdne
Date: 2014-05-06 13:30:00 +0000 (Tue, 06 May 2014)
Log Message:
-----------
frontend: experimental menu
Modified Paths:
--------------
trunk/frontend/inc/class.uicontroller.inc.php
trunk/frontend/inc/class.uifrontend.inc.php
trunk/frontend/templates/base/base.css
trunk/frontend/templates/base/controller.xsl
trunk/frontend/templates/base/frontend.xsl
Modified: trunk/frontend/inc/class.uicontroller.inc.php
===================================================================
--- trunk/frontend/inc/class.uicontroller.inc.php 2014-05-06 13:28:55 UTC
(rev 11949)
+++ trunk/frontend/inc/class.uicontroller.inc.php 2014-05-06 13:30:00 UTC
(rev 11950)
@@ -56,6 +56,7 @@
phpgwapi_cache::session_set('frontend','tab',$this->location_id);
parent::__construct();
$this->location_code =
$this->header_state['selected_location'];
+/*
$this->bo->location_code = $this->location_code;
$_org_units = array();
@@ -78,6 +79,7 @@
}
$org_units = array_keys($_org_units);
$this->bo->org_units = $org_units;
+*/
}
/**
@@ -111,7 +113,8 @@
(
'header' =>$this->header_state,
'tabs' => $this->tabs,
- 'controller' =>
array('location_code'=> $this->location_code)
+ 'menu' => $this->menu,
+ 'controller' => array('location_code'=>
$this->location_code)
);
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('app_data' =>
$data));
Modified: trunk/frontend/inc/class.uifrontend.inc.php
===================================================================
--- trunk/frontend/inc/class.uifrontend.inc.php 2014-05-06 13:28:55 UTC (rev
11949)
+++ trunk/frontend/inc/class.uifrontend.inc.php 2014-05-06 13:30:00 UTC (rev
11950)
@@ -27,8 +27,7 @@
phpgw::import_class('frontend.bofrontend');
phpgw::import_class('frontend.bofellesdata');
phpgw::import_class('frontend.borental');
-
-
+
/**
* Frontend main class
*
@@ -69,6 +68,8 @@
$tab = isset($location_id) ?
$location_id : phpgwapi_cache::session_get('frontend','tab');
$selected = isset($tab) && $tab ? $tab :
array_shift(array_keys($tabs));
$this->tabs =
$GLOBALS['phpgw']->common->create_tabs($tabs, $selected);
+ $this->menu = $this->create_menu($tabs,
$selected);
+
phpgwapi_cache::session_set('frontend','tab',$selected);
// Get header state
@@ -276,6 +277,9 @@
$GLOBALS['phpgw']->css->add_external_file('frontend/templates/base/base.css');
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
+
+ $GLOBALS['phpgw']->js->validate_file('jquery', 'menu' ,
'frontend');
+
}
function get_tabs()
@@ -335,7 +339,88 @@
return $tabs;
}
+
+ /**
+ * Create Menu
+ *
+ * @param array $tabs With ($id,$tab) pairs
+ * @param integer $selection array key of selected tab
+ *
+ * @return string html snippet for creating menu in a modern
browser
+ */
+ public function create_menu($tabs, $selection)
+ {
+ /**
+ * Import the jQuery class
+ */
+ phpgw::import_class('phpgwapi.jquery');
+ $html = self::menu_generate($tabs, $selection);
+ $output = <<<HTML
+ <div class="menubar">
+ {$html}
+ </div>
+
+HTML;
+ return $output;
+ }
+
+ /**
+ * Create a menu "bar"
+ *
+ * @param array $tabs list of tabs as an array($id =>
$tab)
+ * @param integer $selection array key of selected tab
+ *
+ * @return string HTML output string
+ */
+ public static function menu_generate($tabs, $selection)
+ {
+
+ phpgwapi_jquery::load_widget('menu');
+
+ $output = <<<HTML
+
+ <ul id="menu">
+ <li><a href="#">moduler</a>
+ <ul>
+HTML;
+ foreach($tabs as $id => $tab)
+ {
+ $selected = $id == $selection ? '
class="selected"' : '';
+ $label = $tab['label'];
+ $_function = '';
+ if(isset($tab['function']))
+ {
+ $_function = " onclick=\"javascript:
{$tab['function']};\"";
+ }
+
+ if(!isset($tab['link']) &&
!isset($tab['function']))
+ {
+ $selected = $selected ? $selected : '
class="ui-state-disabled"';
+ $output .= <<<HTML
+
+
<li{$selected}><a><em>{$label}</em></a></li>
+HTML;
+ }
+ else
+ {
+ $output .= <<<HTML
+
+ <li{$selected}><a
href="{$tab['link']}"{$_function}><em>{$label}</em></a></li>
+HTML;
+
+ }
+ }
+ $output .= <<<HTML
+
+ </ul>
+ </li>
+ </ul>
+
+HTML;
+ return $output;
+ }
+
function insert_links_on_header_state()
{
$help_url = "";
Modified: trunk/frontend/templates/base/base.css
===================================================================
--- trunk/frontend/templates/base/base.css 2014-05-06 13:28:55 UTC (rev
11949)
+++ trunk/frontend/templates/base/base.css 2014-05-06 13:30:00 UTC (rev
11950)
@@ -519,4 +519,12 @@
margin-top: 40px;
}
+#menu {
+ height: 30px;
+}
+#menu > li {
+ float: left;
+ width:auto;
+}
+
Modified: trunk/frontend/templates/base/controller.xsl
===================================================================
--- trunk/frontend/templates/base/controller.xsl 2014-05-06 13:28:55 UTC
(rev 11949)
+++ trunk/frontend/templates/base/controller.xsl 2014-05-06 13:30:00 UTC
(rev 11950)
@@ -1,5 +1,4 @@
<xsl:template match="controller" xmlns:php="http://php.net/xsl">
- <div class="yui-navset" id="controller_tabview">
<div class="yui-content">
<xsl:variable name="controller_params">
@@ -17,7 +16,7 @@
</iframe>
<xsl:value-of select="php:function('lang', 'controller')"/>
</div>
- </div>
+
</xsl:template>
Modified: trunk/frontend/templates/base/frontend.xsl
===================================================================
--- trunk/frontend/templates/base/frontend.xsl 2014-05-06 13:28:55 UTC (rev
11949)
+++ trunk/frontend/templates/base/frontend.xsl 2014-05-06 13:30:00 UTC (rev
11950)
@@ -174,8 +174,13 @@
</xsl:choose>
</table>
</xsl:template>
-
+
+<xsl:template match="menu">
+ <xsl:value-of disable-output-escaping="yes" select="." />
+</xsl:template>
+
<xsl:template match="tabs">
<xsl:value-of disable-output-escaping="yes" select="." />
</xsl:template>
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11950] frontend: experimental menu,
Sigurd Nes <=