code formatting

This commit is contained in:
Shannon
2016-08-04 15:20:57 +02:00
parent 16afab86f3
commit 423588d018

View File

@@ -193,27 +193,35 @@ namespace umbraco.presentation.developer.packages
}
}
protected void validateActions(object sender, ServerValidateEventArgs e) {
protected void validateActions(object sender, ServerValidateEventArgs e)
{
string actions = tb_actions.Text;
if (!string.IsNullOrEmpty(actions)) {
if (!string.IsNullOrEmpty(actions))
{
actions = "<Actions>" + actions + "</Actions>";
try {
try
{
//we try to load an xml document with the potential malformed xml to ensure that this is actual action xml...
XmlDocument xd = new XmlDocument();
xd.LoadXml(actions);
e.IsValid = true;
} catch {
}
catch
{
e.IsValid = false;
}
}else
}
else
e.IsValid = true;
}
protected void saveOrPublish(object sender, CommandEventArgs e) {
protected void saveOrPublish(object sender, CommandEventArgs e)
{
if (!Page.IsValid) {
if (!Page.IsValid)
{
this.ClientTools.ShowSpeechBubble(BasePages.BasePage.speechBubbleIcon.error, "Saved failed.", "Some fields have not been filled-out correctly");
}
else
@@ -221,30 +229,36 @@ namespace umbraco.presentation.developer.packages
if (e.CommandName == "save")
SavePackage(true);
if (e.CommandName == "publish") {
if (e.CommandName == "publish")
{
SavePackage(false);
int packageID = int.Parse(Request.QueryString["id"]);
//string packFileName = cms.businesslogic.packager. Publish.publishPackage(packageID);
createdPackage.Publish();
if (!string.IsNullOrEmpty(pack.PackagePath)) {
if (!string.IsNullOrEmpty(pack.PackagePath))
{
packageUmbFile.Text = " &nbsp; <a href='" + IOHelper.ResolveUrl(pack.PackagePath) + "'>Download</a>";
this.ClientTools.ShowSpeechBubble(BasePages.BasePage.speechBubbleIcon.success, "Package saved and published", "");
} else {
}
else
{
this.ClientTools.ShowSpeechBubble(BasePages.BasePage.speechBubbleIcon.error, "Save failed", "check your umbraco log.");
}
}
}
}
protected void generateXML(object sender, EventArgs e) {
protected void generateXML(object sender, EventArgs e)
{
}
private void SavePackage(bool showNotification) {
private void SavePackage(bool showNotification)
{
pack.Author = packageAuthorName.Text;
pack.AuthorUrl = packageAuthorUrl.Text;
@@ -269,7 +283,8 @@ namespace umbraco.presentation.developer.packages
string tmpStylesheets = "";
foreach (ListItem li in stylesheets.Items) {
foreach (ListItem li in stylesheets.Items)
{
if (li.Selected)
tmpStylesheets += li.Value + ",";
}
@@ -277,7 +292,8 @@ namespace umbraco.presentation.developer.packages
string tmpDoctypes = "";
foreach (ListItem li in documentTypes.Items) {
foreach (ListItem li in documentTypes.Items)
{
if (li.Selected)
tmpDoctypes += li.Value + ",";
}
@@ -285,7 +301,8 @@ namespace umbraco.presentation.developer.packages
string tmpMacros = "";
foreach (ListItem li in macros.Items) {
foreach (ListItem li in macros.Items)
{
if (li.Selected)
tmpMacros += li.Value + ",";
}
@@ -293,40 +310,44 @@ namespace umbraco.presentation.developer.packages
string tmpLanguages = "";
foreach (ListItem li in languages.Items) {
foreach (ListItem li in languages.Items)
{
if (li.Selected)
tmpLanguages += li.Value + ",";
}
pack.Languages = new List<string>(tmpLanguages.Trim(',').Split(','));
string tmpDictionaries = "";
foreach (ListItem li in dictionary.Items) {
foreach (ListItem li in dictionary.Items)
{
if (li.Selected)
tmpDictionaries += li.Value + ",";
}
pack.DictionaryItems = new List<string>(tmpDictionaries.Trim(',').Split(','));
string tmpTemplates = "";
foreach (ListItem li in templates.Items) {
foreach (ListItem li in templates.Items)
{
if (li.Selected)
tmpTemplates += li.Value + ",";
}
pack.Templates = new List<string>(tmpTemplates.Trim(',').Split(','));
string tmpDataTypes = "";
foreach (ListItem li in cbl_datatypes.Items) {
foreach (ListItem li in cbl_datatypes.Items)
{
if (li.Selected)
tmpDataTypes += li.Value + ",";
}
pack.DataTypes = new List<string>(tmpDataTypes.Trim(',').Split(','));
pack.LoadControl = packageControlPath.Text;
createdPackage.Save();
if(showNotification)
if (showNotification)
this.ClientTools.ShowSpeechBubble(BasePages.BasePage.speechBubbleIcon.save, "Package Saved", "");
}
@@ -355,7 +376,7 @@ namespace umbraco.presentation.developer.packages
TextBox filePathControl = (TextBox)((Control)sender).Parent.FindControl("packageFilePath");
filePathControl.Text = "";
string tmpFilePathString = "";
string tmpFilePathString = "";
foreach (RepeaterItem rItem in packageFilesRepeater.Items)
{
string tmpFFFF = ((TextBox)rItem.FindControl("packageFilePath")).Text;
@@ -365,7 +386,7 @@ namespace umbraco.presentation.developer.packages
cms.businesslogic.packager.CreatedPackage createdPackage = cms.businesslogic.packager.CreatedPackage.GetById(int.Parse(Request.QueryString["id"]));
cms.businesslogic.packager.PackageInstance pack = createdPackage.Data;
pack.Files = new List<string>(tmpFilePathString.Trim('¤').Split('¤'));
pack.Files.TrimExcess();
@@ -384,7 +405,7 @@ namespace umbraco.presentation.developer.packages
packageInfo.Controls.Add(Pane1_1);
packageInfo.Controls.Add(Pane1_2);
packageInfo.Controls.Add(Pane1_3);
packageContents = TabView1.NewTabPage("Package Contents");
packageContents.Controls.Add(Pane2);
@@ -417,11 +438,11 @@ namespace umbraco.presentation.developer.packages
saves.ButtonType = uicontrols.MenuButtonType.Primary;
saves.ID = "save";
base.OnInit(e);
}
}
}