Ok here comes a simplified version:
<%@ Page Language="C#" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function addTab(tabPanel, id, url) {
var tab = tabPanel.getComponent(id);
if (!tab) {
tab = tabPanel.add({
id: id,
title: url,
closable: true,
autoLoad: {
showMask: true,
url: url,
mode: 'iframe',
maskMsg: 'Loading ' + url + '...'
}
});
tab.on('activate', function() {
var item = MenuPanel1.menu.items.get(id + "_item");
if (item) {
MenuPanel1.setSelection(item);
}
}, this);
}
tabPanel.setActiveTab(tab);
}
</script>
<script runat="server">
protected void AddAnnotation(object sender, AjaxEventArgs e)
{
ContentPanel.Html = HtmlEditor.Text;
HtmlEditor.Text = "";
HtmlEditorPanel.Hide();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ScriptManager ID="ScriptManager1" runat="server" />
<ext:TabPanel ID="TabPanel1" runat="server">
<Tabs>
<ext:Tab>
<Body>
<ext:Label ID="ContentPanel" runat="server" Html="TestText" />
<ext:LinkButton runat="server" ID="EditButton" Icon="NoteEdit" Text="Edit">
<Listeners>
<Click Handler="#{HtmlEditorPanel}.show(); #{HtmlEditor}.setValue(#{ContentPanel}.html);" />
</Listeners>
</ext:LinkButton>
<ext:Panel ID="HtmlEditorPanel" runat="server" Hidden="true" Width="800">
<Body>
<ext:HtmlEditor ID="HtmlEditor" runat="server" Height="400" Width="800" />
</Body>
<BottomBar>
<ext:Toolbar ID="EditorBottomBar" runat="server">
<Items>
<ext:ToolbarButton ID="buttonSubmit" runat="server" Icon="NoteAdd" StandOut="true"
Text="Edit">
<AjaxEvents>
<Click Type="Submit" OnEvent="AddAnnotation">
<EventMask ShowMask="true" />
</Click>
</AjaxEvents>
</ext:ToolbarButton>
</Items>
</ext:Toolbar>
</BottomBar>
</ext:Panel>
</Body>
</ext:Tab>
</Tabs>
</ext:TabPanel>
</form>
</body>
</html>
When you Edit the content and then Add a Link, save the content and click on that link after it,
then the link is opened in the same window. I want to open it in a new tab, which means that I want to add the "addTab" javascript method to a link which is generated by the HtmlEditor.
Regards,
Martin