fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7416] frontend: more on entity


From: Sigurd Nes
Subject: [Fmsystem-commits] [7416] frontend: more on entity
Date: Wed, 22 Jun 2011 09:38:28 +0000

Revision: 7416
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7416
Author:   sigurdne
Date:     2011-06-22 09:38:27 +0000 (Wed, 22 Jun 2011)
Log Message:
-----------
frontend: more on entity

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

Modified: trunk/frontend/inc/class.uientity.inc.php
===================================================================
--- trunk/frontend/inc/class.uientity.inc.php   2011-06-22 09:30:52 UTC (rev 
7415)
+++ trunk/frontend/inc/class.uientity.inc.php   2011-06-22 09:38:27 UTC (rev 
7416)
@@ -435,8 +435,6 @@
                        $vfs = CreateObject('phpgwapi.vfs');
                        $vfs->override_acl = 1;
 
-                       $vfs->override_acl = 0;
-
                        $j      = count($ticket['files']);
                        for ($i=0;$i<$j;$i++)
                        {
@@ -510,7 +508,7 @@
                                        $j++;
                                }
                        }
-
+                       $vfs->override_acl = 0;
                        //indica que de la fila seleccionada escogera de la 
columna "id" el valor "id". Para agregarlo al URL
                        $parameters = array
                                (
@@ -890,18 +888,26 @@
                                        'type'                  => $this->type
                                );
 
+                       $img_types = array
+                       (
+                               'image/jpeg',
+                               'image/png',
+                               'image/gif'
+                       );
+
                        $content_files = array();
+
                        for($z=0; $z<count($values['files']); $z++)
                        {
-                               $content_files[$z]['file_name'] = '<a 
href="'.$GLOBALS['phpgw']->link('/index.php',$link_file_data).'&amp;file_name='.$values['files'][$z]['name'].'"
 target="_blank" title="'.lang('click to view 
file').'">'.$values['files'][$z]['name'].'</a>';                     
-                               if($mode == 'edit')
+                               $content_files[$z]['url'] = '<a 
href="'.$GLOBALS['phpgw']->link('/index.php',$link_file_data).'&amp;file_name='.$values['files'][$z]['name'].'"
 target="_blank" title="'.lang('click to view 
file').'">'.$values['files'][$z]['name'].'</a>';                   
+                               $content_files[$z]['file_name'] = 
$values['files'][$z]['name'];                 
+
+                               if(in_array($values['files'][$z]['mime_type'], 
$img_types))
                                {
-                                       $content_files[$z]['delete_file'] = 
'<input type="checkbox" name="values[file_action][]" 
value="'.$values['files'][$z]['name'].'" title="'.lang('Check to delete 
file').'">';
+                                       $content_files[$z]['file_name'] = 
urlencode($values['files'][$z]['name']);
+                                       $content_files[$z]['directory'] = 
urlencode($values['files'][$z]['directory']);
+                                       $content_files[$z]['img_id']    = 
$values['files'][$z]['file_id'];
                                }
-                               else
-                               {
-                                       $content_files[$z]['delete_file'] = '';
-                               }
                        }                                                       
                
 
                        $datavalues[0] = array
@@ -917,10 +923,14 @@
                        $myColumnDefs[0] = array
                                (
                                        'name'          => "0",
-                                       'values'        =>      
json_encode(array(      array('key' => 
'file_name','label'=>lang('Filename'),'sortable'=>false,'resizeable'=>true),
-                                       array('key' => 
'delete_file','label'=>lang('Delete 
file'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter')))
+                                       'values'        =>      
json_encode(array(      array('key' => 
'url','label'=>lang('Filename'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                                array('key' => 'file_name','hidden'=>true),
+                                                                               
                                array('key' => 'img_id','hidden'=>true),
+                                                                               
                                array('key' => 'directory','hidden'=>true),
+                                                                               
                                array('key' => 
'picture','label'=>'picture','sortable'=>false,'resizeable'=>false,'visible'=>true,'formatter'=>'show_picture')))
                                );
 
+
                        $msglog = 
phpgwapi_cache::session_get('frontend','msgbox');
                        phpgwapi_cache::session_clear('frontend','msgbox');
                        
@@ -943,10 +953,22 @@
                                                'location_data'         => 
$location_data,
                                                'files'                         
=> isset($values['files'])?$values['files']:'',
                                                'property_js'           => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                                               'base_java_url'         =>      
"{menuaction:'property.uientity.get_files',".
+                                                                               
                "id:'{$id}',".
+                                                                               
                "entity_id:'{$this->entity_id}',".
+                                                                               
                "cat_id:'{$this->cat_id}',".
+                                                                               
                "type:'{$this->type}'}",
                                                'datatable'                     
=> $datavalues,
                                                'myColumnDefs'          => 
$myColumnDefs,       
                                        )
                        );
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('animation');
+                       $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']->xslttpl->add_file(array('frontend', 
'entityview','attributes_view'));

Modified: trunk/frontend/templates/base/attributes_view.xsl
===================================================================
--- trunk/frontend/templates/base/attributes_view.xsl   2011-06-22 09:30:52 UTC 
(rev 7415)
+++ trunk/frontend/templates/base/attributes_view.xsl   2011-06-22 09:38:27 UTC 
(rev 7416)
@@ -26,7 +26,7 @@
                                                        </a>
                                                </xsl:when>
                                                <xsl:otherwise>
-                                                       <xsl:value-of 
select="input_text"/>
+                                                       <b><xsl:value-of 
select="input_text"/></b>
                                                </xsl:otherwise>
                                        </xsl:choose>
                                        <xsl:choose>
@@ -48,12 +48,6 @@
                                <li>
                                        <xsl:choose>
                                                <xsl:when test="name!=''">
-                                                       <input type="hidden" 
name="values_attribute[{counter}][name]" value="{name}"></input>
-                                                       <input type="hidden" 
name="values_attribute[{counter}][datatype]" value="{datatype}"></input>
-                                                       <input type="hidden" 
name="values_attribute[{counter}][history]" value="{history}"></input>
-                                                       <input type="hidden" 
name="values_attribute[{counter}][attrib_id]" value="{id}"></input>
-                                                       <input type="hidden" 
name="values_attribute[{counter}][nullable]" value="{nullable}"></input>
-                                                       <input type="hidden" 
name="values_attribute[{counter}][input_text]" value="{input_text}"></input>
                                                        <xsl:choose>
                                                                <xsl:when 
test="datatype='R'">
                                                                        
<xsl:call-template name="choice"/>
@@ -62,61 +56,22 @@
                                                                        
<xsl:call-template name="choice"/>
                                                                </xsl:when>
                                                                <xsl:when 
test="datatype='LB'">
-                                                                       <select 
name="values_attribute[{counter}][value]" class="forms">
-                                                                               
<xsl:choose>
-                                                                               
        <xsl:when test="disabled!=''">
-                                                                               
                <xsl:attribute name="disabled">
-                                                                               
                        <xsl:text> disabled</xsl:text>
-                                                                               
                </xsl:attribute>
-                                                                               
        </xsl:when>
-                                                                               
</xsl:choose>
-                                                                               
<option value=""><xsl:value-of select="//lang_none"/></option>
+                                                                               
<xsl:attribute name="disabled">
+                                                                               
        <xsl:text> disabled</xsl:text>
+                                                                               
</xsl:attribute>
                                                                                
<xsl:for-each select="choice">
-                                                                               
        <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
                                                                                
        <xsl:choose>
                                                                                
                <xsl:when test="checked='checked'">
-                                                                               
                        <option value="{$id}" selected="selected"><xsl:value-of 
disable-output-escaping="yes" select="value"/></option>
+                                                                               
                        <xsl:value-of disable-output-escaping="yes" 
select="value"/>
                                                                                
                </xsl:when>
-                                                                               
                <xsl:otherwise>
-                                                                               
                        <option value="{$id}"><xsl:value-of 
disable-output-escaping="yes" select="value"/></option>
-                                                                               
                </xsl:otherwise>
                                                                                
        </xsl:choose>
                                                                                
</xsl:for-each>
-                                                                       
</select>
                                                                </xsl:when>
                                                                <xsl:when 
test="datatype='AB'">
                                                                        <table>
                                                                                
<ul>
                                                                                
        <li>
-                                                                               
                <xsl:variable name="contact_name"><xsl:value-of 
select="name"/><xsl:text>_name</xsl:text></xsl:variable>
-                                                                               
                <xsl:variable 
name="lookup_function"><xsl:text>lookup_</xsl:text><xsl:value-of 
select="name"/><xsl:text>();</xsl:text></xsl:variable>
-                                                                               
                <xsl:variable 
name="clear_function"><xsl:text>clear_</xsl:text><xsl:value-of 
select="name"/><xsl:text>();</xsl:text></xsl:variable>
-                                                                               
                <input type="hidden" name="{name}" value="{value}" 
onClick="{$lookup_function}" readonly="readonly" size="5">
-                                                                               
                        <xsl:choose>
-                                                                               
                                <xsl:when test="disabled!=''">
-                                                                               
                                        <xsl:attribute name="disabled">
-                                                                               
                                                <xsl:text> disabled</xsl:text>
-                                                                               
                                        </xsl:attribute>
-                                                                               
                                </xsl:when>
-                                                                               
                        </xsl:choose>
-                                                                               
                </input>
-                                                                               
                <input  size="30" type="text" name="{$contact_name}" 
value="{contact_name}"  onClick="{$lookup_function}" readonly="readonly"> 
-                                                                               
                        <xsl:choose>
-                                                                               
                                <xsl:when test="disabled!=''">
-                                                                               
                                        <xsl:attribute name="disabled">
-                                                                               
                                                <xsl:text> disabled</xsl:text>
-                                                                               
                                        </xsl:attribute>
-                                                                               
                                </xsl:when>
-                                                                               
                        </xsl:choose>
-                                                                               
                </input>
-                                                                               
                <input type="checkbox" name="clear_{name}_box"  
onClick="{$clear_function}" >
-                                                                               
                        <xsl:attribute name="title">
-                                                                               
                                <xsl:value-of select="php:function('lang', 
'delete')" />
-                                                                               
                        </xsl:attribute>
-                                                                               
                        <xsl:attribute name="readonly">
-                                                                               
                                <xsl:text>readonly</xsl:text>
-                                                                               
                        </xsl:attribute>
-                                                                               
                </input>
+                                                                               
                        <xsl:value-of select="contact_name"/>
                                                                                
        </li>
                                                                                
</ul>
                                                                                
<xsl:choose>
@@ -245,16 +200,7 @@
                                                                        <img 
id="values_attribute_{counter}-trigger" src="{img_cal}" alt="{lang_datetitle}" 
title="{lang_datetitle}" style="cursor:pointer; cursor:hand;" />
                                                                </xsl:when>
                                                                <xsl:when 
test="datatype='T'">
-                                                                       
<textarea cols="{//textareacols}" rows="{//textarearows}" 
name="values_attribute[{counter}][value]" >
-                                                                               
<xsl:choose>
-                                                                               
        <xsl:when test="disabled!=''">
-                                                                               
                <xsl:attribute name="disabled">
-                                                                               
                        <xsl:text> disabled</xsl:text>
-                                                                               
                </xsl:attribute>
-                                                                               
        </xsl:when>
-                                                                               
</xsl:choose>
-                                                                               
<xsl:value-of select="value"/>
-                                                                       
</textarea>
+                                                                       
<xsl:value-of select="value"/>
                                                                </xsl:when>
                                                                <xsl:when 
test="datatype='pwd'">
                                                                        <table>
@@ -359,15 +305,7 @@
                                                                        
</xsl:choose>
                                                                </xsl:when>
                                                                <xsl:otherwise>
-                                                                       <input 
type="text" name="values_attribute[{counter}][value]" value="{value}" size="30">
-                                                                               
<xsl:choose>
-                                                                               
        <xsl:when test="disabled!=''">
-                                                                               
                <xsl:attribute name="disabled">
-                                                                               
                        <xsl:text> disabled</xsl:text>
-                                                                               
                </xsl:attribute>
-                                                                               
        </xsl:when>
-                                                                               
</xsl:choose>
-                                                                       </input>
+                                                                       
<xsl:value-of select="value"/>
                                                                </xsl:otherwise>
                                                        </xsl:choose>
                                                        <xsl:choose>

Modified: trunk/frontend/templates/base/entityview.xsl
===================================================================
--- trunk/frontend/templates/base/entityview.xsl        2011-06-22 09:30:52 UTC 
(rev 7415)
+++ trunk/frontend/templates/base/entityview.xsl        2011-06-22 09:38:27 UTC 
(rev 7416)
@@ -1,5 +1,28 @@
 <xsl:template match="entityinfo" xmlns:php="http://php.net/xsl";>
        
+       <script type="text/javascript">
+               var property_js = <xsl:value-of select="property_js" />;
+               var base_java_url = <xsl:value-of select="base_java_url" />;
+               var datatable = new Array();
+               var myColumnDefs = new Array();
+
+               <xsl:for-each select="datatable">
+                       datatable[<xsl:value-of select="name"/>] = [
+                       {
+                       values                  :       <xsl:value-of 
select="values"/>,
+                       total_records   :       <xsl:value-of 
select="total_records"/>,
+                       edit_action             :       <xsl:value-of 
select="edit_action"/>,
+                       is_paginator    :       <xsl:value-of 
select="is_paginator"/>,
+                       footer                  :       <xsl:value-of 
select="footer"/>
+                       }
+                       ]
+               </xsl:for-each>
+
+               <xsl:for-each select="myColumnDefs">
+                       myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+               </xsl:for-each>
+       </script>
+
     <table cellpadding="2" cellspacing="2" width="95%" align="center">
         <xsl:choose>
             <xsl:when test="msgbox_data != ''">
@@ -22,6 +45,9 @@
                                <li>
                                                <xsl:choose>
                                                        <xsl:when 
test="location_data!=''">
+                                                               <li>
+                                                                       
<b><xsl:value-of select="php:function('lang', 'location')"/></b>
+                                                               </li>
                                                                <div 
id="location">
                                                                        <table>
                                                                                
<xsl:call-template name="location_view"/>
@@ -37,17 +63,7 @@
                                        <xsl:choose>
                                                <xsl:when test="files!=''">
                                                        <li>
-                                                               <table 
cellpadding="2" cellspacing="2" width="80%" align="center">
-                                                                       <!-- 
<xsl:call-template name="file_list"/> -->
-                                                                       <tr>
-                                                                               
<td align="left" valign="top">
-                                                                               
        <xsl:value-of select="php:function('lang', 'files')"/>
-                                                                               
</td>
-                                                                               
<td>
-                                                                               
        <div id="datatable-container_0"></div>
-                                                                               
</td>
-                                                                       </tr>
-                                                               </table>
+                                                               <div 
id="datatable-container_0"></div>
                                                        </li>
                                                </xsl:when>
                                        </xsl:choose>




reply via email to

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