Author: nathangray
New Revision: 53524
URL: http://svn.stylite.de/viewvc/egroupware?rev=53524&view=rev
Log:
Fix vfsUpload widget did not display its value
Modified:
trunk/etemplate/inc/class.etemplate_widget_vfs.inc.php
trunk/etemplate/js/et2_widget_vfs.js
trunk/etemplate/js/etemplate2.js
trunk/etemplate/templates/default/etemplate2.css
Modified: trunk/etemplate/inc/class.etemplate_widget_vfs.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/etemplate/inc/class.etemplate_widget_vfs.inc.php?rev=53524&r1=53523&r2=53524&view=diff
— trunk/etemplate/inc/class.etemplate_widget_vfs.inc.php (original)
+++ trunk/etemplate/inc/class.etemplate_widget_vfs.inc.php Tue Sep 1 00:32:50 2015
@@ -55,7 +55,11 @@
// Single file, already existing
if (substr($path,-1) != ‘/’ && egw_vfs::file_exists($path) && !egw_vfs::is_dir($path))
{
-
$value = $path;
-
$file = egw_vfs::stat($path); -
$file['path'] = egw_vfs::resolve_url($path); -
$file['name'] = egw_vfs::basename($file['path']); -
$file['mime'] = egw_vfs::mime_content_type($file['path']); -
$value = array($file); } else if (substr($path, -1) == '/' && egw_vfs::is_dir($path)) {
@@ -63,6 +67,9 @@
foreach($value as &$file)
{
$file = egw_vfs::stat("$path$file");
-
$file['path'] = $file['url']; -
$file['name'] = egw_vfs::basename($file['path']); -
$file['mime'] = egw_vfs::mime_content_type($file['path']); } } }
@@ -73,7 +80,7 @@
parent::ajax_upload();
foreach($_FILES as $field => $file)
{
-
self::store_file($field, $file);
-
}self::store_file($_REQUEST['widget_id'], $file); }
@@ -134,7 +141,7 @@
* $content array and the application should deal with the file.
*/
public static function store_file($path, $file) {
-
$name = $path;
-
$name = $_REQUEST['widget_id']; // Find real path if($path[0] != '/')
Modified: trunk/etemplate/js/et2_widget_vfs.js
URL: http://svn.stylite.de/viewvc/egroupware/trunk/etemplate/js/et2_widget_vfs.js?rev=53524&r1=53523&r2=53524&view=diff
— trunk/etemplate/js/et2_widget_vfs.js (original)
+++ trunk/etemplate/js/et2_widget_vfs.js Tue Sep 1 00:32:50 2015
@@ -642,10 +642,15 @@
*/
var et2_vfsUpload = et2_file.extend(
{
-
attributes: {
-
"value": { -
"type": "any", // Either nothing, or an object with file info -
} -
},
legacyOptions: [“mime”],asyncOptions: {
-
url: egw.ajaxUrl("etemplate_widget_vfs::ajax_upload::etemplate")
-
target: egw.ajaxUrl(self.egw().getAppName()+".etemplate_widget_vfs.ajax_upload.etemplate")},
/**
@@ -657,16 +662,64 @@
*/
init: function(_parent, attrs) {
this._super.apply(this, arguments);
-
this.input.addClass("et2_vfs");
-
$j(this.node).addClass("et2_vfs"); // If the ID is a directory, allow multiple uploads if(this.options.id.substr(-1) == '/') { this.set_multiple(true); }
- },
-
this.list = $j(document.createElement('table')).appendTo(this.node); - },
- /**
-
- If there is a file / files in the specified location, display them
-
-
- @param {Object[]} _value
- */
set_value: function(_value) { -
this.progress.empty(); -
this.list.empty(); -
for(var i = 0; i < _value.length; i++) -
{ -
this._addFile(_value[i]); -
} - },
- getDOMNode: function(sender) {
-
if(sender !== this && sender._type.indexOf('vfs') >= 0 ) -
{ -
var value = sender.getValue && sender.getValue() || sender.options.value || {}; -
var row = $j('[data-path="'+(value.path)+'"]',this.list); -
if(sender._type === 'vfs-mime') -
{ -
return $j('.icon',row).get(0) || null; -
} -
else -
{ -
return $j('.title',row).get(0) || null; -
} -
} -
else -
{ -
return this._super.apply(this, arguments); -
} - },
- _addFile: function(file_data) {
-
var row = $j(document.createElement("tr")) -
.attr("data-path", file_data.url) -
.attr("draggable", "true") -
.appendTo(this.list); -
var mime = $j(document.createElement("td")) -
.addClass('icon') -
.appendTo(row); -
var title = $j(document.createElement("td")) -
.addClass('title') -
.appendTo(row); -
var mime = et2_createWidget('vfs-mime',{value: file_data},this); -
}var vfs = et2_createWidget('vfs', {value: file_data}, this);
});
et2_register_widget(et2_vfsUpload, [“vfs-upload”]);
Modified: trunk/etemplate/js/etemplate2.js
URL: http://svn.stylite.de/viewvc/egroupware/trunk/etemplate/js/etemplate2.js?rev=53524&r1=53523&r2=53524&view=diff
— trunk/etemplate/js/etemplate2.js (original)
+++ trunk/etemplate/js/etemplate2.js Tue Sep 1 00:32:50 2015
@@ -469,7 +469,7 @@
// Insert the document fragment to the DOM Container
this.DOMContainer.appendChild(frag);
-
if(egw.debug_level >= 3 && console.groupEnd)
-
if(egw.debug_level() >= 3 && console.groupEnd) { egw.window.console.groupEnd(); }
Modified: trunk/etemplate/templates/default/etemplate2.css
URL: http://svn.stylite.de/viewvc/egroupware/trunk/etemplate/templates/default/etemplate2.css?rev=53524&r1=53523&r2=53524&view=diff
— trunk/etemplate/templates/default/etemplate2.css (original)
+++ trunk/etemplate/templates/default/etemplate2.css Tue Sep 1 00:32:50 2015
@@ -864,6 +864,14 @@
}
.et2_vfs li.vfsFilename:not(:last-child):after {
padding: 0.25ex;
+}
+.et2_vfs table {
- width: 100%;
- max-height: 6em;
- overflow: auto;
+}
+.et2_vfs td.icon { - width: 16px;
}
button.et2_vfs_btn {
margin: 0;
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs