fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [7667] controller: example normal tab


From: Sigurd Nes
Subject: [Fmsystem-commits] [7667] controller: example normal tab
Date: Tue, 20 Sep 2011 08:18:36 +0000

Revision: 7667
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7667
Author:   sigurdne
Date:     2011-09-20 08:18:36 +0000 (Tue, 20 Sep 2011)
Log Message:
-----------
controller: example normal tab

Modified Paths:
--------------
    trunk/controller/inc/class.menu.inc.php
    trunk/controller/inc/class.uiexample.inc.php

Added Paths:
-----------
    trunk/controller/js/yahoo/example_normal_tabs.js
    trunk/controller/templates/base/example_normal_tabs.xsl

Modified: trunk/controller/inc/class.menu.inc.php
===================================================================
--- trunk/controller/inc/class.menu.inc.php     2011-09-20 08:14:16 UTC (rev 
7666)
+++ trunk/controller/inc/class.menu.inc.php     2011-09-20 08:18:36 UTC (rev 
7667)
@@ -63,6 +63,13 @@
                                                                        'url'   
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uiexample.edit') ),
                                                                        'image' 
=> array('rental', 'x-office-spreadsheet')
                                                                ),
+                                                               'normal_tabs' 
=> array
+
+                                                               (
+                                                                       'text'  
=> 'example::normal_tabs',
+                                                                       'url'   
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uiexample.normal_tabs') ),
+                                                                       'image' 
=> array('rental', 'x-office-spreadsheet')
+                                                               ),
                                                                'separate_tabs' 
=> array
 
                                                                (

Modified: trunk/controller/inc/class.uiexample.inc.php
===================================================================
--- trunk/controller/inc/class.uiexample.inc.php        2011-09-20 08:14:16 UTC 
(rev 7666)
+++ trunk/controller/inc/class.uiexample.inc.php        2011-09-20 08:18:36 UTC 
(rev 7667)
@@ -17,6 +17,7 @@
                (
                        'index'                                 => true,
                        'edit'                                  => true,
+                       'normal_tabs'                   => true,
                        'separate_tabs'                 => true,
                        'delete'                                => true,
                        'js_poll'                               => true
@@ -411,6 +412,53 @@
                }
 
 
+               public function normal_tabs()
+               {
+                       
self::set_active_menu('controller::example::normal_tabs');
+
+            $type =  phpgw::get_var('type', 'string', 'REQUEST', null);
+
+                       switch($type)
+                       {
+                               case 'default':
+                                       $selected = 1;
+                                       $resource_id = 81;
+                                       break;
+                               case 'forced':
+                                       $selected = 2;
+                                       $resource_id = 46;
+                                       break;
+                               case 'user':
+                               default:
+                                       $selected = 0;
+                                       $resource_id = 80;
+                       }
+
+                       $add_document_link = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uiexample.index') );
+                       $resource = array('id' => $resource_id, 
'add_document_link' => $add_document_link, 'permission' => array('write' => 
true ) );
+
+                       $tabs = array
+                       (
+                               'general'       => array('label' => 
lang('general'), 'link' => '#general'),
+                               'list'          => array('label' => 
lang('list'), 'link' => '#list'),
+                               'dates'         => array('label' => 
lang('dates'), 'link' => '#dates'),
+                       );
+
+                       phpgwapi_yui::tabview_setup('example_tabview');
+
+
+                       $data = array
+                       (
+                               'tabs'          => 
phpgwapi_yui::tabview_generate($tabs, 'general'),
+                               'resource'      => $resource,
+                               'date'          => 
$GLOBALS['phpgw']->yuical->add_listener('date',date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
 time()))
+                       );
+                       self::add_javascript('controller', 'yahoo', 
'example_normal_tabs.js');
+                       self::render_template_xsl('example_normal_tabs', $data);
+               }
+                                       
+
+
                public function separate_tabs()
                {
                        
self::set_active_menu('controller::example::separate_tabs');

Added: trunk/controller/js/yahoo/example_normal_tabs.js
===================================================================
--- trunk/controller/js/yahoo/example_normal_tabs.js                            
(rev 0)
+++ trunk/controller/js/yahoo/example_normal_tabs.js    2011-09-20 08:18:36 UTC 
(rev 7667)
@@ -0,0 +1,13 @@
+YAHOO.util.Event.addListener(window, "load", function() {
+
+       var oArgs = 
{menuaction:'booking.uidocument_resource.index',sort:'name',filter_owner_id:resource_id};
+       var url = phpGWLink('index.php', oArgs, true);
+       var colDefs = [{key: 'name', label: lang['Name'], formatter: 
YAHOO.portico.formatLink}, {key: 'category', label: lang['Category']}, {key: 
'actions', label: lang['Actions'], formatter: 
YAHOO.portico.formatGenericLink(lang['Edit'], lang['Delete'])}];
+       YAHOO.portico.inlineTableHelper('documents_container', url, colDefs);
+
+       var oArgs = 
{menuaction:'booking.uipermission_resource.index',sort:'name',filter_object_id:resource_id};
+       var url = phpGWLink('index.php', oArgs, true);
+       var colDefs = [{key: 'subject_name', label: lang['Account']}, {key: 
'role', label: lang['Role']}, {key: 'actions', label: lang['Actions'], 
formatter: YAHOO.portico.formatGenericLink(lang['Edit'], lang['Delete'])}];
+       YAHOO.portico.inlineTableHelper('permissions_container', url, colDefs);
+});
+

Added: trunk/controller/templates/base/example_normal_tabs.xsl
===================================================================
--- trunk/controller/templates/base/example_normal_tabs.xsl                     
        (rev 0)
+++ trunk/controller/templates/base/example_normal_tabs.xsl     2011-09-20 
08:18:36 UTC (rev 7667)
@@ -0,0 +1,33 @@
+<!-- separate tabs and  inline tables-->
+
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+       <div class="yui-navset yui-navset-top" id="example_tabview">
+               <xsl:value-of disable-output-escaping="yes" select="tabs" />
+               <div class="yui-content">
+                       <div id="general">
+                               <h4><xsl:value-of select="php:function('lang', 
'Documents')" /></h4>
+                       <div id="documents_container"/>
+                               <a class='button'>
+                                       <xsl:attribute 
name="href"><xsl:value-of select="resource/add_document_link"/></xsl:attribute>
+                                       <xsl:if 
test="resource/permission/write">
+                                               <xsl:value-of 
select="php:function('lang', 'Add Document')" />
+                                       </xsl:if>
+                               </a>
+                               <h4><xsl:value-of select="php:function('lang', 
'Permissions')" /></h4>
+                               <div id="permissions_container"/>
+                       </div>
+                       <div id="list">
+                               <h4><xsl:value-of select="php:function('lang', 
'list')" /></h4>
+                       </div>
+                       <div id="list">
+                               <h4><xsl:value-of select="php:function('lang', 
'dates')" /></h4>
+                               <xsl:value-of disable-output-escaping="yes" 
select="date"/>
+                       </div>
+               </div>
+       </div>
+       <script type="text/javascript">
+               var resource_id = <xsl:value-of select="resource/id"/>;
+               var lang = <xsl:value-of select="php:function('js_lang', 
'Name', 'Category', 'Actions', 'Edit', 'Delete', 'Account', 'Role')"/>;
+       </script>
+</xsl:template>
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]