egroupware/phpgwapi/js/egw_action/test/test_grid.html

200 lines
4.6 KiB
HTML
Raw Normal View History

<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>
<div id="container" style="height: 300px"></div>
<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 + "'");
}
* jQuery: changed $ to $j to work around mootools use in Joomla templates and other js code in imported projects required to change $ --> $j: phpgwapi/* jdots/* etemplate/* stylite/* felamimail/* admin/* news_admin/* projectmanager/* importexport/* infolog/* ranking/* required, but not automatic: importexport/setup/etemplates.inc.php phpgwapi/js/jquery/* negative, not to touch or revert later: phpgwapi/inc/savant2/Savant2/Savant2_Compiler_basic.php: '(\$(.+))' => 'print $1', phpgwapi/js/dhtmlxtree/libCompiler/core.js sitemgr/* phpfreechat/* gallery/* activesync/include/smb.php: '^\tIPC\\\$(.*)[ ]+IPC' => 'skip', etemplate/inc/class.bo_merge.inc.php: if ($this->table_plugins && preg_match_all('/\\$\\$table\\/([A-Za-z0-9_]+)\\$\\$(.*?)\\$\\$endtable\\$\\$/s',$content,$matches,PREG_SET_ORDER)) find phpgwapi jdots etemplate stylite felamimail admin news_admin projectmanager importexport infolog ranking \ \( -name '*.php' -o -name '*.js' \) -exec grep -q '\$(' {} \; -print \ -exec sed -i '' 's|\$(|$j(|g' {} \; svn revert phpgwapi/inc/savant2/Savant2/Savant2_Compiler_basic.php phpgwapi/js/dhtmlxtree/libCompiler/core.js \ importexport/setup/etemplates.inc.php phpgwapi/js/jquery/jquery.js etemplate/inc/class.bo_merge.inc.php additional changes: phpgwapi/js/jquery/jquery.js: window.$ --> window.$j phpgwapi/js/egw_json.js:291 this.request = $j.ajax({url: this.url, jdots/templates/jdots/head.tpl:59 $j(document).ready(function() { phpgwapi/js/egw_action/egw_grid_view.js: $.browser --> $j.browser importexport/setup/etemplates.inc.php: etemplate editor importexport.wizard_basic_export_csv.choose_fields onclick of check icon changed phpgwapi/js/egw_action/tests/*.html phpgwapi/js/egw_action/tests/js/jquery.js: window.$ --> window.$j
2011-07-03 11:00:36 +02:00
$j(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",
"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"
}
]
);
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)
{
for (var i = 1; i <= 20; i++)
{
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);
if (depth < 0)
recurse_add(it, _obj, depth + 1);
}
}
recurse_add(grid, objectManager, 0);
grid.endUpdate();
});
</script>
</body>
</html>