PageRenderTime 57ms CodeModel.GetById 52ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/source/app/NOS.Wiki/Popup.aspx

http://github.com/agross/netopenspace
ASP.NET | 374 lines | 146 code | 51 blank | 177 comment | 0 complexity | b415c0df983b2904d48ae5c033eacbb6 MD5 | raw file
  1<%@ Page Language="C#" AutoEventWireup="true" Inherits="ScrewTurn.Wiki.Popup" meta:resourcekey="PageResource1" Codebehind="Popup.aspx.cs" culture="auto" uiculture="auto" %>
  2
  3<%@ Register TagName="ClientTree" TagPrefix="st" Src="~/ClientTree.ascx" %>
  4<%@ Register TagName="ClientImageBrowser" TagPrefix="st" Src="~/ClientImageBrowser.ascx" %>
  5
  6<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  7
  8<html dir="<%= ScrewTurn.Wiki.Settings.Direction %>" xmlns="http://www.w3.org/1999/xhtml" >
  9<head runat="server">
 10	<title runat="server">ScrewTurn Wiki</title>
 11	<link rel="stylesheet" type="text/css" href="Themes/Editor.css" />
 12	
 13	<script type="text/javascript">
 14	<!--
 15		function Execute(code) {
 16			window.opener.eval(code);
 17			window.close();
 18			return false;
 19		}
 20
 21		function ProcessPageLink() {
 22			var name = GetValue("txtPageName");
 23			if(name == "") return false;
 24			var title = GetValue("txtPageTitle");
 25			var c = IsChecked("chkPageNW") ? "^" : "";
 26			if(title != "") {
 27				Execute("InsertMarkup(\"[" + c + name + "|" + title + "]\");");
 28			}
 29			else {
 30				Execute("InsertMarkup(\"[" + c + name + "]\");");
 31			}
 32			window.close();
 33			return false;
 34		}
 35		
 36		function ProcessFileLink() {
 37			var name = GetValue("txtFilePath");
 38			name = name.replace(/\\/g, '\\\\');
 39			if(name == "") return false;
 40			var title = GetValue("txtFileTitle");
 41			var c = IsChecked("chkFileNW") ? "^" : "";
 42			if(title != "") {
 43				Execute("InsertMarkup(\"[" + c + name + "|" + title + "]\");");
 44			}
 45			else {
 46				Execute("InsertMarkup(\"[" + c + name + "]\");");
 47			}
 48			window.close();
 49			return false;
 50		}
 51		
 52		function SelectFile(prov, value) {
 53			SetValue("txtFilePath", "{UP" + prov + "}" + value);
 54		}
 55		
 56		function ProcessExternalLink() {
 57			var url = GetValue("txtLinkUrl");
 58			if(url == "") return false;
 59			var title = GetValue("txtLinkTitle");
 60			var c = IsChecked("chkLinkNW") ? "^" : "";
 61			if(title != "") {
 62				Execute("InsertMarkup(\"[" + c + url + "|" + title + "]\");");
 63			}
 64			else {
 65				Execute("InsertMarkup(\"[" + c + url + "]\");");
 66			}
 67			window.close();
 68			return false;
 69		}
 70		
 71		function ProcessImage() {
 72			var name = GetValue("txtImagePath");
 73			if(name == "") return false;
 74			var link = GetValue("txtImageLink");
 75			var descr = GetValue("txtImageDescr");
 76			var c = IsChecked("chkImageNW") ? "^" : "";
 77			var imageType = GetImageType();
 78			if(link != "") {
 79				Execute("InsertMarkup(\"[" + imageType + "|" + descr + "|" + name + "|" + c + link + "]\");");
 80			}
 81			else {
 82				Execute("InsertMarkup(\"[" + imageType + "|" + descr + "|" + name + "]\");");
 83			}
 84		}
 85		
 86		function GetImageType() {
 87			if(IsChecked("rdoImageLeft")) return "imageleft";
 88			if(IsChecked("rdoImageRight")) return "imageright";
 89			if(IsChecked("rdoImageAuto")) return "imageauto";
 90			if(IsChecked("rdoImageInline")) return "image";
 91			return "";
 92		}
 93		
 94		function SelectImage(prov, value, page) {
 95			document.getElementById("PreviewImg").src = "Thumb.aspx?Provider=" + GetValue("lstProviderImages") +
 96				"&File=" + value + "&Size=Big&Info=1&Page=" + page;
 97			if(IsChecked("rdoImageLink")) {
 98				SetValue("txtImageLink", "{UP" + prov + "}" + value);
 99				ImageLinkFromBrowser = 1;
100			}
101			else {
102				SetValue("txtImagePath", "{UP" + prov + "}" + value);
103			}
104			return false;
105		}
106		
107		function ProcessAnchor() {
108			var link = IsChecked("rdoAnchorLink");
109			if(link) {
110				var id = GetValue("lstExistingAnchors");
111				if(id == "") return false;
112				var title = GetValue("txtAnchorTitle");
113				Execute("InsertMarkup(\"[#" + id + (title != "" ? "|" + title : "") + "]\");");
114			}
115			else {
116				var id = GetValue("txtAnchorID");
117				if(id == "") return false;
118				id = id.replace(/#/g, "");
119				Execute("InsertMarkup(\"[anchor|#" + id + "]\");");
120			}
121			return false;
122			window.close();
123		}
124		
125		function SetValue(targetId, value) {
126			document.getElementById(targetId).value = value;
127		}
128		
129		function GetValue(targetId) {
130			return document.getElementById(targetId).value;
131		}
132		
133		function IsChecked(targetId) {
134			return document.getElementById(targetId).checked;
135		}
136		
137		function CancelAll() {
138			window.close();
139			return false;
140		}
141	// -->
142	</script>
143</head>
144<body id="ToolWindowBody">
145	<form id="frmPopup" runat="server">
146		<div id="MainPopupDiv">
147		
148			<asp:Literal ID="lblStrings" runat="server" meta:resourcekey="lblStringsResource1" />
149			
150			<asp:MultiView ID="mlvPopup" runat="server">
151			
152				<asp:View ID="viwPageLink" runat="server">
153					
154					<asp:DropDownList ID="lstNamespace" runat="server" AutoPostBack="true" Width="270px" OnSelectedIndexChanged="lstNamespace_SelectedIndexChanged" />
155				
156					<div id="ClientTreePagesDiv">
157					
158						<st:ClientTree ID="ctPages" runat="server" OnPopulate="ctPages_Populate" EnableViewState="False"
159							LeafCssClass="menulink" NodeCssClass="menulink" ContainerCssClass="subtree" />
160					</div>
161					
162					<asp:Literal ID="lblPageName" runat="server" Text="Page Name (required)" EnableViewState="False" meta:resourcekey="lblPageNameResource1" /><br />
163					<asp:TextBox ID="txtPageName" runat="server" Width="264px" meta:resourcekey="txtPageNameResource1" /><br />
164					<asp:Literal ID="lblPageTitle" runat="server" Text="Link Title (optional)" EnableViewState="False" meta:resourcekey="lblPageTitleResource1" /><br />
165					<asp:TextBox ID="txtPageTitle" runat="server" Width="264px" meta:resourcekey="txtPageTitleResource1" /><br />
166					<asp:CheckBox ID="chkPageNW" runat="server" Text="Open link in new window" EnableViewState="False" meta:resourcekey="chkPageNWResource1" />
167					
168					<div class="popupbuttons">
169						<asp:Button ID="btnOkPageLink" runat="server" Text="OK" EnableViewState="False" meta:resourcekey="btnOkPageLinkResource1" />
170						<asp:Button ID="btnCancelPageLink" runat="server" Text="Cancel" EnableViewState="False" meta:resourcekey="btnCancelPageLinkResource1" />
171					</div>
172					
173					<script type="text/javascript">
174					<!--
175						document.getElementById("btnOkPageLink").onclick = ProcessPageLink;
176						document.getElementById("btnCancelPageLink").onclick = CancelAll;
177
178						$(function () {
179							$("#<%= txtPageName.ClientID %>").keyup(function () {
180								var value = $("#<%= txtPageName.ClientID %>").val().toLowerCase();
181								$("div.treecontainer a.menulink").each(function () {
182									var elem = $(this);
183									var txt = elem.attr("title");
184									txt = txt.substring(txt.indexOf(".") + 1);
185									value = value.replace(/_/g, '-');
186									var match = txt.toLowerCase().indexOf(value) != -1;
187									elem.css("display", match ? "" : "none");
188								});
189							});
190							$("#<%= txtPageTitle.ClientID %>").keyup(function () {
191								var value = $("#<%= txtPageTitle.ClientID %>").val().toLowerCase();
192								$("div.treecontainer a.menulink").each(function () {
193									var elem = $(this);
194									value = value.replace(/_/g, '-');
195									var match = elem.text().toLowerCase().indexOf(value) != -1;
196									elem.css("display", match ? "" : "none");
197								});
198							});
199						});
200					// -->
201					</script>
202				
203				</asp:View>
204				
205				<asp:View ID="viwFileLink" runat="server">
206				
207					<asp:DropDownList ID="lstProviderFiles" runat="server"
208						AutoPostBack="True" OnSelectedIndexChanged="lstProviderFiles_SelectedIndexChanged" meta:resourcekey="lstProviderFilesResource1" /><br />
209					<asp:CheckBox ID="chkFilesAttachments" runat="server" Text="Browse Page Attachments"
210						AutoPostBack="True" OnCheckedChanged="chkFilesAttachments_CheckedChanged" meta:resourcekey="chkFilesAttachmentsResource1" />
211					<br /><br />
212							
213					<div id="ClientTreeFilesDiv">
214						
215						<st:ClientTree ID="ctFiles" runat="server" OnPopulate="ctFiles_Populate" EnableViewState="False"
216							LeafCssClass="menulink menulinkfile" NodeCssClass="menulink menulinkdirectory" ContainerCssClass="subtree" />
217					</div>
218					
219					<asp:Literal ID="lblFilePath" runat="server" Text="File Path (required)" EnableViewState="False" meta:resourcekey="lblFilePathResource1" /><br />
220					<asp:TextBox ID="txtFilePath" runat="server" Width="264px" meta:resourcekey="txtFilePathResource1" /><br />
221					<asp:Literal ID="lblFileTitle" runat="server" Text="Link Title (optional)" EnableViewState="False" meta:resourcekey="lblFileTitleResource1" /><br />
222					<asp:TextBox ID="txtFileTitle" runat="server" Width="264px" meta:resourcekey="txtFileTitleResource1" /><br />
223					<asp:CheckBox ID="chkFileNW" runat="server" Text="Open link in new window" EnableViewState="False" meta:resourcekey="chkFileNWResource1" />
224					
225					<div class="popupbuttons">
226						<asp:Button ID="btnOkFileLink" runat="server" Text="OK" EnableViewState="False" meta:resourcekey="btnOkFileLinkResource1" />
227						<asp:Button ID="btnCancelFileLink" runat="server" Text="Cancel" EnableViewState="False" meta:resourcekey="btnCancelFileLinkResource1" />
228					</div>
229					
230					<script type="text/javascript">
231					<!--
232						document.getElementById("btnOkFileLink").onclick = ProcessFileLink;
233						document.getElementById("btnCancelFileLink").onclick = CancelAll;
234					// -->
235					</script>
236					
237				</asp:View>
238				
239				<asp:View ID="viwExternalLink" runat="server">
240				
241					<asp:Literal ID="lblLinkUrl" runat="server" Text="Link URL or Email address (required)" EnableViewState="False" meta:resourcekey="lblLinkUrlResource1" /><br />
242					<asp:TextBox ID="txtLinkUrl" runat="server" Width="270px" meta:resourcekey="txtLinkUrlResource1" /><br />
243					<asp:Literal ID="lblLinkTitle" runat="server" Text="Link Title (optional)" EnableViewState="False" meta:resourcekey="lblLinkTitleResource1" /><br />
244					<asp:TextBox ID="txtLinkTitle" runat="server" Width="270px" meta:resourcekey="txtLinkTitleResource1" /><br />
245					<asp:CheckBox ID="chkLinkNW" runat="server" Text="Open link in new window" EnableViewState="False" meta:resourcekey="chkLinkNWResource1" />
246					
247					<div class="popupbuttons">
248						<asp:Button ID="btnOkLink" runat="server" Text="OK" EnableViewState="False" meta:resourcekey="btnOkLinkResource1" />
249						<asp:Button ID="btnCancelLink" runat="server" Text="Cancel" EnableViewState="False" meta:resourcekey="btnCancelLinkResource1" />
250					</div>
251					
252					<script type="text/javascript">
253					<!--
254						document.getElementById("btnOkLink").onclick = ProcessExternalLink;
255						document.getElementById("btnCancelLink").onclick = CancelAll;
256					// -->
257					</script>
258				
259				</asp:View>
260				
261				<asp:View ID="viwImage" runat="server">
262				
263					<asp:DropDownList ID="lstProviderImages" runat="server"
264						AutoPostBack="True" OnSelectedIndexChanged="lstProviderImages_SelectedIndexChanged" meta:resourcekey="lstProviderImagesResource1" />
265					<asp:CheckBox ID="chkImageAttachments" runat="server" Text="Browse Page Attachments"
266						AutoPostBack="True" OnCheckedChanged="chkImageAttachments_CheckedChanged" meta:resourcekey="chkImageAttachmentsResource1" />
267				
268					<table id="ImageBrowserTable">
269						<tr>
270							<td>
271									
272								<div id="ClientImageBrowserDiv">
273								
274									<st:ClientImageBrowser ID="cibImages" runat="server" OnPopulate="cibImages_Populate" EnableViewState="False"
275										LeafCssClass="imageitem"
276										NodeCssClass="folderitem" NodeContent='<img src="Images/Editor/Folder.png" alt="Up" /><br />'
277										UpCssClass="upitem" UpLevelContent='<img src="Images/Editor/FolderUp.png" alt="Up" /><br />' />
278								</div>
279							
280							</td>
281							
282							<td>
283							
284								<div id="ImagePreviewDiv">
285									<img src="Images/Editor/Preview.png" id="PreviewImg" alt="Preview" />
286								</div>
287							
288							</td>
289						</tr>
290						
291					</table>
292					
293					<table id="ImageControlsTable">
294						<tr>
295							<td>
296								<asp:Literal ID="lblImagePath" runat="server" Text="Image Path/URL (required)" EnableViewState="False" meta:resourcekey="lblImagePathResource1" /><br />
297								<asp:TextBox ID="txtImagePath" runat="server" Width="350px" meta:resourcekey="txtImagePathResource1" />
298								<asp:RadioButton ID="rdoImagePath" runat="server" ToolTip="Check this to select the image using the browser" GroupName="do_not_translate_image" Checked="True" meta:resourcekey="rdoImagePathResource1" /><br />
299								<asp:Literal ID="lblImageLink" runat="server" Text="Link (optional)" EnableViewState="False" meta:resourcekey="lblImageLinkResource1" /><br />
300								<asp:TextBox ID="txtImageLink" runat="server" Width="350px" meta:resourcekey="txtImageLinkResource1" />
301								<asp:RadioButton ID="rdoImageLink" runat="server" ToolTip="Check this to select the linked image using the browser" GroupName="do_not_translate_image" meta:resourcekey="rdoImageLinkResource1" /><br />
302								<asp:Literal ID="lblImageDescr" runat="server" Text="Description (optional)" EnableViewState="False" meta:resourcekey="lblImageDescrResource1" /><br />
303								<asp:TextBox ID="txtImageDescr" runat="server" Width="350px" meta:resourcekey="txtImageDescrResource1" /><br />
304								<asp:CheckBox ID="chkImageNW" runat="server" Text="Open link in new window" EnableViewState="False" meta:resourcekey="chkImageNWResource1" />
305							</td>
306							
307							<td>
308								<asp:RadioButton ID="rdoImageLeft" runat="server" Text="Align Left" GroupName="do_not_translate_align" Checked="True" meta:resourcekey="rdoImageLeftResource1" /><br />
309								<asp:RadioButton ID="rdoImageRight" runat="server" Text="Align Right" GroupName="do_not_translate_align" meta:resourcekey="rdoImageRightResource1" /><br />
310								<asp:RadioButton ID="rdoImageAuto" runat="server" Text="Auto" GroupName="do_not_translate_align" meta:resourcekey="rdoImageAutoResource1" /><br />
311								<asp:RadioButton ID="rdoImageInline" runat="server" Text="Inline" GroupName="do_not_translate_align" meta:resourcekey="rdoImageInlineResource1" /><br />
312								<asp:Button ID="btnOkImage" runat="server" Text="OK" EnableViewState="False" meta:resourcekey="btnOkImageResource1" />
313								<asp:Button ID="btnCancelImage" runat="server" Text="Cancel" EnableViewState="False" meta:resourcekey="btnCancelImageResource1" />
314							</td>
315						</tr>
316					</table>
317					
318					<script type="text/javascript">
319					<!--
320						document.getElementById("btnOkImage").onclick = ProcessImage;
321						document.getElementById("btnCancelImage").onclick = CancelAll;
322						document.getElementById("txtImagePath").onclick = function() {
323							document.getElementById("rdoImagePath").checked = true;
324						};
325						document.getElementById("txtImageLink").onclick = function() {
326							document.getElementById("rdoImageLink").checked = true;
327						};
328					// -->
329					</script>
330				
331				</asp:View>
332				
333				<asp:View ID="viwAnchor" runat="server">
334				
335					<asp:Literal ID="lblInsertAnchor" runat="server" Text="Insert:" EnableViewState="False" meta:resourcekey="lblInsertAnchorResource1" /><br />
336					<asp:RadioButton ID="rdoNewAnchor" runat="server" Checked="True" Text="New Anchor"
337						AutoPostBack="True" OnCheckedChanged="rdoAnchor_CheckedChanged" GroupName="do_not_translate_anchor" meta:resourcekey="rdoNewAnchorResource1" /><br />
338					<asp:RadioButton ID="rdoAnchorLink" runat="server" Text="Link to an existing Anchor"
339						AutoPostBack="True" OnCheckedChanged="rdoAnchor_CheckedChanged" GroupName="do_not_translate_anchor" meta:resourcekey="rdoAnchorLinkResource1" />
340					
341					<br /><br />
342					
343					<asp:Panel ID="pnlNewAnchor" runat="server" meta:resourcekey="pnlNewAnchorResource1">
344						<asp:Literal ID="lblAnchorID" runat="server" Text="Anchor ID (required)" EnableViewState="False" meta:resourcekey="lblAnchorIDResource1" /><br />
345						<asp:TextBox ID="txtAnchorID" runat="server" Width="270px" meta:resourcekey="txtAnchorIDResource1" />
346					</asp:Panel>
347					
348					<asp:Panel ID="pnlAnchorLink" runat="server" Visible="False" meta:resourcekey="pnlAnchorLinkResource1">
349						<asp:Literal ID="lblExistingAnchors" runat="server" Text="Link to:" EnableViewState="False" meta:resourcekey="lblExistingAnchorsResource1" /><br />
350						<asp:DropDownList ID="lstExistingAnchors" runat="server" meta:resourcekey="lstExistingAnchorsResource1" /><br />
351						<asp:Literal ID="lblAnchorTitle" runat="server" Text="Link Title (optional)" EnableViewState="False" meta:resourcekey="lblAnchorTitleResource1" /><br />
352						<asp:TextBox ID="txtAnchorTitle" runat="server" Width="270px" meta:resourcekey="txtAnchorTitleResource1" />
353					</asp:Panel>
354					
355					<div class="popupbuttons">
356						<asp:Button ID="btnOkAnchor" runat="server" Text="OK" EnableViewState="False" meta:resourcekey="btnOkAnchorResource1" />
357						<asp:Button ID="btnCancelAnchor" runat="server" Text="Cancel" EnableViewState="False" meta:resourcekey="btnCancelAnchorResource1" />
358					</div>
359					
360					<script type="text/javascript">
361					<!--
362						document.getElementById("btnOkAnchor").onclick = ProcessAnchor;
363						document.getElementById("btnCancelAnchor").onclick = CancelAll;
364					// -->
365					</script>
366				
367				</asp:View>
368			
369			</asp:MultiView>
370			
371		</div>
372	</form>
373</body>
374</html>