Link enhancements:

- Add confirm dialog to delete link
- Log unlinking files into historylog
This commit is contained in:
Nathan Gray 2014-10-29 23:03:35 +00:00
parent 2fe71bdc48
commit c917cbd865
2 changed files with 27 additions and 5 deletions

View File

@ -1533,7 +1533,10 @@ var et2_link_list = et2_link_string.extend(
this.context.addItem("delete", this.egw().lang("Delete link"), this.egw().image("delete"), function(menu_item) {
var link_id = isNaN(self.context.data.link_id) ? self.context.data : self.context.data.link_id;
var row = jQuery('#link_'+(self.context.data.dom_id ? self.context.data.dom_id : self.context.data.link_id), self.list);
self._delete_link(link_id, row);
et2_dialog.show_dialog(
function(button) { debugger; if(button == et2_dialog.YES_BUTTON) self._delete_link(link_id,row);},
egw.lang('Delete link?')
);
});
// Native DnD - Doesn't play nice with jQueryUI Sortable
@ -1660,10 +1663,20 @@ var et2_link_list = et2_link_string.extend(
.appendTo(delete_button)
// We don't use ui-icon because it assigns a bg image
.addClass("delete icon")
.bind( 'click', function() {self._delete_link(
self.value && typeof self.value.to_id != 'object' && _link_data.link_id ? _link_data.link_id:_link_data,
row
);});
.bind( 'click', function() {
et2_dialog.show_dialog(
function(button) {
if(button == et2_dialog.YES_BUTTON)
{
self._delete_link(
self.value && typeof self.value.to_id != 'object' && _link_data.link_id ? _link_data.link_id:_link_data,
row
);
}
},
egw.lang('Delete link?')
);
});
// Context menu
row.bind("contextmenu", function(e) {

View File

@ -1231,6 +1231,15 @@ class egw_link extends solink
{
echo '<p>'.__METHOD__."('$app','$id','$fname') url=$url</p>\n";
}
// Log in history - Need to load it first
if((int)$app > 0)
{
$link = self::get_link(-$app);
if($link['app2'] && $link['id2'])
{
historylog::static_add($link['app2'],$link['id2'],$GLOBALS['egw_info']['user']['account_id'],'~file~','', basename($url));
}
}
if (($Ok = !file_exists($url) || egw_vfs::remove($url,true)) && ((int)$app > 0 || $fname))
{
// try removing the dir, in case it's empty