2011-03-02 22:18:20 +01:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Grid Test</title>
|
|
|
|
|
|
|
|
<!-- Basic action stuff -->
|
|
|
|
<script src="../egw_action.js"></script>
|
|
|
|
<script src="../egw_action_common.js"></script>
|
|
|
|
|
|
|
|
<!-- Grid stuff -->
|
|
|
|
<script src="../egw_grid.js"></script>
|
|
|
|
<script src="js/jquery.js"></script>
|
|
|
|
<link rel="stylesheet" href="grid.css"/>
|
|
|
|
|
|
|
|
<!-- Popup stuff -->
|
|
|
|
<link rel="stylesheet" type="text/css" href="skins/dhtmlxmenu_egw.css">
|
|
|
|
<script src="js/dhtmlxcommon.js"></script>
|
|
|
|
<script src="js/dhtmlxmenu.js"></script>
|
|
|
|
<script src="js/dhtmlxmenu_ext.js"></script>
|
|
|
|
<script src="../egw_action_popup.js"></script>
|
|
|
|
<script src="../egw_menu.js"></script>
|
|
|
|
<script src="../egw_menu_dhtmlx.js"></script>
|
|
|
|
|
|
|
|
</head>
|
|
|
|
<body>
|
2011-03-09 23:16:41 +01:00
|
|
|
<div id="container" style="height: 300px"></div>
|
2011-03-02 22:18:20 +01:00
|
|
|
<script>
|
|
|
|
var grid = null;
|
|
|
|
var actionManager = null;
|
|
|
|
var objectManager = null;
|
|
|
|
|
|
|
|
function alertClicked(_action, _senders)
|
|
|
|
{
|
|
|
|
var ids = "";
|
|
|
|
for (var i = 0; i < _senders.length; i++)
|
|
|
|
ids += _senders[i].id + ((i < _senders.length - 1) ? ", " : "");
|
|
|
|
|
|
|
|
alert("Action '" + _action.caption + "' executed on elements '"
|
|
|
|
+ ids + "'");
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
actionManager = new egwActionManager();
|
|
|
|
actionManager.updateActions(
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"id": "folder_open",
|
|
|
|
"iconUrl": "imgs/folder.png",
|
|
|
|
"caption": "Open folder",
|
|
|
|
"onExecute": alertClicked,
|
|
|
|
"allowOnMultiple": false,
|
|
|
|
"type": "popup",
|
|
|
|
"default": true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "file_view",
|
|
|
|
"iconUrl": "imgs/view.png",
|
|
|
|
"caption": "View",
|
|
|
|
"onExecute": alertClicked,
|
|
|
|
"allowOnMultiple": false,
|
|
|
|
"type": "popup",
|
|
|
|
"default": true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "file_preview",
|
|
|
|
"iconUrl": "imgs/preview.png",
|
|
|
|
"caption": "Preview",
|
|
|
|
"onExecute": alertClicked,
|
|
|
|
"allowOnMultiple": false,
|
|
|
|
"type": "popup",
|
|
|
|
"default": true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "file_delete",
|
|
|
|
"iconUrl": "imgs/delete.png",
|
|
|
|
"caption": "Delete",
|
|
|
|
"onExecute": alertClicked,
|
|
|
|
"type": "popup",
|
|
|
|
"group": 2
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "file_edit",
|
|
|
|
"iconUrl": "imgs/edit.png",
|
|
|
|
"caption": "Edit file",
|
|
|
|
"onExecute": alertClicked,
|
|
|
|
"allowOnMultiple": false,
|
|
|
|
"type": "popup"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "file_compress",
|
|
|
|
"iconUrl": "imgs/compress.png",
|
|
|
|
"caption": "Create ZIP archive",
|
|
|
|
"onExecute": alertClicked,
|
|
|
|
"type": "popup",
|
|
|
|
"group": 1,
|
|
|
|
"order": 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "file_email",
|
|
|
|
"iconUrl": "imgs/email.png",
|
|
|
|
"caption": "E-Mail",
|
|
|
|
"onExecute": alertClicked,
|
|
|
|
"allowOnMultiple": false,
|
|
|
|
"type": "popup",
|
|
|
|
"group": 1,
|
|
|
|
"order": 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "file_compress_email",
|
|
|
|
"caption": "Create ZIP and E-Mail",
|
|
|
|
"onExecute": alertClicked,
|
|
|
|
"type": "popup",
|
|
|
|
"group": 1,
|
|
|
|
"order": 2
|
|
|
|
}
|
|
|
|
]
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
objectManager = new egwActionObjectManager("", actionManager);
|
|
|
|
|
|
|
|
grid = new egwGrid(document.getElementById("container"),
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"caption": "Name",
|
|
|
|
"width": "50%"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "size",
|
|
|
|
"caption": "Size"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "rights",
|
|
|
|
"caption": "<a href=\"http://www.google.de/\">UNIX Filerights</a>",
|
|
|
|
"default": "---------"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "mime",
|
2011-03-09 23:16:41 +01:00
|
|
|
"caption": "File-Type/MIME with very long column header caption"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "atime",
|
|
|
|
"caption": "atime",
|
|
|
|
"width": "40px"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "ctime",
|
|
|
|
"caption": "ctime",
|
|
|
|
"width": "40px"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "mtime",
|
|
|
|
"caption": "mtime",
|
|
|
|
"width": "40px"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "owner",
|
|
|
|
"caption": "owner",
|
|
|
|
"width": "40px"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "group",
|
|
|
|
"caption": "group",
|
|
|
|
"width": "40px"
|
2011-03-02 22:18:20 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
);
|
|
|
|
|
|
|
|
var listboxFolderLinks = [
|
|
|
|
{"actionId": "folder_open", "enabled": true},
|
|
|
|
{"actionId": "file_compress_email", "enabled": true},
|
|
|
|
{"actionId": "file_compress", "enabled": true},
|
|
|
|
{"actionId": "file_delete", "enabled": true}
|
|
|
|
];
|
|
|
|
|
|
|
|
var info =
|
|
|
|
{
|
|
|
|
"size": "16KiB",
|
|
|
|
"mime": "Directory"
|
|
|
|
}
|
|
|
|
|
|
|
|
grid.beginUpdate();
|
|
|
|
function recurse_add(item, obj, depth)
|
|
|
|
{
|
2011-03-09 23:16:41 +01:00
|
|
|
for (var i = 1; i <= 20; i++)
|
2011-03-02 22:18:20 +01:00
|
|
|
{
|
|
|
|
var id = "file" + i;
|
|
|
|
var it = item.addItem(id, "Test" + i, "imgs/mime16_directory.png", info);
|
|
|
|
var _obj = obj.addObject(id, it.getAOI());
|
|
|
|
_obj.updateActionLinks(listboxFolderLinks);
|
2011-03-09 23:16:41 +01:00
|
|
|
if (depth < 0)
|
2011-03-02 22:18:20 +01:00
|
|
|
recurse_add(it, _obj, depth + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
recurse_add(grid, objectManager, 0);
|
|
|
|
grid.endUpdate();
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|