Use filemanager popup to allow linking to already existing files

This commit is contained in:
Nathan Gray 2012-07-02 23:03:27 +00:00
parent 235d9b3285
commit ff19062265
3 changed files with 26 additions and 2 deletions

View File

@ -230,6 +230,9 @@ class etemplate_widget_link extends etemplate_widget
$link = egw_vfs::concat($app_path,egw_vfs::basename($target)); $link = egw_vfs::concat($app_path,egw_vfs::basename($target));
egw_vfs::symlink($target,$link); egw_vfs::symlink($target,$link);
} }
// Return js to refresh opener and close popup
return 'window.close();';
} }
public function ajax_delete($value) { public function ajax_delete($value) {

View File

@ -129,6 +129,7 @@ var et2_link_to = et2_inputWidget.extend({
et2_link_entry.prototype.set_blur(this.egw().lang("Comment..."),this.comment); et2_link_entry.prototype.set_blur(this.egw().lang("Comment..."),this.comment);
// Filemanager link popup // Filemanager link popup
var self = this;
this.filemanager_button = $j(document.createElement("img")) this.filemanager_button = $j(document.createElement("img"))
.attr("src", this.egw().image("filemanager/navbar")) .attr("src", this.egw().image("filemanager/navbar"))
.addClass("et2_button et2_button_icon") .addClass("et2_button et2_button_icon")
@ -136,11 +137,30 @@ var et2_link_to = et2_inputWidget.extend({
.click(this, function(e) { .click(this, function(e) {
// Open the filemanager select in a popup // Open the filemanager select in a popup
var values = e.data.options.value; var values = e.data.options.value;
e.data.egw().open_link( var popup = e.data.egw().open_link(
'/index.php?menuaction=filemanager.filemanager_select.select&mode=open-multiple&method=etemplate_widget_link::link_existing&label=link&id=' + values.to_app + ":" + values.to_id, '/index.php?menuaction=filemanager.filemanager_select.select&mode=open-multiple&method=etemplate_widget_link::link_existing&label=link&id=' + values.to_app + ":" + values.to_id,
false, 'link_existing',
'640x580' '640x580'
); );
if(popup)
{
// Update on close doesn't always (ever, in chrome) work, so poll
var poll = self.egw().window.setInterval(
function() {
if(popup.closed) {
self.getRoot().iterateOver(
function(widget) {
if(widget.id == self.id) {
widget._get_links();
}
},
self, et2_link_list
)
self.egw().window.clearInterval(poll);
}
},1000);
}
}); });
// Need a div for file upload widget // Need a div for file upload widget

View File

@ -540,6 +540,7 @@ ul.et2_link_string {
*/ */
ul.et2_vfs { ul.et2_vfs {
padding-left: 0px; padding-left: 0px;
margin: 1px;
} }
.et2_vfs li.vfsFilename { .et2_vfs li.vfsFilename {
display: inline; display: inline;