fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6649] Property: multiuploader


From: Sigurd Nes
Subject: [Fmsystem-commits] [6649] Property: multiuploader
Date: Fri, 26 Nov 2010 17:21:19 +0000

Revision: 6649
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6649
Author:   sigurdne
Date:     2010-11-26 17:21:18 +0000 (Fri, 26 Nov 2010)
Log Message:
-----------
Property: multiuploader

Modified Paths:
--------------
    trunk/property/inc/class.uientity.inc.php
    trunk/property/js/yahoo/entity.edit.js
    trunk/property/templates/base/entity.xsl

Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php   2010-11-26 12:24:34 UTC (rev 
6648)
+++ trunk/property/inc/class.uientity.inc.php   2010-11-26 17:21:18 UTC (rev 
6649)
@@ -57,8 +57,9 @@
                        'attrib_history'=> true,
                        'attrib_help'   => true,
                        'print_pdf'             => true,
-                       'index'         => true,
-                       'addfiles'      => true
+                       'index'                 => true,
+                       'addfiles'              => true,
+                       'get_files'             => true
                );
 
                function property_uientity()
@@ -194,6 +195,63 @@
                        $fileuploader->upload($bofiles, 
"{$bofiles->fakebase}/{$this->category_dir}/{$loc1}/{$id}");
                }
 
+               function get_files()
+               {
+                       $id     = phpgw::get_var('id', 'int');
+
+                       if( !$this->acl_read)
+                       {
+                               return;
+                       }
+
+                       $values = 
$this->bo->read_single(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'id'=>$id));
+
+                       $link_file_data = array
+                       (
+                               'menuaction'    => 
'property.uientity.view_file',
+                               'loc1'                  => 
$values['location_data']['loc1'],
+                               'id'                    => $id,
+                               'cat_id'                => $this->cat_id,
+                               'entity_id'             => $this->entity_id,
+                               'type'                  => $this->type
+                       );
+
+                       if(isset($values['files']) && 
is_array($values['files']))
+                       {
+                               $j      = count($values['files']);
+                               for ($i=0;$i<$j;$i++)
+                               {
+                                       
$values['files'][$i]['file_name']=urlencode($values['files'][$i]['name']);
+                               }
+                       }
+
+
+                       $content_files = array();
+                       foreach($values['files'] as $_entry )
+                       {
+                               $content_files[] = array
+                               (
+                                       'file_name' => '<a 
href="'.$GLOBALS['phpgw']->link('/index.php',$link_file_data).'&amp;file_name='.$_entry['name'].'"
 target="_blank" title="'.lang('click to view 
file').'">'.$_entry['name'].'</a>',
+                                       'delete_file' => '<input 
type="checkbox" name="values[file_action][]" value="'.$_entry['name'].'" 
title="'.lang('Check to delete file').'">'
+                               );
+                       }                                                       
                
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+
+                               if(count($content_files))
+                               {
+                                       return json_encode($content_files);
+                               }
+                               else
+                               {
+                                       return "";
+                               }
+                       }
+                       return $content_files;
+               }
+
+
                function columns()
                {
                //cramirez: necesary for windows.open . Avoid error JS
@@ -1716,7 +1774,12 @@
                                'textarearows'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6,
                                'tabs'                                          
        => phpgwapi_yui::tabview_generate($tabs, $active_tab),
                                'integration'                                   
=> $integration,
-                               'value_integration_src'                 => 
$integration_src
+                               'value_integration_src'                 => 
$integration_src,
+                               'base_java_url'                                 
=>      "{menuaction:'property.uientity.get_files',".
+                                                                               
                                        "id:'{$id}',".
+                                                                               
                                        "entity_id:'{$this->entity_id}',".
+                                                                               
                                        "cat_id:'{$this->cat_id}',".
+                                                                               
                                        "type:'{$this->type}'}"
                        );
 
                        phpgwapi_yui::load_widget('dragdrop');

Modified: trunk/property/js/yahoo/entity.edit.js
===================================================================
--- trunk/property/js/yahoo/entity.edit.js      2010-11-26 12:24:34 UTC (rev 
6648)
+++ trunk/property/js/yahoo/entity.edit.js      2010-11-26 17:21:18 UTC (rev 
6649)
@@ -1,7 +1,8 @@
 var  myDataSource, myDataTable, myContextMenu;
 var  myPaginator_0, myDataTable_0
 var  myPaginator_1, myDataTable_1;
-
+var d;
+var  uploadsuccess = 0;
 
/********************************************************************************/
 var FormatterCenter = function(elCell, oRecord, oColumn, oData)
 {
@@ -14,7 +15,6 @@
        {
        }
 
-
        this.fileuploader = function()
        {
                var sUrl = phpGWLink('index.php', fileuploader_action);
@@ -23,14 +23,34 @@
                        var frame = document.createElement('iframe');
                        frame.src = sUrl;
                        frame.width = "100%";
-                       frame.height = "600";
+                       frame.height = "400";
                        o.setBody(frame);
                };
                lightbox.showEvent.subscribe(onDialogShow, lightbox);
                lightbox.show();
        }
 
+       this.refresh_files = function()
+       {
+               if(document.getElementById('uploadsuccess').value != 
uploadsuccess)
+               {
+                       execute_async(myDataTable_0);
+                       uploadsuccess = 
document.getElementById('uploadsuccess').value;
+               }
+       }
 
+       this.onDOMAttrModified = function(e)
+       {
+               var attr = e.attrName || e.propertyName
+               var target = e.target || e.srcElement;
+               if (attr.toLowerCase() == 'uploadsuccess')
+               {
+                       refresh_files();
+               }
+       }
+
+
+
 YAHOO.util.Event.addListener(window, "load", function()
                {
                        var loader = new YAHOO.util.YUILoader();
@@ -60,3 +80,17 @@
 
                YAHOO.util.Dom.setStyle('lightbox-placeholder', 'display', 
'block');
 });
+
+YAHOO.util.Event.addListener(window, "load", function()
+{
+       d = document.getElementById('uploadsuccess');
+       if (d.attachEvent)
+       {
+               d.attachEvent('onpropertychange', onDOMAttrModified, false);
+       }
+       else
+       {
+               d.addEventListener('DOMAttrModified', onDOMAttrModified, false);
+       }
+});
+

Modified: trunk/property/templates/base/entity.xsl
===================================================================
--- trunk/property/templates/base/entity.xsl    2010-11-26 12:24:34 UTC (rev 
6648)
+++ trunk/property/templates/base/entity.xsl    2010-11-26 17:21:18 UTC (rev 
6649)
@@ -27,6 +27,7 @@
                
                <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();
 
@@ -235,6 +236,14 @@
                                                                <div 
id="datatable-container_0"></div>
                                                        </td>
                                                </tr>
+                                               <tr>
+                                                       <td align="left" 
valign="top">
+                                                       </td>
+                                                       <td>
+                                                               <input 
type="button" id="refresh" value="refresh files" onclick="refresh_files();"/>
+                                                       </td>
+                                               </tr>
+
                                                <xsl:choose>
                                                        <xsl:when 
test="cat_list='' and fileupload = 1 and mode = 'edit'">
                                                                
<xsl:call-template name="file_upload"/>
@@ -286,7 +295,7 @@
                        </table>
                </xsl:when>
        </xsl:choose>
-
+               <input type="hidden" id="uploadsuccess" name="uploadsuccess" 
value="0"/>
                </div>
                </form>
                <xsl:choose>
@@ -334,6 +343,7 @@
        <div id="lightbox-placeholder" 
style="background-color:#000000;color:#FFFFFF;display:none">
                <div class="hd" style="background-color:#000000;color:#000000; 
border:0; text-align:center"> <xsl:value-of select="php:function('lang', 
'fileuploader')" /> </div>
                <div class="bd" style="text-align:center;"> </div>
+
        </div>
 
        </xsl:template>




reply via email to

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