{
	xtype: "menu",
	onInitialize: function(i_owner, o_config, s_type){

		var i_self = this;
		var i_record = o_config.records[0];
		var a_items = [];
		var i_parent = Ext.getCmp(o_config.parentId || o_config.formId);
		var s_dmd = i_parent.dmdName;
		var o_entity = i_parent.entity || {};
		var s_entity = Ext.isString(o_entity) ? o_entity : o_entity.name;

		// add export button
		if(s_type == "grid") {
			if (ip2.isAccessible("app." + s_dmd + ".data." + s_entity + ".export.definitions")) {
				a_items.push({
					xtype: "themedmenuitem",
					itemId: "itm_export",
					text: ip2.i18n({
						da: "Eksport",
						en: "Export"
					}),
					iconCls : "icon-export",
					handler: function(item) {
						Ext.MessageBox.show({
							title: ip2.i18n({
								da: "Bekræft eksport",
								en: "Confirm export"
							}),
							msg: ip2.i18n({
								da: "Bekræft venligst eksport af : " + " <strong>" + i_record.get("PLGPROP_TITLE") + "</strong>",
								en: "Please confirm export of : " + " <strong>" + i_record.get("PLGPROP_TITLE") + "</strong>",
							}),
							buttons: Ext.MessageBox.YESNO,
							fn: function(btn, text) {
								switch (btn) {
									case "yes":

										Ext.getBody().mask(ip2.i18n({
											da: "Vent venligst...",
											en: "Please wait..."
										}))

										Ext.Ajax.request({
											url: "/wsh-services/wshExpPag.aspx",
											params: {
												pageToken: i_record.get(i_record.idProperty)
											},
											success: function(response, request) {

												Ext.getBody().unmask();

												var o_result = Ext.decode(response.responseText);

												if (o_result.success) {

													var i_template = Ext.create("Ext.XTemplate",
														ip2.i18n({
															da: "Exporteret: <strong>{title}</strong></br>Folder: <strong>{folder}</strong>",
															en: "Exported: <strong>{title}</strong></br>Folder: <strong>{folder}</strong>"
														})
													);

													i_template.compile();

													var s_message = i_template.apply({
														title: i_record.get("PLGPROP_TITLE"),
														folder: o_result.folder
													});

													Ext.MessageBox.show({
														title: ip2.i18n({
															da: "Information",
															en: "Information"
														}),
														msg: s_message,
														buttons: Ext.MessageBox.OK,
														icon: Ext.MessageBox.INFORMATION
													});
												}
											}
										});
										break;
									case "no":
										break;
									default:
										break;
								}
							},
							icon: Ext.MessageBox.QUESTION
						});
					}
				})
			}
		}
		else {
			if (ip2.isAccessible("app." + s_dmd + ".functions." + s_entity + ".preview")) {

				a_items.push("-");

				a_items.push({
					xtype: "themedbutton",
					itemId: "itm_preview",
					tooltip: ip2.i18n({
						da: "Preview",
						en: "Preview"
					}),
					iconCls : "preview_off",
					handler: function(item) {
						var i_token = i_record.get(i_record.idProperty);
						ip2.getSiteConfig(function (o_settings) {

							var s_src = "http://{0}/{1}/page/{2}";
							var s_host = o_settings.http_host;
							var b_multi = o_settings.language_usingmulti;
							var s_language = ip2.session.getLanguage();

							s_src = s_src.replace("{0}",s_host). replace("{2}",i_token);
							if(b_multi) {
								s_src = s_src.replace("{1}",s_language);
							}
							else {
								s_src = s_src.replace("{1}/","");
							}

							var i_window = Ext.widget("previewwindow",{
								state : 0,
								title : ip2.i18n({
									da: "Preview af side",
									en: "Preview off page"
								}),
								layout: "fit",
								items : [
									{
										xtype: "containeriframe",
										src: s_src,
										layout : "fit"
									}
								]
							});

							i_window.show();
						});
					}
				});
			}
		}

		return a_items;
	}
};
