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
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
[assembly: AssemblyVersion("3.0.0.341")]
|
[assembly: AssemblyVersion("3.0.0.342")]
|
||||||
[assembly: AssemblyFileVersion("3.0.0.341")]
|
[assembly: AssemblyFileVersion("3.0.0.342")]
|
||||||
|
|
|
@ -11,13 +11,21 @@
|
||||||
|
|
||||||
var submitted = false;
|
var submitted = false;
|
||||||
function __UnloadPage(e) {
|
function __UnloadPage(e) {
|
||||||
if (!submitted) {
|
if (!submitted) {
|
||||||
e.returnValue = " ";
|
if (document.getElementById('EditorDiv').getElementsByTagName('textarea')[0].value.length != 0) {
|
||||||
|
e.returnValue = " ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function __SetSubmitted() {
|
function __SetSubmitted() {
|
||||||
submitted = true;
|
submitted = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function __RequestConfirmIfNotEmpty() {
|
||||||
|
if (document.getElementById('EditorDiv').getElementsByTagName('textarea')[0].value.length != 0) {
|
||||||
|
return(__RequestConfirm());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -->
|
// -->
|
||||||
|
@ -91,7 +99,7 @@
|
||||||
Display="Dynamic" ControlToValidate="txtTitle" ValidationGroup="nametitle" meta:resourcekey="rfvTitleResource1" />
|
Display="Dynamic" ControlToValidate="txtTitle" ValidationGroup="nametitle" meta:resourcekey="rfvTitleResource1" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="TemplatesDiv">
|
<div id="TemplatesDiv" runat="server">
|
||||||
<small>
|
<small>
|
||||||
<anthem:LinkButton ID="btnTemplates" runat="server" Text="Content Templates..." OnClick="btnTemplates_Click"
|
<anthem:LinkButton ID="btnTemplates" runat="server" Text="Content Templates..." OnClick="btnTemplates_Click"
|
||||||
AutoUpdateAfterCallBack="True" meta:resourcekey="btnTemplatesResource1" UpdateAfterCallBack="True" />
|
AutoUpdateAfterCallBack="True" meta:resourcekey="btnTemplatesResource1" UpdateAfterCallBack="True" />
|
||||||
|
@ -108,7 +116,7 @@
|
||||||
</div>
|
</div>
|
||||||
<small>
|
<small>
|
||||||
<anthem:LinkButton ID="btnUseTemplate" runat="server" Text="Use Template" ToolTip="Use this Template (replace current content)"
|
<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" />
|
meta:resourcekey="btnUseTemplateResource1" UpdateAfterCallBack="True" />
|
||||||
•
|
•
|
||||||
<anthem:LinkButton ID="btnCancelTemplate" runat="server" Text="Cancel" ToolTip="Close the Templates toolbar"
|
<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
|
// Check and manage editing collisions
|
||||||
ManageEditingCollisions();
|
ManageEditingCollisions();
|
||||||
|
|
||||||
// Display draft status
|
|
||||||
if(!Page.IsPostBack) {
|
if(!Page.IsPostBack) {
|
||||||
|
|
||||||
|
// Hide templates selection if there aren't any
|
||||||
|
if(Templates.GetTemplates().Count == 0) {
|
||||||
|
TemplatesDiv.Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display draft status
|
||||||
ManageDraft();
|
ManageDraft();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup session refresh iframe
|
// Setup session refresh iframe
|
||||||
|
@ -714,6 +721,9 @@ namespace ScrewTurn.Wiki {
|
||||||
foreach(ContentTemplate temp in Templates.GetTemplates()) {
|
foreach(ContentTemplate temp in Templates.GetTemplates()) {
|
||||||
lstTemplates.Items.Add(new ListItem(temp.Name, temp.Name));
|
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) {
|
protected void lstTemplates_SelectedIndexChanged(object sender, EventArgs e) {
|
||||||
|
@ -734,6 +744,12 @@ namespace ScrewTurn.Wiki {
|
||||||
|
|
||||||
editor.SetContent(template.Content, Settings.UseVisualEditorAsDefault);
|
editor.SetContent(template.Content, Settings.UseVisualEditorAsDefault);
|
||||||
btnCancelTemplate_Click(sender, e);
|
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) {
|
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>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// 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
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
|
@ -292,6 +292,15 @@ namespace ScrewTurn.Wiki {
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvTitle;
|
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>
|
/// <summary>
|
||||||
/// btnTemplates control.
|
/// btnTemplates control.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue