我正在寻找解决问题的替代方法。我们正在使用ElFinder浏览文件,并且我们希望允许用户通过右键单击上下文菜单(“更改权限”)更改对文件元素的访问权限。到目前为止,我提出的解决方案是在 jQuery 模式对话框窗口中加载服务器端 ASP.NET 用户控件。此用户控件将包含添加/删除对选定元素的用户访问权限所需的逻辑。
jQuery Dialog 脚本看起来像这样(为了便于阅读,稍作更改),其中 DisplayItemAccessConfig() 是从上下文菜单调用的方法:
<!-- access control script -->
<script type="text/javascript" charset="utf-8">
function DisplayItemAccessConfig() {
$.getJSON('AccessRights.ashx', function (data) {
var itemName = data["itemName"];
/* set new title (JUST FOR TESTING) */
$(dialog).dialog('option', 'title', itemName);
/* open modal dialog --> */
$(dialog).dialog('open');
});
}
$(function () {
$("#dialog").dialog({
autoOpen: false,
modal: true,
buttons: {
"Ok": function () { $(this).dialog("close"); },
"Cancel": function () { $(this).dialog("close"); }
},
open: function (type, data) {
$(this).parent().appendTo("form");
}
});
});
</script>
Challenge 1: find a way to reload the user control each time the jQuery popup is displayed - this is to retrieve the current access settings for the selected element. Now it loads when the page is first loaded, since it's just a div element containing an update panel with a placeholder for my usercontrol and visibility set to none. Anyone have any tips here?
Challenge 2: While I am trying to figure that one out I thought it could be worth while asking for other opinions. Is there a better way of solving this? Should I use a pure jQuery with HTML and call server side .ashx methods to retrieve data, instead of an ASP.NET usercontrol?