Hide template selection if there aren't any templates. Auto-select category matching selected template. Suppress 'are you sure' message when selecting a template if no text entered. Fix bug when reselecting a template. Fix #360.
This commit is contained in:
parent
4262bfd884
commit
738b1a40bf
4 changed files with 41 additions and 8 deletions
|
@ -16,5 +16,5 @@ using System.Reflection;
|
|||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("3.0.0.341")]
|
||||
[assembly: AssemblyFileVersion("3.0.0.341")]
|
||||
[assembly: AssemblyVersion("3.0.0.342")]
|
||||
[assembly: AssemblyFileVersion("3.0.0.342")]
|
||||
|
|
|
@ -12,14 +12,22 @@
|
|||
var submitted = false;
|
||||
function __UnloadPage(e) {
|
||||
if (!submitted) {
|
||||
if (document.getElementById('EditorDiv').getElementsByTagName('textarea')[0].value.length != 0) {
|
||||
e.returnValue = " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function __SetSubmitted() {
|
||||
submitted = true;
|
||||
}
|
||||
|
||||
function __RequestConfirmIfNotEmpty() {
|
||||
if (document.getElementById('EditorDiv').getElementsByTagName('textarea')[0].value.length != 0) {
|
||||
return(__RequestConfirm());
|
||||
}
|
||||
}
|
||||
|
||||
// -->
|
||||
</script>
|
||||
|
||||
|
@ -91,7 +99,7 @@
|
|||
Display="Dynamic" ControlToValidate="txtTitle" ValidationGroup="nametitle" meta:resourcekey="rfvTitleResource1" />
|
||||
</div>
|
||||
|
||||
<div id="TemplatesDiv">
|
||||
<div id="TemplatesDiv" runat="server">
|
||||
<small>
|
||||
<anthem:LinkButton ID="btnTemplates" runat="server" Text="Content Templates..." OnClick="btnTemplates_Click"
|
||||
AutoUpdateAfterCallBack="True" meta:resourcekey="btnTemplatesResource1" UpdateAfterCallBack="True" />
|
||||
|
@ -108,7 +116,7 @@
|
|||
</div>
|
||||
<small>
|
||||
<anthem:LinkButton ID="btnUseTemplate" runat="server" Text="Use Template" ToolTip="Use this Template (replace current content)"
|
||||
CausesValidation="False" AutoUpdateAfterCallBack="True" Visible="False" PreCallBackFunction="__RequestConfirm" OnClick="btnUseTemplate_Click"
|
||||
CausesValidation="False" AutoUpdateAfterCallBack="True" Visible="False" PreCallBackFunction="__RequestConfirmIfNotEmpty" OnClick="btnUseTemplate_Click"
|
||||
meta:resourcekey="btnUseTemplateResource1" UpdateAfterCallBack="True" />
|
||||
•
|
||||
<anthem:LinkButton ID="btnCancelTemplate" runat="server" Text="Cancel" ToolTip="Close the Templates toolbar"
|
||||
|
|
|
@ -216,9 +216,16 @@ namespace ScrewTurn.Wiki {
|
|||
// Check and manage editing collisions
|
||||
ManageEditingCollisions();
|
||||
|
||||
// Display draft status
|
||||
if(!Page.IsPostBack) {
|
||||
|
||||
// Hide templates selection if there aren't any
|
||||
if(Templates.GetTemplates().Count == 0) {
|
||||
TemplatesDiv.Visible = false;
|
||||
}
|
||||
|
||||
// Display draft status
|
||||
ManageDraft();
|
||||
|
||||
}
|
||||
|
||||
// Setup session refresh iframe
|
||||
|
@ -714,6 +721,9 @@ namespace ScrewTurn.Wiki {
|
|||
foreach(ContentTemplate temp in Templates.GetTemplates()) {
|
||||
lstTemplates.Items.Add(new ListItem(temp.Name, temp.Name));
|
||||
}
|
||||
// Hide select button and preview text because the user hasn't selected a template yet
|
||||
btnUseTemplate.Visible = false;
|
||||
lblTemplatePreview.Text = "";
|
||||
}
|
||||
|
||||
protected void lstTemplates_SelectedIndexChanged(object sender, EventArgs e) {
|
||||
|
@ -734,6 +744,12 @@ namespace ScrewTurn.Wiki {
|
|||
|
||||
editor.SetContent(template.Content, Settings.UseVisualEditorAsDefault);
|
||||
btnCancelTemplate_Click(sender, e);
|
||||
// If there's a category matching the selected template name, select it automatically
|
||||
for (int i = 0; i < lstCategories.Items.Count; i++) {
|
||||
if (lstCategories.Items[i].Value.ToLower().Trim() == lstTemplates.SelectedValue.ToLower().Trim()) {
|
||||
lstCategories.Items[i].Selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnCancelTemplate_Click(object sender, EventArgs e) {
|
||||
|
|
11
WebApplication/Edit.aspx.designer.cs
generated
11
WebApplication/Edit.aspx.designer.cs
generated
|
@ -1,7 +1,7 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.4927
|
||||
// Runtime Version:2.0.50727.3074
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
|
@ -292,6 +292,15 @@ namespace ScrewTurn.Wiki {
|
|||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvTitle;
|
||||
|
||||
/// <summary>
|
||||
/// TemplatesDiv control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlGenericControl TemplatesDiv;
|
||||
|
||||
/// <summary>
|
||||
/// btnTemplates control.
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue