mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-18 11:58:24 +01:00
Make readonly attribute available for link-to and link-list widget
- Implement tracker link_to to not give edit interface to user who has no edit access
This commit is contained in:
parent
2ac7a5306a
commit
b73e6ea2d6
@ -89,7 +89,7 @@ var et2_link_to = et2_inputWidget.extend(
|
|||||||
this.link_entry = null;
|
this.link_entry = null;
|
||||||
this.file_upload = null;
|
this.file_upload = null;
|
||||||
|
|
||||||
this.createInputWidget();
|
if (!this.options.readonly) this.createInputWidget();
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
@ -1490,6 +1490,12 @@ var et2_link_list = et2_link_string.extend(
|
|||||||
"default": et2_no_init,
|
"default": et2_no_init,
|
||||||
"description": "JS code which is executed when the links change."
|
"description": "JS code which is executed when the links change."
|
||||||
},
|
},
|
||||||
|
readonly: {
|
||||||
|
name: "readonly",
|
||||||
|
type: "boolean",
|
||||||
|
"default": false,
|
||||||
|
description: "Does NOT allow user to enter data, just displays existing data"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1789,6 +1795,9 @@ var et2_link_list = et2_link_string.extend(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
|
// build delete button if the link is not readonly
|
||||||
|
if (!this.options.readonly)
|
||||||
|
{
|
||||||
var delete_button = $j(document.createElement("td"))
|
var delete_button = $j(document.createElement("td"))
|
||||||
.appendTo(row);
|
.appendTo(row);
|
||||||
$j("<div />")
|
$j("<div />")
|
||||||
@ -1809,16 +1818,18 @@ var et2_link_list = et2_link_string.extend(
|
|||||||
egw.lang('Delete link?')
|
egw.lang('Delete link?')
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
// Context menu
|
// Context menu
|
||||||
row.bind("contextmenu", function(e) {
|
row.bind("contextmenu", function(e) {
|
||||||
// Comment ony available if link_id is there
|
// Comment only available if link_id is there and not readonly
|
||||||
self.context.getItem("comment").set_enabled(typeof _link_data.link_id != 'undefined');
|
self.context.getItem("comment").set_enabled(typeof _link_data.link_id != 'undefined' && !self.options.readonly);
|
||||||
// File info only available for existing files
|
// File info only available for existing files
|
||||||
self.context.getItem("file_info").set_enabled(typeof _link_data.id != 'object' && _link_data.app == 'file');
|
self.context.getItem("file_info").set_enabled(typeof _link_data.id != 'object' && _link_data.app == 'file');
|
||||||
self.context.getItem("save").set_enabled(typeof _link_data.id != 'object' && _link_data.app == 'file');
|
self.context.getItem("save").set_enabled(typeof _link_data.id != 'object' && _link_data.app == 'file');
|
||||||
// Zip download only offered if there are at least 2 files
|
// Zip download only offered if there are at least 2 files
|
||||||
self.context.getItem("zip").set_enabled($j('[id^="link_-"]',this.list).length >= 2);
|
self.context.getItem("zip").set_enabled($j('[id^="link_-"]',this.list).length >= 2);
|
||||||
|
// Show delete item only if the widget is not readonly
|
||||||
|
self.context.getItem("delete").set_enabled(!self.options.readonly);
|
||||||
|
|
||||||
self.context.data = _link_data;
|
self.context.data = _link_data;
|
||||||
self.context.showAt(e.pageX, e.pageY, true);
|
self.context.showAt(e.pageX, e.pageY, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user