mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
Add a button to allow linking to existing VFS files - work in progress
This commit is contained in:
parent
69812c92ee
commit
b2817cf358
@ -212,6 +212,26 @@ class etemplate_widget_link extends etemplate_widget
|
||||
$response->data($result !== false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Symlink an existing file in filemanager
|
||||
*/
|
||||
public static function link_existing($app_id, $files)
|
||||
{
|
||||
list($app, $id) = explode(':', $app_id);
|
||||
$app_path = "/apps/$app/$id";
|
||||
|
||||
if(!is_array($files)) $files = array($files);
|
||||
foreach($files as $target) {
|
||||
if (!egw_vfs::stat($target))
|
||||
{
|
||||
return lang('Link target %1 not found!',egw_vfs::decodePath($target));
|
||||
break;
|
||||
}
|
||||
$link = egw_vfs::concat($app_path,egw_vfs::basename($target));
|
||||
egw_vfs::symlink($target,$link);
|
||||
}
|
||||
}
|
||||
|
||||
public function ajax_delete($value) {
|
||||
$response = egw_json_response::get();
|
||||
$response->data(egw_link::unlink($value));
|
||||
|
@ -128,6 +128,21 @@ var et2_link_to = et2_inputWidget.extend({
|
||||
.appendTo(this.div).hide();
|
||||
et2_link_entry.prototype.set_blur(this.egw().lang("Comment..."),this.comment);
|
||||
|
||||
// Filemanager link popup
|
||||
this.filemanager_button = $j(document.createElement("img"))
|
||||
.attr("src", this.egw().image("filemanager/navbar"))
|
||||
.addClass("et2_button et2_button_icon")
|
||||
.appendTo(this.div)
|
||||
.click(this, function(e) {
|
||||
// Open the filemanager select in a popup
|
||||
var values = e.data.options.value;
|
||||
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,
|
||||
false,
|
||||
'640x580'
|
||||
);
|
||||
});
|
||||
|
||||
// Need a div for file upload widget
|
||||
this.file_div = $j(document.createElement("div")).appendTo(this.div);
|
||||
|
||||
|
@ -424,6 +424,10 @@ div.et2_link_entry:after {
|
||||
.et2_link_to .progress li:hover.success span.ui-icon-comment {
|
||||
display: inline;
|
||||
}
|
||||
.et2_link_to .et2_button_icon {
|
||||
float: left;
|
||||
width: 22px;
|
||||
}
|
||||
|
||||
.et2_link {
|
||||
cursor: pointer;
|
||||
|
Loading…
Reference in New Issue
Block a user