fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7167] property: more on fileuploader


From: Sigurd Nes
Subject: [Fmsystem-commits] [7167] property: more on fileuploader
Date: Sun, 03 Apr 2011 17:14:52 +0000

Revision: 7167
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7167
Author:   sigurdne
Date:     2011-04-03 17:14:52 +0000 (Sun, 03 Apr 2011)
Log Message:
-----------
property: more on fileuploader

Modified Paths:
--------------
    trunk/property/inc/class.botts.inc.php
    trunk/property/inc/class.fileuploader.inc.php
    trunk/property/js/yahoo/entity.edit.js
    trunk/property/setup/phpgw_no.lang
    trunk/property/templates/base/config.tpl
    trunk/property/templates/base/tts.xsl

Modified: trunk/property/inc/class.botts.inc.php
===================================================================
--- trunk/property/inc/class.botts.inc.php      2011-04-03 17:14:19 UTC (rev 
7166)
+++ trunk/property/inc/class.botts.inc.php      2011-04-03 17:14:52 UTC (rev 
7167)
@@ -1169,13 +1169,12 @@
                                }
                                $GLOBALS['phpgw']->common->phpgw_exit();
                        }
-
-                       
-       //              if($check)
+       
+                       if($check)
                        {
-       //                      $fileuploader->check($bofiles, 
"fmticket/{$id}");
+                               $fileuploader->check("fmticket/{$id}");
                        }
-       //              else
+                       else
                        {
                                $fileuploader->upload("fmticket/{$id}");
                        }

Modified: trunk/property/inc/class.fileuploader.inc.php
===================================================================
--- trunk/property/inc/class.fileuploader.inc.php       2011-04-03 17:14:19 UTC 
(rev 7166)
+++ trunk/property/inc/class.fileuploader.inc.php       2011-04-03 17:14:52 UTC 
(rev 7167)
@@ -67,7 +67,7 @@
                                        $oArgs .= ",'" . 
substr($varname,1,strlen($varname)-1) . "':'{$value}'";
                                }
                        }
-                       $oArgs .= '}';
+//                     $oArgs .= '}';
 
 /*
                        $str_base_url = 'http';
@@ -77,149 +77,182 @@
 
                        $str_base_url .= $GLOBALS['phpgw']->link('/', array(), 
true);
 */
+
+                       $config = CreateObject('phpgwapi.config','property');
+                       $config->read();
+                       $ntlm_alternative_host = 
isset($config->config_data['ntlm_alternative_host']) ? 
$config->config_data['ntlm_alternative_host'] : '';
+                       $scriptAccess = $ntlm_alternative_host ? 'always' : 
'sameDomain';
+                       
                        $title = lang('fileuploader');
-                       $html = <<<HTML
-                               <!DOCTYPE html>
-                               <html>
-                                       <head>
-                                               <title>{$title}</title>
-                                               <link 
href="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/uploadify.css"
 type="text/css" rel="stylesheet" />
-                                               <script type="text/javascript" 
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/core/base.js"></script>
-                                               <script type="text/javascript" 
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/jquery-1.4.2.min.js"></script>
-                                               <script type="text/javascript" 
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/swfobject.js"></script>
-                                               <script type="text/javascript" 
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/jquery.uploadify.v2.1.4.min.js"></script>
-                                               <script type="text/javascript">
-
-                                                       
$(document).ready(function()
-                                                       {
-                                                               
$('#custom_file_upload').uploadify({
-                                       
-                                                                       
'uploader'       : 
'{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/uploadify.swf',
-                                                                       
'script'         : 
'{$GLOBALS['phpgw_info']['server']['webserver_url']}/index.php',
-                                                       //              
'checkScript'    : 
'{$GLOBALS['phpgw_info']['server']['webserver_url']}/index.php?check=1',
-                                                                       
'cancelImg'      : 
'{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/cancel.png',
-                                                                       
'method'         : 'GET',
-                                                                       'multi' 
             : true,
-                                                                       'auto'  
         : true,
-                                                                       
'fileExt'        : '*.jpg;*.gif;*.png',
-                                                                       
'fileDesc'       : 'Image Files (.JPG, .GIF, .PNG)',
-                                                                       
'queueID'        : 'custom-queue',
-                                                                       
'queueSizeLimit' : 50,
-                                                                       
'simUploadLimit' : 50,
-                                                                       
'scriptData'     : $oArgs,
-                                                                       
'removeCompleted': false,
-                                                                       
'onError'        : function (event,ID,fileObj,errorObj) {
-                                                                               
alert(errorObj.type + ' Error: ' + errorObj.info);
-                                                                         },
-                                                                       
'onSelectOnce'   : function(event,data) {
-                                                                           
$('#status-message').text(data.filesSelected + ' files have been added to the 
queue.');
-                                                                         },
-                                                                       
'onAllComplete'  : function(event,data) {
-                                                                           
$('#status-message').text(data.filesUploaded + ' files uploaded, ' + 
data.errors + ' errors.');
-                                               //                              
try
-                                                                               
{
-                                               //                              
        parent.refresh_files();
-                                                                               
}
-                                               //                              
catch (ex)
-                                                                               
{
-                                                                               
        alert('Du må laste siden på nytt for å vise resultatet');
-                                                                               
}
-                                                                               
parent.lightbox.hide();
-                                                                         }
+                       $version = 2;                   
+                       if($version == 2)
+                       {
+                               $oArgs .= '}';
+                               $html = <<<HTML
+                                       <!DOCTYPE html>
+                                       <html>
+                                               <head>
+                                                       <title>{$title}</title>
+                                                       <link 
href="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/uploadify.css"
 type="text/css" rel="stylesheet" />
+                                                       <script 
type="text/javascript" 
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/core/base.js"></script>
+                                                       <script 
type="text/javascript" 
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/jquery-1.4.2.min.js"></script>
+                                                       <script 
type="text/javascript" 
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/swfobject.js"></script>
+                                                       <script 
type="text/javascript" 
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/jquery.uploadify.v2.1.4.min.js"></script>
+                                                       <script 
type="text/javascript">
+       
+                                                               
$(document).ready(function()
+                                                               {
+                                                                       
$('#file_upload').uploadify({
+                                               
+                                                                               
'uploader'       : 
'{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/uploadify.swf',
+                                                                               
'script'         : 
'{$ntlm_alternative_host}{$GLOBALS['phpgw_info']['server']['webserver_url']}/index.php',
+                                                               //              
'checkScript'    : 
'{$GLOBALS['phpgw_info']['server']['webserver_url']}/index.php?check=1',
+                                                                               
'cancelImg'      : 
'{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/cancel.png',
+                                                                               
'method'         : 'GET',
+                                                               //              
'scriptAccess'   : '{$scriptAccess}',//'sameDomain'|'always' Set to "always" to 
allow script access across domains
+                                                                               
'multi'              : true,
+                                                                               
'auto'           : true,
+                                                                               
'fileExt'        : '*.jpg;*.gif;*.png',
+                                                                               
'fileDesc'       : 'Image Files (.JPG, .GIF, .PNG)',
+                                                                               
'queueID'        : 'queue',
+                                                                               
'queueSizeLimit' : 50,
+                                                                               
'simUploadLimit' : 50,
+                                                                               
'scriptData'     : $oArgs,
+                                                                               
'removeCompleted': false,
+                                                                               
'onError'        : function (event,ID,fileObj,errorObj) {
+                                                                               
        alert(errorObj.type + ' Error: ' + fileObj.name + ' failed');
+                                                                               
  },
+                                                                               
'onSelectOnce'   : function(event,data) {
+                                                                               
    $('#status-message').text(data.filesSelected + ' files have been added to 
the queue.');
+                                                                               
  },
+                                                                               
'onAllComplete'  : function(event,data) {
+                                                                               
    $('#status-message').text(data.filesUploaded + ' files uploaded, ' + 
data.errors + ' errors.');
+                                                                               
        try
+                                                                               
        {
+                                                                               
                parent.refresh_files();
+                                                                               
        }
+                                                                               
        catch (ex)
+                                                                               
        {
+                                                                               
                alert('Du må laste siden på nytt for å vise resultatet');
+                                                                               
        }
+                                                                               
        parent.lightbox.hide();
+                                                                               
  }
+                                                                       });
                                                                });
-                                                       });
-                                               </script>
-                               
-                                       </head>
+                                                       </script>       
+                                               </head>
                                        <body>
                                                <div id="content" align = 
'center'>
                                                        <h2>{$title}</h2>
                                                        <div 
id="status-message">Select some files to upload:</div>
-                                                       <div 
id="custom-queue"></div>
-                                                       <input 
id="custom_file_upload" type="file" name="Filedata" />
+                                                       <div id="queue"></div>
+                                                       <input id="file_upload" 
type="file" name="Filedata" />
                                                </div>
                                        </body>
                                </html>
 HTML;
+                       }
+                       else
+                       {
+                               $str_base_url = $ntlm_alternative_host . 
$GLOBALS['phpgw']->link('/', array(), true);
+                               $oArgs_check = "{$oArgs},check:1}";
+                               
+                               $oArgs .= '}';
 
-                       echo $html;
-               }
+                               $html = <<<HTML
+                                       <!DOCTYPE html>
+                                       <html>
+                                               <head>
+                                                       <title>{$title}</title>
+                                                       <link 
href="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/uploadify_v3.css"
 type="text/css" rel="stylesheet" />
+                                                       <script 
type="text/javascript" 
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/core/base.js"></script>
+                                                       <script 
type="text/javascript" 
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/swfobject.js"></script>
+                                                       <script 
type="text/javascript" 
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/jquery-1.4.2.min.js"></script>
+                                                       <script 
type="text/javascript" 
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/jquery.uploadify_v3.js"></script>
 
-/*
-// might be usefull for the upcoming version 3
-                                               <link 
href="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/uploadify_v3.css"
 type="text/css" rel="stylesheet" />
-                                               <script type="text/javascript" 
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/core/base.js"></script>
-                                               <script type="text/javascript" 
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/swfobject.js"></script>
-                                               <script type="text/javascript" 
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/jquery-1.4.2.min.js"></script>
-                                               <script type="text/javascript" 
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/jquery.uploadify_v3.js"></script>
+                                                       <script 
type="text/javascript">
 
+                                                               var strBaseURL 
= '{$str_base_url}';
+                                                               var sUrl = 
phpGWLink('index.php', $oArgs_check);
+                                                       //      alert(sUrl);
 
-                                               <script type="text/javascript">
+                                                               
$(document).ready(function()
+                                                               {
+                                                                       
$('#file_upload').uploadify({
+                                                                               
'swf'              : 
'{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/uploadify_v3.swf',
+                                                                               
'uploader'         : 
'{$ntlm_alternative_host}{$GLOBALS['phpgw_info']['server']['webserver_url']}/index.php',
+                                                                               
'checkExisting'    : sUrl,
+                                                                               
'cancelImage'      : 
'{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/cancel.png',
+                                                                               
'uploaderType'     : 'flash', // 'html5'|'flash'
+                                                                               
'requeueErrors'    : false,
+                                                                               
'allowScriptAccess': '{$scriptAccess}',//'sameDomain'|'always' Set to "always" 
to allow script access across domains
+                                                                               
'debug'                    : false,
+                                                                               
'method'           : 'GET',
+                                                                               
'multi'                : true,
+                                                                               
'auto'             : true,
+                                                                               
'fileTypeExts'     : '*.jpg;*.gif;*.png',
+                                                                               
'fileTypeDesc'     : 'Image Files (.JPG, .GIF, .PNG)',
+                                                                               
'queueID'          : 'queue',
+                                                                               
'queueSizeLimit'   : 50,
+                                                                               
'simUploadLimit'   : 50,
+                                                                               
'postData'         : $oArgs,
+                                                                               
'removeCompleted'  : false,
+                                                                               
'onUploadError'        : function (file,errorCode,errorMsg,errorString) {
+                                                                               
        alert(file.name + ' Error: ' + errorString);
+                                                                               
  },
+                                                                               
'onSelect'   : function(file) {
+                                                                               
    $('#status-message').text(file.name + ' files have been added to the 
queue.');
+                                                                               
},
+                                                                               
'onUploadComplete'  : function(event,data) {
+                                                                               
    $('#status-message').text(data.filesUploaded + ' files uploaded, ' + 
data.errors + ' errors.');
+                                                                               
        try
+                                                                               
        {
+                                                                               
                parent.refresh_files();
+                                                                               
        }
+                                                                               
        catch (ex)
+                                                                               
        {
+                                                                               
                alert('you need to manually refresh the file list');
+                                                                               
        }
+                                                                               
        parent.lightbox.hide();
+                                                                               
  }
+                                                                       });
+                                                               });
+                                                       </script>
+                                               </head>
+                                       <body>
+                                               <div id="content" align = 
'center'>
+                                                       <h2>{$title}</h2>
+                                                       <div 
id="status-message">Select some files to upload:</div>
+                                                       <div id="queue"></div>
+                                                       <input id="file_upload" 
type="file" name="Filedata" />
+                                               </div>
 
-                                                       
$(document).ready(function()
-                                                       {
-                                                               
$('#file_upload').uploadify({
-                                       
-                                                                       'swf'   
    : 
'{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/uploadify_v3.swf',
-                                                                       
'uploader'         : 
'{$GLOBALS['phpgw_info']['server']['webserver_url']}/index.php',
-                                                               //      
'checkExisting'    : 
'{$GLOBALS['phpgw_info']['server']['webserver_url']}/index.php?check=1',
-                                                                       
'cancelImage'    : 
'{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/uploadify/cancel.png',
-                                                                       
'uploaderType'   : 'flash', // 'html5'|'flash'
-                                                                       
'requeueErrors'  : false
-                                                                       'debug' 
                 : true,
-                                                                       
'method'         : 'GET',
-                                                                       'multi' 
             : true,
-                                                                       'auto'  
         : true,
-                                                                       
'fileTypeExts'   : '*.jpg;*.gif;*.png',
-                                                                       
'fileTypeDesc'   : 'Image Files (.JPG, .GIF, .PNG)',
-                                                                       
'queueID'        : 'queue',
-                                                                       
'queueSizeLimit' : 50,
-                                                                       
'simUploadLimit' : 50,
-                                                                       
'postData'       : $oArgs,
-                                                                       
'removeCompleted': false,
+                                       </body>
+                               </html>
+HTML;
+                       }
+                       echo $html;
+               }
 
-                                                                       
'onUploadError'        : function (file,errorCode,errorMsg,errorString) {
-                                                                               
alert(file.name + ' Error: ' + errorString);
-                                                                         },
-                                                                       
'onSelect'   : function(event,data) {
-                                                                           
$('#status-message').text(data.filesSelected + ' files have been added to the 
queue.');
-                                                                         },
-                                                                       
'onUploadComplete'  : function(event,data) {
-                                                                           
$('#status-message').text(data.filesUploaded + ' files uploaded, ' + 
data.errors + ' errors.');
-                                                                               
try
-                                                                               
{
-                                                                               
        parent.refresh_files();
-                                                                               
}
-                                                                               
catch (ex)
-                                                                               
{
-                                                                               
        alert('you need to manually refresh the file list');
-                                                                               
}
 
-                                                                         }
-                                                               });
-                                                       });
-                                               </script>
-*/
 
-               public function check($bofiles, $save_path = '')
+               public function check($save_path = '')
                {
-                       $fileArray = array();
-                       foreach ($_POST as $key => $value)
+                       $bofiles        = CreateObject('property.bofiles');
+
+                       $to_file        = 
"{$bofiles->fakebase}/{$save_path}/{$_POST['filename']}";
+                       //Return true if the file exists
+
+                       if ($bofiles->vfs->file_exists(array(
+                               'string' => $to_file,
+                               'relatives' => Array(RELATIVE_NONE))))
                        {
-                               if ($key != 'folder')
-                               {
-                                       $to_file        = 
"{$save_path}/{$value}";
-
-                                       if ($bofiles->vfs->file_exists(array(
-                                               'string' => $to_file,
-                                               'relatives' => 
Array(RELATIVE_NONE)
-                                       )))
-                                       {
-                                               $fileArray[$key] = $value;
-                                       }
-                               }
+                               echo 1;
                        }
-                       echo json_encode($fileArray);
+                       else
+                       {
+                               echo 0;
+                       }
                        $GLOBALS['phpgw']->common->phpgw_exit();
                }
 

Modified: trunk/property/js/yahoo/entity.edit.js
===================================================================
--- trunk/property/js/yahoo/entity.edit.js      2011-04-03 17:14:19 UTC (rev 
7166)
+++ trunk/property/js/yahoo/entity.edit.js      2011-04-03 17:14:52 UTC (rev 
7167)
@@ -31,7 +31,8 @@
 
        this.refresh_files = function()
        {
-               execute_async(myDataTable_2);
+               base_java_url['action'] = 'get_files';
+               execute_async(myDataTable_0);
        }
 
 

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2011-04-03 17:14:19 UTC (rev 7166)
+++ trunk/property/setup/phpgw_no.lang  2011-04-03 17:14:52 UTC (rev 7167)
@@ -399,7 +399,7 @@
 day of week (0-6, 0=sun)       property        no      Ukedag (0-6, 0=søndag)
 days   property        no      Dager
 deadline       property        no      Frist
-debug  common  no      kontroller
+debug  common  no      Debug
 debug output in browser        property        no      Kontroller data før  
import
 decimal        property        no      desimal
 default        property        no      Standard

Modified: trunk/property/templates/base/config.tpl
===================================================================
--- trunk/property/templates/base/config.tpl    2011-04-03 17:14:19 UTC (rev 
7166)
+++ trunk/property/templates/base/config.tpl    2011-04-03 17:14:52 UTC (rev 
7167)
@@ -465,6 +465,12 @@
                                </table>
                        </td>
                </tr>
+
+               <tr class="row_off">
+                       <td>{lang_ntlm_alternative_host}:</td>
+                       <td><input name="newsettings[ntlm_alternative_host]" 
value="{value_ntlm_alternative_host}"></td>
+               </tr>
+
                <!--
                groupnotification
                -->

Modified: trunk/property/templates/base/tts.xsl
===================================================================
--- trunk/property/templates/base/tts.xsl       2011-04-03 17:14:19 UTC (rev 
7166)
+++ trunk/property/templates/base/tts.xsl       2011-04-03 17:14:52 UTC (rev 
7167)
@@ -1067,8 +1067,7 @@
                        </tr>
 
                        <xsl:choose>
-                               <xsl:when test="files!=''">
-                                       <!-- <xsl:call-template 
name="file_list"/> -->                                          
+                               <xsl:when test="fileupload = 1">
                                        <tr>
                                                <td width="19%" align="left" 
valign="top">
                                                        <xsl:value-of 
select="php:function('lang', 'files')" />




reply via email to

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