In the Manage Content and Layout (Scriptlets) area, please add a Save and close button, just like the Product page.
When working on the layout and style in the scripts I have found That I continually return to tweak the same page as I test the changes I intend to make. And this change would and will save time, each and every time.
Additionally the themes file manager when working in the style Sheets always take you back to the top of the file when pressing save, I have gotten into the habit of Adding a comment on the area I am working in so a quick fine will bring me back to where I was. If this could be changed I think it would be helpful.
Save and close button
- Hostmaster
- Commander (CMDR)
- Posts: 126
- Joined: Fri Jan 04, 2008 3:30 pm
- Location: Melbourne Fl
- Contact:
- m_plugables
- Commander (CMDR)
- Posts: 149
- Joined: Tue Mar 11, 2008 12:44 am
- Contact:
Save And Close Button
Edit the Admin/Website/Scriptlets/EditScriptlet.aspx page.
Add a new function Save and put all the SaveButton_Click function code in it with two small modifications
change the protected void SaveButton_Click(object sender, EventArgs e) function to look like
Add a new function
And now we have to add a "Save And Close" button to the page for
this locate the following line of code on the page
just make a copy of the line of code and make it look like
Add a new function Save and put all the SaveButton_Click function code in it with two small modifications
Code: Select all
private bool Save()
{
if (Page.IsValid)
{
//IF NAME HAS CHANGED WE MUST VERIFY IT IS NOT A DUPLICATE
string updatedIdentifier = Identifier.Text.Trim();
bool validIdentifier = true;
if (_Scriptlet.Identifier.ToLowerInvariant() != updatedIdentifier.ToLowerInvariant())
{
Scriptlet scriptlet = ScriptletDataSource.Load(updatedIdentifier, _ScriptletType, BitFieldState.True, false);
if (scriptlet != null)
{
CustomValidator uniqueValidator = new CustomValidator();
uniqueValidator.ControlToValidate = "Identifier";
uniqueValidator.IsValid = false;
uniqueValidator.Text = "*";
uniqueValidator.ErrorMessage = "A scriptlet with that name already exists. Name must be unique.";
IdentifierUnique.Controls.Add(uniqueValidator);
validIdentifier = false;
}
}
if (validIdentifier)
{
_Scriptlet.Identifier = Identifier.Text.Trim(" \r\n\t".ToCharArray());
_Scriptlet.Description = Description.Text.Trim(" \r\n\t".ToCharArray());
_Scriptlet.HeaderData = HeaderData.Text.Trim(" \r\n\t".ToCharArray());
_Scriptlet.ScriptletData = ScriptletData.Text.Trim(" \r\n\t".ToCharArray());
if (_Scriptlet.IsDirty) _Scriptlet.IsCustom = true;
_Scriptlet.Save();
}
return validIdentifier;
}
return false;
}
Code: Select all
protected void SaveButton_Click(object sender, EventArgs e)
{
Save();
}
Code: Select all
protected void SaveCloseButton_Click(object sender, EventArgs e)
{
if (Save())
RedirectMe();
}
this locate the following line of code on the page
Code: Select all
<asp:Button ID="SaveButton" runat="server" Text="Save" OnClick="SaveButton_Click" />
Code: Select all
<asp:Button ID="SaveCloseButton" runat="server" Text="Save And Close" OnClick="SaveCloseButton_Click" />
Last edited by m_plugables on Wed Mar 19, 2008 7:46 am, edited 1 time in total.
Re: Save and close button
I am so glad I found this post! Thank you very much, this modification will save me tons of annoying back and forth clicking and testing.