fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11911] property: more on org_unit


From: Sigurd Nes
Subject: [Fmsystem-commits] [11911] property: more on org_unit
Date: Tue, 22 Apr 2014 13:41:38 +0000

Revision: 11911
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11911
Author:   sigurdne
Date:     2014-04-22 13:41:37 +0000 (Tue, 22 Apr 2014)
Log Message:
-----------
property: more on org_unit

Modified Paths:
--------------
    trunk/frontend/inc/class.uientity.inc.php
    trunk/frontend/templates/base/entityview.xsl
    trunk/property/inc/class.boentity.inc.php
    trunk/property/inc/class.uientity.inc.php
    trunk/property/templates/base/entity.xsl

Modified: trunk/frontend/inc/class.uientity.inc.php
===================================================================
--- trunk/frontend/inc/class.uientity.inc.php   2014-04-14 09:00:18 UTC (rev 
11910)
+++ trunk/frontend/inc/class.uientity.inc.php   2014-04-22 13:41:37 UTC (rev 
11911)
@@ -41,6 +41,7 @@
                        'index'                 => true,
                        'download'              => true,
                        'view'                  => true,
+                       'edit'                  => true,
                );
 
                public function __construct()
@@ -1003,6 +1004,25 @@
 
                public function view()
                {
+                       if(!$this->acl_read)
+                       {
+                               return;
+                       }
+                       $this->edit(null, $mode = 'view');
+               }
+
+               /**
+               * Prepare data for view and edit - depending on mode
+               *
+               * @param array  $values  populated object in case of retry
+               * @param string $mode    edit or view
+               * @param int    $id      entity id - no id means 'new'
+               *
+               * @return void
+               */
+
+               public function edit($values = array(), $mode = 'edit')
+               {
                        $bo     = & $this->bo;
                        $id = phpgw::get_var('id');
                        $values = $bo->read_single(array('id' => $id, 
'entity_id' => $this->entity_id, 'cat_id' => $this->cat_id, 'view' => true));
@@ -1230,7 +1250,7 @@
 
                        $msglog = 
phpgwapi_cache::session_get('frontend','msgbox');
                        phpgwapi_cache::session_clear('frontend','msgbox');
-                       
+
                        $data = array(
                                'header'                => $this->header_state,
                                'msgbox_data'   => isset($msglog) ? 
$GLOBALS['phpgw']->common->msgbox($GLOBALS['phpgw']->common->msgbox_data($msglog))
 : array(),
@@ -1243,7 +1263,15 @@
                                                                                
'menuaction'            => 'frontend.uientity.index',
                                                                                
'location_id'           => $this->location_id
                                                                        )),
-
+                                               'entityedit'    => 
$GLOBALS['phpgw']->link('/index.php',
+                                                                       array
+                                                                       (
+                                                                               
'menuaction'            => 'frontend.uientity.edit',
+                                                                               
'location_id'           => $this->location_id,
+                                                                               
'id'                            => $id
+                                                                       )),
+                                               'location_id'           => 
$this->location_id,
+                                               'id'                    => $id,
                                                'entity'        => $entity,
                                                'entityhistory' => 
$entityhistory2,
                                                'custom_attributes'     => 
array('attributes' => $values['attributes']),
@@ -1270,6 +1298,8 @@
                        $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'entity.view', 'frontend' );
                        
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
 
+                       $GLOBALS['phpgw']->js->validate_file( 'tinybox2', 
'packed', 'phpgwapi' );
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/tinybox2/style.css');
 
                        $GLOBALS['phpgw']->xslttpl->add_file(array('frontend', 
'entityview','attributes_view'));
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('location_view', 'files'), 
PHPGW_SERVER_ROOT . '/property/templates/base');

Modified: trunk/frontend/templates/base/entityview.xsl
===================================================================
--- trunk/frontend/templates/base/entityview.xsl        2014-04-14 09:00:18 UTC 
(rev 11910)
+++ trunk/frontend/templates/base/entityview.xsl        2014-04-22 13:41:37 UTC 
(rev 11911)
@@ -21,6 +21,24 @@
                <xsl:for-each select="myColumnDefs">
                        myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
                </xsl:for-each>
+
+       showlightbox_edit_entity = function(location_id, id)
+       {
+               var oArgs = {menuaction:'property.uientity.edit', 
location_id:location_id, id: id, noframework:1, lean: 1};
+               var sUrl = phpGWLink('index.php', oArgs);
+
+               TINY.box.show({iframe:sUrl, 
boxid:'frameless',width:750,height:550,fixed:false,maskid:'darkmask',maskopacity:40,
 mask:true, animate:true,
+               close: true,
+               closejs:function(){refresh_entity(location_id, id)}
+               });
+       }
+
+       refresh_entity = function(location_id, id)
+       {
+               alert('refresh_entity');
+       }
+
+
        </script>
 
     <table cellpadding="2" cellspacing="2" width="95%" align="center">
@@ -45,6 +63,11 @@
                                <li style="margin-bottom: 1em;">
                                        <a href="{entitylist}"> &lt;&lt; 
<xsl:value-of select="php:function('lang', 'show all entities')"/></a>
                                </li>
+                               <li style="margin-bottom: 1em;">
+                                               <a href="#" 
onclick="showlightbox_edit_entity({location_id},{id});">
+                                                       <xsl:value-of 
select="php:function('lang', 'edit')"/>
+                                               </a>
+                               </li>
                                <li>
                                                <xsl:choose>
                                                        <xsl:when 
test="location_data!=''">

Modified: trunk/property/inc/class.boentity.inc.php
===================================================================
--- trunk/property/inc/class.boentity.inc.php   2014-04-14 09:00:18 UTC (rev 
11910)
+++ trunk/property/inc/class.boentity.inc.php   2014-04-22 13:41:37 UTC (rev 
11911)
@@ -99,6 +99,15 @@
                        $p_num                                                  
= phpgw::get_var('p_num');
                        $org_unit_id                                    = 
phpgw::get_var('org_unit_id', 'int');
 
+                       if($location_id = phpgw::get_var('location_id', 'int'))
+                       {
+                               $location_info = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+                               $location_arr   = explode('.', 
$location_info['location']);
+                               $type                   = $location_arr[1];
+                               $entity_id              = $location_arr[2];
+                               $cat_id                 = $location_arr[3];
+                       }
+                       
                        $this->criteria_id                              = 
isset($criteria_id) && $criteria_id ? $criteria_id : '';
 
                        $location_code                                  = 
phpgw::get_var('location_code');

Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php   2014-04-14 09:00:18 UTC (rev 
11910)
+++ trunk/property/inc/class.uientity.inc.php   2014-04-22 13:41:37 UTC (rev 
11911)
@@ -120,6 +120,11 @@
                        {
                                
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= "::{$this->cat_id}";
                        }
+                       if(phpgw::get_var('noframework', 'bool'))
+                       {
+                               $GLOBALS['phpgw_info']['flags']['noframework'] 
= true;
+                       }
+
                }
 
 
@@ -1420,6 +1425,7 @@
                function edit($mode = 'edit')
                {
                        $id     = phpgw::get_var('id', 'int');
+                       $_lean = phpgw::get_var('lean', 'bool');
 
                        if($mode == 'edit' && (!$this->acl_add && 
!$this->acl_edit))
                        {
@@ -1816,7 +1822,8 @@
                                        'id'                    => $id,
                                        'entity_id'             => 
$this->entity_id,
                                        'cat_id'                => 
$this->cat_id,
-                                       'type'                  => $this->type
+                                       'type'                  => $this->type,
+                                       'lean'                  => $_lean
                                );
 
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
@@ -2505,7 +2512,8 @@
                                                                                
                                "entity_id:'{$this->entity_id}',".
                                                                                
                                "cat_id:'{$this->cat_id}',".
                                                                                
                                "type:'{$this->type}'}",
-                                       'documents'                             
                => $documents
+                                       'documents'                             
                => $documents,
+                                       'lean'                                  
                => $_lean ? 1 : 0
                                );
 
                        phpgwapi_yui::load_widget('dragdrop');

Modified: trunk/property/templates/base/entity.xsl
===================================================================
--- trunk/property/templates/base/entity.xsl    2014-04-14 09:00:18 UTC (rev 
11910)
+++ trunk/property/templates/base/entity.xsl    2014-04-22 13:41:37 UTC (rev 
11911)
@@ -455,7 +455,9 @@
                                                <xsl:when test="mode = 'edit'">
                                                        <tr>
                                                                <td colspan="2" 
align="center">
-                                                                       
<xsl:call-template name="table_apply"/>
+                                                                       
<xsl:call-template name="table_apply">
+                                                                               
<xsl:with-param name="lean" select="lean"/>
+                                                                       
</xsl:call-template>
                                                                </td>
                                                        </tr>
                                                </xsl:when>
@@ -755,7 +757,9 @@
                                                <table cellpadding="2" 
cellspacing="2" width="80%" align="center">
                                                        <tr height="50">
                                                                <td colspan="2" 
align="center">
-                                                                       
<xsl:call-template name="table_apply"/>
+                                                                       
<xsl:call-template name="table_apply">
+                                                                               
<xsl:with-param name="lean" select="lean"/>
+                                                                       
</xsl:call-template>
                                                                </td>
                                                        </tr>
                                                </table>
@@ -763,7 +767,7 @@
                                </xsl:choose>
                        </form>
                        <xsl:choose>
-                               <xsl:when test="value_id!=''">
+                               <xsl:when test="value_id!='' and lean !=1">
                                        <table cellpadding="2" cellspacing="2" 
width="80%" align="center">
                                                <tr>
                                                        <xsl:choose>
@@ -834,19 +838,25 @@
 
        <!-- New template-->
        <xsl:template xmlns:php="http://php.net/xsl"; name="table_apply">
+               <xsl:param name="lean" />
+
                <table>
                        <tr>
+                               <xsl:choose>
+                                       <xsl:when test="$lean!=1">
+                                               <td valign="bottom">
+                                                       <xsl:variable 
name="lang_save">
+                                                               <xsl:value-of 
select="php:function('lang', 'save')"/>
+                                                       </xsl:variable>
+                                                       <input type="submit" 
name="values[save]" value="{$lang_save}">
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="php:function('lang', 'save values and exit')"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </td>
+                                       </xsl:when>
+                               </xsl:choose>
                                <td valign="bottom">
-                                       <xsl:variable name="lang_save">
-                                               <xsl:value-of 
select="php:function('lang', 'save')"/>
-                                       </xsl:variable>
-                                       <input type="submit" 
name="values[save]" value="{$lang_save}">
-                                               <xsl:attribute name="title">
-                                                       <xsl:value-of 
select="php:function('lang', 'save values and exit')"/>
-                                               </xsl:attribute>
-                                       </input>
-                               </td>
-                               <td valign="bottom">
                                        <xsl:variable name="lang_apply">
                                                <xsl:value-of 
select="php:function('lang', 'apply')"/>
                                        </xsl:variable>
@@ -856,16 +866,20 @@
                                                </xsl:attribute>
                                        </input>
                                </td>
-                               <td align="right" valign="bottom">
-                                       <xsl:variable name="lang_cancel">
-                                               <xsl:value-of 
select="php:function('lang', 'cancel')"/>
-                                       </xsl:variable>
-                                       <input type="submit" 
name="values[cancel]" value="{$lang_cancel}">
-                                               <xsl:attribute name="title">
-                                                       <xsl:value-of 
select="php:function('lang', 'Back to the list')"/>
-                                               </xsl:attribute>
-                                       </input>
-                               </td>
+                               <xsl:choose>
+                                       <xsl:when test="$lean!=1">
+                                               <td align="right" 
valign="bottom">
+                                                       <xsl:variable 
name="lang_cancel">
+                                                               <xsl:value-of 
select="php:function('lang', 'cancel')"/>
+                                                       </xsl:variable>
+                                                       <input type="submit" 
name="values[cancel]" value="{$lang_cancel}">
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="php:function('lang', 'Back to the list')"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </td>
+                                       </xsl:when>
+                               </xsl:choose>
                        </tr>
                </table>
        </xsl:template>




reply via email to

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