Merge with 6.0.4
This commit is contained in:
@@ -9,11 +9,16 @@ using System.Web.UI;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Web.UI.Pages;
|
||||
using umbraco.BusinessLogic;
|
||||
|
||||
namespace Umbraco.Web.UI.Umbraco.Developer.Packages
|
||||
{
|
||||
public partial class DirectoryBrowser : UmbracoEnsuredPage
|
||||
{
|
||||
public DirectoryBrowser()
|
||||
{
|
||||
CurrentApp = DefaultApps.developer.ToString();
|
||||
}
|
||||
|
||||
string _lsTitle;
|
||||
string _lsLink;
|
||||
|
||||
@@ -4,35 +4,43 @@ using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.businesslogic.skinning;
|
||||
|
||||
namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
{
|
||||
public partial class CssParser : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
|
||||
public CssParser()
|
||||
{
|
||||
//for skinning, you need to be a developer
|
||||
CurrentApp = DefaultApps.developer.ToString();
|
||||
}
|
||||
|
||||
//will be used to parse the global variables in the embedded css of a skin manifest
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
Response.ContentType = "text/plain";
|
||||
|
||||
string skinAlias = Request["skinAlias"];
|
||||
var skinAlias = Request["skinAlias"];
|
||||
|
||||
if (!string.IsNullOrEmpty(skinAlias) && Skin.CreateFromAlias(skinAlias) != null)
|
||||
{
|
||||
Skin ActiveSkin = Skin.CreateFromAlias(skinAlias);
|
||||
var activeSkin = Skin.CreateFromAlias(skinAlias);
|
||||
|
||||
if (ActiveSkin.Css != null)
|
||||
if (activeSkin.Css != null)
|
||||
{
|
||||
|
||||
SortedList<string, string> varValues = new SortedList<string, string>();
|
||||
var varValues = new SortedList<string, string>();
|
||||
|
||||
foreach (CssVariable var in ActiveSkin.Css.Variables)
|
||||
foreach (var var in activeSkin.Css.Variables)
|
||||
{
|
||||
varValues.Add(var.Name, string.IsNullOrEmpty(Request[var.Name]) ? var.DefaultValue : Request[var.Name]);
|
||||
|
||||
}
|
||||
|
||||
Response.Write(ParseEmbeddedCss(ActiveSkin.Css.Content,varValues));
|
||||
Response.Write(ParseEmbeddedCss(activeSkin.Css.Content,varValues));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.IO;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using umbraco.BusinessLogic;
|
||||
|
||||
namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
{
|
||||
@@ -17,7 +18,12 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
public int MaxWidth = 700;
|
||||
public int MaxHeight = 480;
|
||||
public string scaleWidth = "500px";
|
||||
|
||||
|
||||
public ImageUploader()
|
||||
{
|
||||
//for skinning, you need to be a developer
|
||||
CurrentApp = DefaultApps.developer.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -5,15 +5,22 @@ using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Reflection;
|
||||
using umbraco.IO;
|
||||
using Umbraco.Core.IO;
|
||||
using umbraco.BusinessLogic;
|
||||
|
||||
namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
{
|
||||
public partial class ModuleInjector : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
private cms.businesslogic.macro.Macro m;
|
||||
private cms.businesslogic.macro.Macro _m;
|
||||
public string _macroAlias = "";
|
||||
|
||||
public ModuleInjector()
|
||||
{
|
||||
//for skinning, you need to be a developer
|
||||
CurrentApp = DefaultApps.developer.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
renderProperties();
|
||||
@@ -25,38 +32,35 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
{
|
||||
|
||||
|
||||
m = cms.businesslogic.macro.Macro.GetByAlias(Request["macroAlias"]);
|
||||
_m = cms.businesslogic.macro.Macro.GetByAlias(Request["macroAlias"]);
|
||||
|
||||
String macroAssembly = "";
|
||||
String macroType = "";
|
||||
|
||||
_macroAlias = m.Alias;
|
||||
_macroAlias = _m.Alias;
|
||||
|
||||
|
||||
//If no properties, we will exit now...
|
||||
if (m.Properties.Length == 0)
|
||||
if (_m.Properties.Length == 0)
|
||||
{
|
||||
Literal noProps = new Literal();
|
||||
var noProps = new Literal();
|
||||
noProps.Text = "<script type='text/javascript'>updateMacro()</script>";
|
||||
macroProperties.Controls.Add(noProps);
|
||||
}
|
||||
else
|
||||
{
|
||||
//if we have properties, we'll render the controls for them...
|
||||
foreach (cms.businesslogic.macro.MacroProperty mp in m.Properties)
|
||||
foreach (cms.businesslogic.macro.MacroProperty mp in _m.Properties)
|
||||
{
|
||||
macroAssembly = mp.Type.Assembly;
|
||||
macroType = mp.Type.Type;
|
||||
var macroAssembly = mp.Type.Assembly;
|
||||
var macroType = mp.Type.Type;
|
||||
try
|
||||
{
|
||||
|
||||
Assembly assembly = Assembly.LoadFrom(IOHelper.MapPath(SystemDirectories.Bin + "/" + macroAssembly + ".dll"));
|
||||
var assembly = Assembly.LoadFrom(IOHelper.MapPath(SystemDirectories.Bin + "/" + macroAssembly + ".dll"));
|
||||
|
||||
Type type = assembly.GetType(macroAssembly + "." + macroType);
|
||||
interfaces.IMacroGuiRendering typeInstance = Activator.CreateInstance(type) as interfaces.IMacroGuiRendering;
|
||||
var type = assembly.GetType(macroAssembly + "." + macroType);
|
||||
var typeInstance = Activator.CreateInstance(type) as interfaces.IMacroGuiRendering;
|
||||
if (typeInstance != null)
|
||||
{
|
||||
Control control = Activator.CreateInstance(type) as Control;
|
||||
var control = Activator.CreateInstance(type) as Control;
|
||||
control.ID = mp.Alias;
|
||||
|
||||
if (!IsPostBack)
|
||||
@@ -71,7 +75,7 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
}
|
||||
|
||||
// register alias
|
||||
uicontrols.PropertyPanel pp = new uicontrols.PropertyPanel();
|
||||
var pp = new uicontrols.PropertyPanel();
|
||||
pp.Text = mp.Name;
|
||||
pp.Controls.Add(control);
|
||||
macroProperties.Controls.Add(pp);
|
||||
@@ -94,10 +98,6 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,33 +4,36 @@ using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.businesslogic.packager;
|
||||
|
||||
namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
{
|
||||
public partial class ModuleInstaller : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
private cms.businesslogic.packager.repositories.Repository repo;
|
||||
private string repoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66";
|
||||
|
||||
private readonly cms.businesslogic.packager.repositories.Repository _repo;
|
||||
private const string RepoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66";
|
||||
|
||||
public ModuleInstaller()
|
||||
{
|
||||
this.repo = cms.businesslogic.packager.repositories.Repository.getByGuid(this.repoGuid);
|
||||
_repo = cms.businesslogic.packager.repositories.Repository.getByGuid(RepoGuid);
|
||||
//for skinning, you need to be a developer
|
||||
CurrentApp = DefaultApps.developer.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if(!string.IsNullOrEmpty(Request["guid"])){
|
||||
if (!string.IsNullOrEmpty(Request["guid"]))
|
||||
{
|
||||
|
||||
Guid guid = new Guid(Request["guid"]);
|
||||
var guid = new Guid(Request["guid"]);
|
||||
|
||||
if (this.repo.HasConnection())
|
||||
if (_repo.HasConnection())
|
||||
{
|
||||
Installer installer = new Installer();
|
||||
string tempDir = installer.Import(this.repo.fetch(guid.ToString()));
|
||||
var installer = new Installer();
|
||||
var tempDir = installer.Import(_repo.fetch(guid.ToString()));
|
||||
installer.LoadConfig(tempDir);
|
||||
int packageId = installer.CreateManifest(tempDir, guid.ToString(), this.repoGuid);
|
||||
var packageId = installer.CreateManifest(tempDir, guid.ToString(), RepoGuid);
|
||||
installer.InstallFiles(packageId, tempDir);
|
||||
installer.InstallBusinessLogic(packageId, tempDir);
|
||||
installer.InstallCleanUp(packageId, tempDir);
|
||||
@@ -39,9 +42,9 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
library.RefreshContent();
|
||||
|
||||
if (cms.businesslogic.skinning.Skinning.IsPackageInstalled(new Guid(Request["guid"])) ||
|
||||
cms.businesslogic.skinning.Skinning.IsPackageInstalled(Request["name"]))
|
||||
cms.businesslogic.skinning.Skinning.IsPackageInstalled(Request["name"]))
|
||||
{
|
||||
Response.Write(cms.businesslogic.skinning.Skinning.GetModuleAlias(Request["name"]));
|
||||
Response.Write(cms.businesslogic.skinning.Skinning.GetModuleAlias(Request["name"]));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,29 +1,37 @@
|
||||
using System;
|
||||
using umbraco.BasePages;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.businesslogic.Exceptions;
|
||||
|
||||
namespace umbraco.presentation
|
||||
{
|
||||
public partial class LiveEditingEnabler : BasePages.UmbracoEnsuredPage
|
||||
public partial class LiveEditingEnabler : UmbracoEnsuredPage
|
||||
{
|
||||
public LiveEditingEnabler()
|
||||
{
|
||||
CurrentApp = DefaultApps.content.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if ((UmbracoSettings.EnableCanvasEditing || !String.IsNullOrEmpty(UmbracoContext.Current.Request["umbSkinning"])) && base.getUser() != null)
|
||||
if ((UmbracoSettings.EnableCanvasEditing || !String.IsNullOrEmpty(Request["umbSkinning"]) ) && getUser() != null)
|
||||
{
|
||||
UmbracoContext.Current.LiveEditingContext.Enabled = true;
|
||||
|
||||
string redirUrl = "/";
|
||||
if (!String.IsNullOrEmpty(helper.Request("redir")))
|
||||
var redirUrl = "/";
|
||||
if (!string.IsNullOrEmpty(helper.Request("redir")))
|
||||
redirUrl = helper.Request("redir");
|
||||
else if (Request.UrlReferrer != null && !Request.UrlReferrer.AbsolutePath.Contains("login.aspx"))
|
||||
redirUrl = Request.UrlReferrer.AbsolutePath;
|
||||
|
||||
Response.Redirect(redirUrl +
|
||||
(string.IsNullOrEmpty(UmbracoContext.Current.Request["umbSkinning"]) ? "" : "?umbSkinning=true") + (string.IsNullOrEmpty(UmbracoContext.Current.Request["umbSkinningConfigurator"]) ? "" : "&umbSkinningConfigurator=true"), true);
|
||||
(string.IsNullOrEmpty(Request["umbSkinning"]) ? "" : "?umbSkinning=true") + (string.IsNullOrEmpty(Request["umbSkinningConfigurator"]) ? "" : "&umbSkinningConfigurator=true"), true);
|
||||
}
|
||||
else if (!UmbracoSettings.EnableCanvasEditing)
|
||||
{
|
||||
throw new UserAuthorizationException(
|
||||
"Canvas editing isn't enabled. It can be enabled via the UmbracoSettings.config");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("User not logged in");
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.SessionState;
|
||||
using System.Web.UI;
|
||||
@@ -10,10 +11,10 @@ using System.Web.UI.WebControls;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Reflection;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
using Umbraco.Core.IO;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.businesslogic.macro;
|
||||
using System.Collections.Generic;
|
||||
using umbraco.IO;
|
||||
|
||||
namespace umbraco.developer
|
||||
{
|
||||
@@ -22,13 +23,15 @@ namespace umbraco.developer
|
||||
/// </summary>
|
||||
public partial class assemblyBrowser : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
protected void Page_Load(object sender, System.EventArgs e)
|
||||
public assemblyBrowser()
|
||||
{
|
||||
CurrentApp = DefaultApps.developer.ToString();
|
||||
}
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
// if (!IsPostBack)
|
||||
// {
|
||||
bool isUserControl = false;
|
||||
bool errorReadingControl = false;
|
||||
var isUserControl = false;
|
||||
var errorReadingControl = false;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -37,7 +40,7 @@ namespace umbraco.developer
|
||||
if (Request.QueryString["type"] == null)
|
||||
{
|
||||
isUserControl = true;
|
||||
string fileName = Request.QueryString["fileName"];
|
||||
var fileName = Request.QueryString["fileName"];
|
||||
if (!fileName.StartsWith("~"))
|
||||
{
|
||||
if (fileName.StartsWith("/"))
|
||||
@@ -49,12 +52,11 @@ namespace umbraco.developer
|
||||
fileName = "~/" + fileName;
|
||||
}
|
||||
}
|
||||
IOHelper.ValidateEditPath(fileName, SystemDirectories.Usercontrols);
|
||||
|
||||
|
||||
IOHelper.ValidateEditPath(fileName, SystemDirectories.UserControls);
|
||||
|
||||
if (System.IO.File.Exists(IOHelper.MapPath(fileName)))
|
||||
{
|
||||
UserControl oControl = (UserControl)LoadControl(fileName);
|
||||
var oControl = (UserControl)LoadControl(fileName);
|
||||
|
||||
type = oControl.GetType();
|
||||
}
|
||||
@@ -67,13 +69,11 @@ namespace umbraco.developer
|
||||
}
|
||||
else
|
||||
{
|
||||
string currentAss = IOHelper.MapPath(SystemDirectories.Bin + "/" + Request.QueryString["fileName"] + ".dll");
|
||||
Assembly asm = System.Reflection.Assembly.LoadFrom(currentAss);
|
||||
var currentAss = IOHelper.MapPath(SystemDirectories.Bin + "/" + Request.QueryString["fileName"] + ".dll");
|
||||
var asm = Assembly.LoadFrom(currentAss);
|
||||
type = asm.GetType(Request.QueryString["type"]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!errorReadingControl)
|
||||
{
|
||||
string fullControlAssemblyName;
|
||||
@@ -92,23 +92,18 @@ namespace umbraco.developer
|
||||
if (!IsPostBack && type != null)
|
||||
{
|
||||
MacroProperties.Items.Clear();
|
||||
foreach (PropertyInfo pi in type.GetProperties())
|
||||
foreach (var pi in type.GetProperties())
|
||||
{
|
||||
if (pi.CanWrite && fullControlAssemblyName == pi.DeclaringType.Namespace + "." + pi.DeclaringType.Name)
|
||||
{
|
||||
MacroProperties.Items.Add(new ListItem(pi.Name + " <span style=\"color: #99CCCC\">(" + pi.PropertyType.Name + ")</span>", pi.PropertyType.Name));
|
||||
|
||||
// Response.Write("<li>" + pi.Name + ", " + pi.CanWrite.ToString() + ", " + pi.DeclaringType.Namespace+"."+pi.DeclaringType.Name + ", " + pi.PropertyType.Name + "</li>");
|
||||
}
|
||||
|
||||
foreach (ListItem li in MacroProperties.Items)
|
||||
li.Selected = true;
|
||||
}
|
||||
}
|
||||
else if (type == null)
|
||||
{
|
||||
AssemblyName.Text = "Type '" + Request.QueryString["type"] + "' is null";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
@@ -117,130 +112,102 @@ namespace umbraco.developer
|
||||
Button1.Visible = false;
|
||||
ChooseProperties.Controls.Add(new LiteralControl("<p class=\"guiDialogNormal\" style=\"color: red;\">" + err.ToString() + "</p><p/><p class=\"guiDialogNormal\">"));
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
#region Web Form Designer generated code
|
||||
override protected void OnInit(EventArgs e)
|
||||
|
||||
protected void Button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
//
|
||||
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
|
||||
//
|
||||
InitializeComponent();
|
||||
base.OnInit(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void Button1_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
string result = "";
|
||||
var result = "";
|
||||
|
||||
// Get the macro object
|
||||
umbraco.cms.businesslogic.macro.Macro macroObject =
|
||||
new umbraco.cms.businesslogic.macro.Macro(Convert.ToInt32(Request.QueryString["macroID"]));
|
||||
var macroObject = new Macro(Convert.ToInt32(Request.QueryString["macroID"]));
|
||||
|
||||
// Load all macroPropertyTypes
|
||||
Hashtable macroPropertyTypes = new Hashtable();
|
||||
Hashtable macroPropertyIds = new Hashtable();
|
||||
var macroPropertyTypes = new Hashtable();
|
||||
var macroPropertyIds = new Hashtable();
|
||||
|
||||
// SqlDataReader dr = SqlHelper.ExecuteReader(_ConnString, CommandType.Text, "select id, macroPropertyTypeBaseType, macroPropertyTypeAlias from cmsMacroPropertyType");
|
||||
List<MacroPropertyType> macroPropTypes = MacroPropertyType.GetAll;
|
||||
foreach (MacroPropertyType mpt in macroPropTypes)
|
||||
var macroPropTypes = MacroPropertyType.GetAll;
|
||||
foreach (var mpt in macroPropTypes)
|
||||
{
|
||||
macroPropertyIds.Add(mpt.Alias, mpt.Id.ToString());
|
||||
|
||||
macroPropertyTypes.Add(mpt.Alias, mpt.BaseType);
|
||||
}
|
||||
// dr.Close();
|
||||
|
||||
foreach (ListItem li in MacroProperties.Items)
|
||||
{
|
||||
if (li.Selected && !macrohasProperty(macroObject, li.Text.Substring(0, li.Text.IndexOf(" ")).ToLower()))
|
||||
if (li.Selected && !MacroHasProperty(macroObject, li.Text.Substring(0, li.Text.IndexOf(" ")).ToLower()))
|
||||
{
|
||||
result += "<li>Added: " + spaceCamelCasing(li.Text) + "</li>";
|
||||
string _macroPropertyTypeAlias = findMacroType(macroPropertyTypes, li.Value);
|
||||
if (_macroPropertyTypeAlias == "")
|
||||
_macroPropertyTypeAlias = "text";
|
||||
object propertyId = macroPropertyIds[_macroPropertyTypeAlias];
|
||||
result += "<li>Added: " + SpaceCamelCasing(li.Text) + "</li>";
|
||||
var macroPropertyTypeAlias = FindMacroType(macroPropertyTypes, li.Value);
|
||||
if (macroPropertyTypeAlias == "")
|
||||
macroPropertyTypeAlias = "text";
|
||||
var propertyId = macroPropertyIds[macroPropertyTypeAlias];
|
||||
if (propertyId != null)
|
||||
{
|
||||
int macroPropertyTypeId = 0;
|
||||
var macroPropertyTypeId = 0;
|
||||
if(int.TryParse(string.Format("{0}", propertyId), out macroPropertyTypeId))
|
||||
{
|
||||
MacroProperty.MakeNew(macroObject,
|
||||
true,
|
||||
li.Text.Substring(0, li.Text.IndexOf(" ")),
|
||||
spaceCamelCasing(li.Text),
|
||||
macroPropTypes.Find(delegate(MacroPropertyType mpt) { return mpt.Id == macroPropertyTypeId; }));
|
||||
SpaceCamelCasing(li.Text),
|
||||
macroPropTypes.Find(mpt => mpt.Id == macroPropertyTypeId));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (li.Selected)
|
||||
result += "<li>Skipped: " + spaceCamelCasing(li.Text) + " (already exists as a parameter)</li>";
|
||||
result += "<li>Skipped: " + SpaceCamelCasing(li.Text) + " (already exists as a parameter)</li>";
|
||||
}
|
||||
ChooseProperties.Visible = false;
|
||||
ConfigProperties.Visible = true;
|
||||
resultLiteral.Text = result;
|
||||
}
|
||||
|
||||
private bool macrohasProperty(umbraco.cms.businesslogic.macro.Macro macroObject, string propertyAlias)
|
||||
private static bool MacroHasProperty(Macro macroObject, string propertyAlias)
|
||||
{
|
||||
foreach (cms.businesslogic.macro.MacroProperty mp in macroObject.Properties)
|
||||
if (mp.Alias.ToLower() == propertyAlias)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return macroObject.Properties.Any(mp => mp.Alias.ToLower() == propertyAlias);
|
||||
}
|
||||
|
||||
private string spaceCamelCasing(string text)
|
||||
private static string SpaceCamelCasing(string text)
|
||||
{
|
||||
string _tempString = text.Substring(0, 1).ToUpper();
|
||||
for (int i = 1; i < text.Length; i++)
|
||||
var tempString = text.Substring(0, 1).ToUpper();
|
||||
for (var i = 1; i < text.Length; i++)
|
||||
{
|
||||
if (text.Substring(i, 1) == " ")
|
||||
break;
|
||||
if (text.Substring(i, 1).ToUpper() == text.Substring(i, 1))
|
||||
_tempString += " ";
|
||||
_tempString += text.Substring(i, 1);
|
||||
tempString += " ";
|
||||
tempString += text.Substring(i, 1);
|
||||
}
|
||||
return _tempString;
|
||||
return tempString;
|
||||
}
|
||||
|
||||
private string findMacroType(Hashtable macroPropertyTypes, string baseTypeName)
|
||||
private static string FindMacroType(Hashtable macroPropertyTypes, string baseTypeName)
|
||||
{
|
||||
string _tempType = "";
|
||||
var tempType = "";
|
||||
// Hard-code numeric values
|
||||
if (baseTypeName == "Int32")
|
||||
_tempType = "number";
|
||||
tempType = "number";
|
||||
else if (baseTypeName == "Decimal")
|
||||
_tempType = "decimal";
|
||||
tempType = "decimal";
|
||||
else if (baseTypeName == "String")
|
||||
_tempType = "text";
|
||||
tempType = "text";
|
||||
else if (baseTypeName == "Boolean")
|
||||
_tempType = "bool";
|
||||
tempType = "bool";
|
||||
else
|
||||
{
|
||||
|
||||
foreach (DictionaryEntry de in macroPropertyTypes)
|
||||
{
|
||||
if (de.Value.ToString() == baseTypeName)
|
||||
{
|
||||
_tempType = de.Key.ToString();
|
||||
tempType = de.Key.ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _tempType;
|
||||
return tempType;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,12 +8,18 @@ using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using umbraco.BusinessLogic;
|
||||
|
||||
namespace umbraco.presentation.developer.packages
|
||||
{
|
||||
[Obsolete("This class is no longer used and will be removed from the codebase in the future")]
|
||||
public partial class directoryBrowser : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
public directoryBrowser()
|
||||
{
|
||||
CurrentApp = DefaultApps.developer.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// pane control.
|
||||
/// </summary>
|
||||
|
||||
@@ -11,13 +11,14 @@ using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using runtimeMacro = umbraco.macro;
|
||||
using System.Xml;
|
||||
using umbraco.IO;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
using BizLogicAction = umbraco.BusinessLogic.Actions.Action;
|
||||
using Macro = umbraco.cms.businesslogic.macro.Macro;
|
||||
@@ -27,20 +28,25 @@ namespace umbraco.presentation.developer.packages
|
||||
{
|
||||
public partial class installedPackage : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
private cms.businesslogic.packager.InstalledPackage pack;
|
||||
private cms.businesslogic.packager.repositories.Repository repo = new global::umbraco.cms.businesslogic.packager.repositories.Repository();
|
||||
public installedPackage()
|
||||
{
|
||||
CurrentApp = DefaultApps.developer.ToString();
|
||||
}
|
||||
|
||||
private cms.businesslogic.packager.InstalledPackage _pack;
|
||||
private cms.businesslogic.packager.repositories.Repository _repo = new cms.businesslogic.packager.repositories.Repository();
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (Request.QueryString["id"] != null)
|
||||
{
|
||||
pack = cms.businesslogic.packager.InstalledPackage.GetById(int.Parse(Request.QueryString["id"]));
|
||||
_pack = cms.businesslogic.packager.InstalledPackage.GetById(int.Parse(Request.QueryString["id"]));
|
||||
|
||||
lt_packagename.Text = pack.Data.Name;
|
||||
lt_packageVersion.Text = pack.Data.Version;
|
||||
lt_packageAuthor.Text = pack.Data.Author;
|
||||
lt_readme.Text = library.ReplaceLineBreaks( pack.Data.Readme );
|
||||
lt_packagename.Text = _pack.Data.Name;
|
||||
lt_packageVersion.Text = _pack.Data.Version;
|
||||
lt_packageAuthor.Text = _pack.Data.Author;
|
||||
lt_readme.Text = library.ReplaceLineBreaks( _pack.Data.Readme );
|
||||
|
||||
bt_confirmUninstall.Attributes.Add("onClick", "jQuery('#buttons').hide(); jQuery('#loadingbar').show();; return true;");
|
||||
|
||||
@@ -48,26 +54,19 @@ namespace umbraco.presentation.developer.packages
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
//temp list to contain failing items...
|
||||
List<string> tempList = new List<string>();
|
||||
var tempList = new List<string>();
|
||||
|
||||
foreach (string str in pack.Data.Documenttypes)
|
||||
foreach (var str in _pack.Data.Documenttypes)
|
||||
{
|
||||
int tId = 0;
|
||||
var tId = 0;
|
||||
if (int.TryParse(str, out tId))
|
||||
{
|
||||
try
|
||||
{
|
||||
DocumentType dc = new DocumentType(tId);
|
||||
if (dc != null)
|
||||
{
|
||||
ListItem li = new ListItem(dc.Text, dc.Id.ToString());
|
||||
li.Selected = true;
|
||||
documentTypes.Items.Add(li);
|
||||
}
|
||||
else
|
||||
{
|
||||
tempList.Add(str);
|
||||
}
|
||||
var dc = new DocumentType(tId);
|
||||
var li = new ListItem(dc.Text, dc.Id.ToString());
|
||||
li.Selected = true;
|
||||
documentTypes.Items.Add(li);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -76,27 +75,20 @@ namespace umbraco.presentation.developer.packages
|
||||
}
|
||||
}
|
||||
//removing failing documentTypes items from the uninstall manifest
|
||||
syncLists(pack.Data.Documenttypes, tempList);
|
||||
SyncLists(_pack.Data.Documenttypes, tempList);
|
||||
|
||||
|
||||
foreach (string str in pack.Data.Templates)
|
||||
foreach (var str in _pack.Data.Templates)
|
||||
{
|
||||
int tId = 0;
|
||||
var tId = 0;
|
||||
if (int.TryParse(str, out tId))
|
||||
{
|
||||
try
|
||||
{
|
||||
Template t = new Template(tId);
|
||||
if (t != null)
|
||||
{
|
||||
ListItem li = new ListItem(t.Text, t.Id.ToString());
|
||||
li.Selected = true;
|
||||
templates.Items.Add(li);
|
||||
}
|
||||
else
|
||||
{
|
||||
tempList.Add(str);
|
||||
}
|
||||
var t = new Template(tId);
|
||||
var li = new ListItem(t.Text, t.Id.ToString());
|
||||
li.Selected = true;
|
||||
templates.Items.Add(li);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -105,26 +97,19 @@ namespace umbraco.presentation.developer.packages
|
||||
}
|
||||
}
|
||||
//removing failing template items from the uninstall manifest
|
||||
syncLists(pack.Data.Templates, tempList);
|
||||
SyncLists(_pack.Data.Templates, tempList);
|
||||
|
||||
foreach (string str in pack.Data.Stylesheets)
|
||||
foreach (string str in _pack.Data.Stylesheets)
|
||||
{
|
||||
int tId = 0;
|
||||
if (int.TryParse(str, out tId))
|
||||
{
|
||||
try
|
||||
{
|
||||
StyleSheet s = new StyleSheet(tId);
|
||||
if (s != null)
|
||||
{
|
||||
ListItem li = new ListItem(s.Text, s.Id.ToString());
|
||||
li.Selected = true;
|
||||
stylesheets.Items.Add(li);
|
||||
}
|
||||
else
|
||||
{
|
||||
tempList.Add(str);
|
||||
}
|
||||
var s = new StyleSheet(tId);
|
||||
ListItem li = new ListItem(s.Text, s.Id.ToString());
|
||||
li.Selected = true;
|
||||
stylesheets.Items.Add(li);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -133,20 +118,20 @@ namespace umbraco.presentation.developer.packages
|
||||
}
|
||||
}
|
||||
//removing failing stylesheet items from the uninstall manifest
|
||||
syncLists(pack.Data.Stylesheets, tempList);
|
||||
SyncLists(_pack.Data.Stylesheets, tempList);
|
||||
|
||||
foreach (string str in pack.Data.Macros)
|
||||
foreach (var str in _pack.Data.Macros)
|
||||
{
|
||||
int tId = 0;
|
||||
var tId = 0;
|
||||
if (int.TryParse(str, out tId))
|
||||
{
|
||||
try
|
||||
{
|
||||
Macro m = new Macro(tId);
|
||||
|
||||
if (m != null && !string.IsNullOrEmpty(m.Name))
|
||||
{ //Macros need an extra check to see if they actually exists. For some reason the macro does not return null, if the id is not found...
|
||||
ListItem li = new ListItem(m.Name, m.Id.ToString());
|
||||
var m = new Macro(tId);
|
||||
if (!string.IsNullOrEmpty(m.Name))
|
||||
{
|
||||
//Macros need an extra check to see if they actually exists. For some reason the macro does not return null, if the id is not found...
|
||||
var li = new ListItem(m.Name, m.Id.ToString());
|
||||
li.Selected = true;
|
||||
macros.Items.Add(li);
|
||||
}
|
||||
@@ -162,16 +147,15 @@ namespace umbraco.presentation.developer.packages
|
||||
}
|
||||
}
|
||||
//removing failing macros items from the uninstall manifest
|
||||
syncLists(pack.Data.Macros, tempList);
|
||||
SyncLists(_pack.Data.Macros, tempList);
|
||||
|
||||
foreach (string str in pack.Data.Files)
|
||||
foreach (var str in _pack.Data.Files)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
if (!String.IsNullOrEmpty(str) && System.IO.File.Exists( IOHelper.MapPath(str) ))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(str) && System.IO.File.Exists(IOHelper.MapPath(str) ))
|
||||
{
|
||||
ListItem li = new ListItem(str, str);
|
||||
var li = new ListItem(str, str);
|
||||
li.Selected = true;
|
||||
files.Items.Add(li);
|
||||
}
|
||||
@@ -188,29 +172,22 @@ namespace umbraco.presentation.developer.packages
|
||||
}
|
||||
|
||||
//removing failing files from the uninstall manifest
|
||||
syncLists(pack.Data.Files, tempList);
|
||||
SyncLists(_pack.Data.Files, tempList);
|
||||
|
||||
foreach (string str in pack.Data.DictionaryItems)
|
||||
foreach (string str in _pack.Data.DictionaryItems)
|
||||
{
|
||||
int tId = 0;
|
||||
var tId = 0;
|
||||
|
||||
if (int.TryParse(str, out tId))
|
||||
{
|
||||
try
|
||||
{
|
||||
cms.businesslogic.Dictionary.DictionaryItem di = new global::umbraco.cms.businesslogic.Dictionary.DictionaryItem(tId);
|
||||
var di = new cms.businesslogic.Dictionary.DictionaryItem(tId);
|
||||
|
||||
if (di != null)
|
||||
{
|
||||
ListItem li = new ListItem(di.key, di.id.ToString());
|
||||
li.Selected = true;
|
||||
var li = new ListItem(di.key, di.id.ToString());
|
||||
li.Selected = true;
|
||||
|
||||
dictionaryItems.Items.Add(li);
|
||||
}
|
||||
else
|
||||
{
|
||||
tempList.Add(str);
|
||||
}
|
||||
dictionaryItems.Items.Add(li);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -220,22 +197,22 @@ namespace umbraco.presentation.developer.packages
|
||||
}
|
||||
|
||||
//removing failing files from the uninstall manifest
|
||||
syncLists(pack.Data.DictionaryItems, tempList);
|
||||
SyncLists(_pack.Data.DictionaryItems, tempList);
|
||||
|
||||
|
||||
foreach (string str in pack.Data.DataTypes)
|
||||
foreach (var str in _pack.Data.DataTypes)
|
||||
{
|
||||
int tId = 0;
|
||||
var tId = 0;
|
||||
|
||||
if (int.TryParse(str, out tId))
|
||||
{
|
||||
try
|
||||
{
|
||||
cms.businesslogic.datatype.DataTypeDefinition dtd = new global::umbraco.cms.businesslogic.datatype.DataTypeDefinition(tId);
|
||||
var dtd = new cms.businesslogic.datatype.DataTypeDefinition(tId);
|
||||
|
||||
if (dtd != null)
|
||||
{
|
||||
ListItem li = new ListItem(dtd.Text, dtd.Id.ToString());
|
||||
var li = new ListItem(dtd.Text, dtd.Id.ToString());
|
||||
li.Selected = true;
|
||||
|
||||
dataTypes.Items.Add(li);
|
||||
@@ -253,47 +230,53 @@ namespace umbraco.presentation.developer.packages
|
||||
}
|
||||
|
||||
//removing failing files from the uninstall manifest
|
||||
syncLists(pack.Data.DataTypes, tempList);
|
||||
SyncLists(_pack.Data.DataTypes, tempList);
|
||||
|
||||
//save the install manifest, so even tho the user doesn't uninstall, it stays uptodate.
|
||||
pack.Save();
|
||||
_pack.Save();
|
||||
|
||||
|
||||
//Look for updates on packages.
|
||||
if (!String.IsNullOrEmpty(pack.Data.RepositoryGuid) && !String.IsNullOrEmpty(pack.Data.PackageGuid))
|
||||
if (!string.IsNullOrEmpty(_pack.Data.RepositoryGuid) && !string.IsNullOrEmpty(_pack.Data.PackageGuid))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
repo = cms.businesslogic.packager.repositories.Repository.getByGuid(pack.Data.RepositoryGuid);
|
||||
_repo = cms.businesslogic.packager.repositories.Repository.getByGuid(_pack.Data.RepositoryGuid);
|
||||
|
||||
if (repo != null)
|
||||
if (_repo != null)
|
||||
{
|
||||
hl_packageRepo.Text = repo.Name;
|
||||
hl_packageRepo.NavigateUrl = "BrowseRepository.aspx?repoGuid=" + repo.Guid;
|
||||
hl_packageRepo.Text = _repo.Name;
|
||||
hl_packageRepo.NavigateUrl = "BrowseRepository.aspx?repoGuid=" + _repo.Guid;
|
||||
pp_repository.Visible = true;
|
||||
}
|
||||
|
||||
cms.businesslogic.packager.repositories.Package repoPackage = repo.Webservice.PackageByGuid(pack.Data.PackageGuid);
|
||||
var repoPackage = _repo.Webservice.PackageByGuid(_pack.Data.PackageGuid);
|
||||
|
||||
if (repoPackage != null) {
|
||||
if (repoPackage.HasUpgrade && repoPackage.UpgradeVersion != pack.Data.Version) {
|
||||
if (repoPackage != null)
|
||||
{
|
||||
if (repoPackage.HasUpgrade && repoPackage.UpgradeVersion != _pack.Data.Version)
|
||||
{
|
||||
bt_update.Visible = true;
|
||||
bt_update.Text = "Update available: version: " + repoPackage.UpgradeVersion;
|
||||
lt_upgradeReadme.Text = repoPackage.UpgradeReadMe;
|
||||
bt_gotoUpgrade.OnClientClick = "window.location.href = 'browseRepository.aspx?url=" + repoPackage.Url + "'; return true;";
|
||||
lt_noUpdate.Visible = false;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
bt_update.Visible = false;
|
||||
lt_noUpdate.Visible = true;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(repoPackage.Demo)) {
|
||||
lb_demoLink.OnClientClick = "openDemo(this, '" + pack.Data.PackageGuid + "'); return false;";
|
||||
if (!string.IsNullOrEmpty(repoPackage.Demo))
|
||||
{
|
||||
lb_demoLink.OnClientClick = "openDemo(this, '" + _pack.Data.PackageGuid + "'); return false;";
|
||||
pp_documentation.Visible = true;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrEmpty(repoPackage.Documentation)) {
|
||||
|
||||
if (!string.IsNullOrEmpty(repoPackage.Documentation))
|
||||
{
|
||||
hl_docLink.NavigateUrl = repoPackage.Documentation;
|
||||
hl_docLink.Target = "_blank";
|
||||
pp_documentation.Visible = true;
|
||||
@@ -308,7 +291,7 @@ namespace umbraco.presentation.developer.packages
|
||||
}
|
||||
|
||||
|
||||
bool deletePackage = true;
|
||||
var deletePackage = true;
|
||||
//sync the UI to match what is in the package
|
||||
if (macros.Items.Count == 0)
|
||||
pp_macros.Visible = false;
|
||||
@@ -356,14 +339,14 @@ namespace umbraco.presentation.developer.packages
|
||||
}
|
||||
}
|
||||
|
||||
private void syncLists(List<string> list, List<string> removed)
|
||||
private static void SyncLists(List<string> list, List<string> removed)
|
||||
{
|
||||
foreach (string str in removed)
|
||||
foreach (var str in removed)
|
||||
{
|
||||
list.Remove(str);
|
||||
}
|
||||
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
for (var i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (String.IsNullOrEmpty(list[i].Trim()))
|
||||
list.RemoveAt(i);
|
||||
@@ -374,7 +357,7 @@ namespace umbraco.presentation.developer.packages
|
||||
|
||||
protected void delPack(object sender, EventArgs e)
|
||||
{
|
||||
pack.Delete();
|
||||
_pack.Delete();
|
||||
packageUninstalled.Visible = true;
|
||||
installedPackagePanel.Visible = false;
|
||||
}
|
||||
@@ -382,10 +365,7 @@ namespace umbraco.presentation.developer.packages
|
||||
|
||||
protected void confirmUnInstall(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
|
||||
bool refreshCache = false;
|
||||
var refreshCache = false;
|
||||
|
||||
//Uninstall Stylesheets
|
||||
foreach (ListItem li in stylesheets.Items)
|
||||
@@ -396,12 +376,9 @@ namespace umbraco.presentation.developer.packages
|
||||
|
||||
if (int.TryParse(li.Value, out nId))
|
||||
{
|
||||
StyleSheet s = new StyleSheet(nId);
|
||||
if (s != null)
|
||||
{
|
||||
s.delete();
|
||||
pack.Data.Stylesheets.Remove(nId.ToString());
|
||||
}
|
||||
var s = new StyleSheet(nId);
|
||||
s.delete();
|
||||
_pack.Data.Stylesheets.Remove(nId.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -415,13 +392,10 @@ namespace umbraco.presentation.developer.packages
|
||||
|
||||
if (int.TryParse(li.Value, out nId))
|
||||
{
|
||||
Template s = new Template(nId);
|
||||
if (s != null)
|
||||
{
|
||||
s.RemoveAllReferences();
|
||||
s.delete();
|
||||
pack.Data.Templates.Remove(nId.ToString());
|
||||
}
|
||||
var s = new Template(nId);
|
||||
s.RemoveAllReferences();
|
||||
s.delete();
|
||||
_pack.Data.Templates.Remove(nId.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -435,19 +409,17 @@ namespace umbraco.presentation.developer.packages
|
||||
|
||||
if (int.TryParse(li.Value, out nId))
|
||||
{
|
||||
Macro s = new Macro(nId);
|
||||
if (s != null && !String.IsNullOrEmpty(s.Name))
|
||||
var s = new Macro(nId);
|
||||
if (!string.IsNullOrEmpty(s.Name))
|
||||
{
|
||||
s.Delete();
|
||||
}
|
||||
|
||||
pack.Data.Macros.Remove(nId.ToString());
|
||||
_pack.Data.Macros.Remove(nId.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Remove Document Types
|
||||
var contentTypes = new List<IContentType>();
|
||||
var contentTypeService = ApplicationContext.Current.Services.ContentTypeService;
|
||||
@@ -463,7 +435,7 @@ namespace umbraco.presentation.developer.packages
|
||||
if (contentType != null)
|
||||
{
|
||||
contentTypes.Add(contentType);
|
||||
pack.Data.Documenttypes.Remove(nId.ToString(CultureInfo.InvariantCulture));
|
||||
_pack.Data.Documenttypes.Remove(nId.ToString(CultureInfo.InvariantCulture));
|
||||
// refresh content cache when document types are removed
|
||||
refreshCache = true;
|
||||
}
|
||||
@@ -492,12 +464,9 @@ namespace umbraco.presentation.developer.packages
|
||||
|
||||
if (int.TryParse(li.Value, out nId))
|
||||
{
|
||||
cms.businesslogic.Dictionary.DictionaryItem di = new global::umbraco.cms.businesslogic.Dictionary.DictionaryItem(nId);
|
||||
if (di != null)
|
||||
{
|
||||
di.delete();
|
||||
pack.Data.DictionaryItems.Remove(nId.ToString());
|
||||
}
|
||||
var di = new cms.businesslogic.Dictionary.DictionaryItem(nId);
|
||||
di.delete();
|
||||
_pack.Data.DictionaryItems.Remove(nId.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -511,49 +480,45 @@ namespace umbraco.presentation.developer.packages
|
||||
|
||||
if (int.TryParse(li.Value, out nId))
|
||||
{
|
||||
cms.businesslogic.datatype.DataTypeDefinition dtd = new global::umbraco.cms.businesslogic.datatype.DataTypeDefinition(nId);
|
||||
if (dtd != null)
|
||||
{
|
||||
dtd.delete();
|
||||
pack.Data.DataTypes.Remove(nId.ToString());
|
||||
}
|
||||
var dtd = new cms.businesslogic.datatype.DataTypeDefinition(nId);
|
||||
dtd.delete();
|
||||
_pack.Data.DataTypes.Remove(nId.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pack.Save();
|
||||
_pack.Save();
|
||||
|
||||
if (!isManifestEmpty())
|
||||
if (!IsManifestEmpty())
|
||||
{
|
||||
Response.Redirect(Request.RawUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.Debug<installedPackage>("executing undo actions");
|
||||
|
||||
|
||||
// uninstall actions
|
||||
try
|
||||
{
|
||||
var actionsXml = new System.Xml.XmlDocument();
|
||||
actionsXml.LoadXml("<Actions>" + pack.Data.Actions + "</Actions>");
|
||||
try
|
||||
{
|
||||
var actionsXml = new XmlDocument();
|
||||
actionsXml.LoadXml("<Actions>" + _pack.Data.Actions + "</Actions>");
|
||||
|
||||
LogHelper.Debug<installedPackage>(actionsXml.OuterXml);
|
||||
LogHelper.Debug<installedPackage>("executing undo actions: {0}", () => actionsXml.OuterXml);
|
||||
|
||||
foreach (XmlNode n in actionsXml.DocumentElement.SelectNodes("//Action"))
|
||||
{
|
||||
try
|
||||
{
|
||||
cms.businesslogic.packager.PackageAction.UndoPackageAction(pack.Data.Name, n.Attributes["alias"].Value, n);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error<installedPackage>("An error occurred in UndoPackageAction", ex);
|
||||
foreach (XmlNode n in actionsXml.DocumentElement.SelectNodes("//Action"))
|
||||
{
|
||||
try
|
||||
{
|
||||
cms.businesslogic.packager.PackageAction.UndoPackageAction(_pack.Data.Name, n.Attributes["alias"].Value, n);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error<installedPackage>("An error occurred running undo actions", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error<installedPackage>("An error occurred", ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error<installedPackage>("An error occurred running undo actions", ex);
|
||||
}
|
||||
|
||||
//moved remove of files here so custom package actions can still undo
|
||||
@@ -564,26 +529,27 @@ namespace umbraco.presentation.developer.packages
|
||||
{
|
||||
//here we need to try to find the file in question as most packages does not support the tilde char
|
||||
|
||||
string file = IOHelper.FindFile(li.Value);
|
||||
var file = IOHelper.FindFile(li.Value);
|
||||
|
||||
string filePath = IOHelper.MapPath(file);
|
||||
var filePath = IOHelper.MapPath(file);
|
||||
if (System.IO.File.Exists(filePath))
|
||||
{
|
||||
System.IO.File.Delete(filePath);
|
||||
pack.Data.Files.Remove(li.Value);
|
||||
_pack.Data.Files.Remove(li.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
pack.Save();
|
||||
_pack.Save();
|
||||
|
||||
pack.Delete();
|
||||
_pack.Delete();
|
||||
|
||||
packageUninstalled.Visible = true;
|
||||
installedPackagePanel.Visible = false;
|
||||
}
|
||||
|
||||
// refresh cache
|
||||
if (refreshCache) {
|
||||
if (refreshCache)
|
||||
{
|
||||
library.RefreshContent();
|
||||
}
|
||||
|
||||
@@ -597,72 +563,62 @@ namespace umbraco.presentation.developer.packages
|
||||
|
||||
}
|
||||
|
||||
private bool isManifestEmpty()
|
||||
private bool IsManifestEmpty()
|
||||
{
|
||||
|
||||
pack.Data.Documenttypes.TrimExcess();
|
||||
pack.Data.Files.TrimExcess();
|
||||
pack.Data.Macros.TrimExcess();
|
||||
pack.Data.Stylesheets.TrimExcess();
|
||||
pack.Data.Templates.TrimExcess();
|
||||
pack.Data.DataTypes.TrimExcess();
|
||||
pack.Data.DictionaryItems.TrimExcess();
|
||||
_pack.Data.Documenttypes.TrimExcess();
|
||||
_pack.Data.Files.TrimExcess();
|
||||
_pack.Data.Macros.TrimExcess();
|
||||
_pack.Data.Stylesheets.TrimExcess();
|
||||
_pack.Data.Templates.TrimExcess();
|
||||
_pack.Data.DataTypes.TrimExcess();
|
||||
_pack.Data.DictionaryItems.TrimExcess();
|
||||
|
||||
var lists = new List<List<string>>
|
||||
{
|
||||
_pack.Data.Documenttypes,
|
||||
_pack.Data.Macros,
|
||||
_pack.Data.Stylesheets,
|
||||
_pack.Data.Templates,
|
||||
_pack.Data.DictionaryItems,
|
||||
_pack.Data.DataTypes
|
||||
};
|
||||
|
||||
List<List<string>> lists = new List<List<string>>();
|
||||
lists.Add(pack.Data.Documenttypes);
|
||||
|
||||
//Not including files, since there might be assemblies that contain package actions
|
||||
//lists.Add(pack.Data.Files);
|
||||
lists.Add(pack.Data.Macros);
|
||||
lists.Add(pack.Data.Stylesheets);
|
||||
lists.Add(pack.Data.Templates);
|
||||
lists.Add(pack.Data.DictionaryItems);
|
||||
lists.Add(pack.Data.DataTypes);
|
||||
|
||||
|
||||
|
||||
foreach (List<string> list in lists)
|
||||
{
|
||||
|
||||
foreach (string str in list)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(str.Trim()))
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
return lists.SelectMany(list => list).All(str => string.IsNullOrEmpty(str.Trim()));
|
||||
}
|
||||
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
base.OnInit(e);
|
||||
Panel1.Text = ui.Text("treeHeaders", "installedPackages");
|
||||
pane_meta.Text = ui.Text("packager", "packageMetaData");
|
||||
pp_name.Text = ui.Text("packager", "packageName");
|
||||
pp_version.Text = ui.Text("packager", "packageVersion");
|
||||
pp_author.Text = ui.Text("packager", "packageAuthor");
|
||||
pp_repository.Text = ui.Text("packager", "packageRepository");
|
||||
pp_documentation.Text = ui.Text("packager", "packageDocumentation");
|
||||
pp_readme.Text = ui.Text("packager", "packageReadme");
|
||||
hl_docLink.Text = ui.Text("packager", "packageDocumentation");
|
||||
lb_demoLink.Text = ui.Text("packager", "packageDemonstration");
|
||||
base.OnInit(e);
|
||||
|
||||
pane_options.Text = ui.Text("packager", "packageOptions");
|
||||
lt_noUpdate.Text = ui.Text("packager", "packageNoUpgrades");
|
||||
bt_update.Text = ui.Text("packager", "packageUpgradeHeader");
|
||||
pp_upgradeInstruction.Text = ui.Text("packager", "packageUpgradeInstructions");
|
||||
bt_gotoUpgrade.Text = ui.Text("packager", "packageUpgradeDownload");
|
||||
Panel1.Text = ui.Text("treeHeaders", "installedPackages");
|
||||
pane_meta.Text = ui.Text("packager", "packageMetaData");
|
||||
pp_name.Text = ui.Text("packager", "packageName");
|
||||
pp_version.Text = ui.Text("packager", "packageVersion");
|
||||
pp_author.Text = ui.Text("packager", "packageAuthor");
|
||||
pp_repository.Text = ui.Text("packager", "packageRepository");
|
||||
pp_documentation.Text = ui.Text("packager", "packageDocumentation");
|
||||
pp_readme.Text = ui.Text("packager", "packageReadme");
|
||||
hl_docLink.Text = ui.Text("packager", "packageDocumentation");
|
||||
lb_demoLink.Text = ui.Text("packager", "packageDemonstration");
|
||||
|
||||
pane_noItems.Text = ui.Text("packager", "packageNoItemsHeader");
|
||||
pane_options.Text = ui.Text("packager", "packageOptions");
|
||||
lt_noUpdate.Text = ui.Text("packager", "packageNoUpgrades");
|
||||
bt_update.Text = ui.Text("packager", "packageUpgradeHeader");
|
||||
pp_upgradeInstruction.Text = ui.Text("packager", "packageUpgradeInstructions");
|
||||
bt_gotoUpgrade.Text = ui.Text("packager", "packageUpgradeDownload");
|
||||
|
||||
pane_uninstall.Text = ui.Text("packager", "packageUninstallHeader");
|
||||
bt_uninstall.Text = ui.Text("packager", "packageUninstallHeader");
|
||||
bt_deletePackage.Text = ui.Text("packager", "packageUninstallHeader");
|
||||
bt_confirmUninstall.Text = ui.Text("packager", "packageUninstallConfirm");
|
||||
pane_noItems.Text = ui.Text("packager", "packageNoItemsHeader");
|
||||
|
||||
pane_uninstalled.Text = ui.Text("packager", "packageUninstalledHeader");
|
||||
pane_uninstall.Text = ui.Text("packager", "packageUninstallHeader");
|
||||
bt_uninstall.Text = ui.Text("packager", "packageUninstallHeader");
|
||||
bt_deletePackage.Text = ui.Text("packager", "packageUninstallHeader");
|
||||
bt_confirmUninstall.Text = ui.Text("packager", "packageUninstallConfirm");
|
||||
|
||||
pane_uninstalled.Text = ui.Text("packager", "packageUninstalledHeader");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ using System.Xml.XPath;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Web;
|
||||
using umbraco.BasePages;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
using Umbraco.Core;
|
||||
using BizLogicAction = umbraco.BusinessLogic.Actions.Action;
|
||||
@@ -23,14 +24,19 @@ namespace umbraco.presentation.developer.packages
|
||||
/// <summary>
|
||||
/// Summary description for packager.
|
||||
/// </summary>
|
||||
public partial class Installer : BasePages.UmbracoEnsuredPage
|
||||
public partial class Installer : UmbracoEnsuredPage
|
||||
{
|
||||
public Installer()
|
||||
{
|
||||
CurrentApp = DefaultApps.developer.ToString();
|
||||
}
|
||||
|
||||
private Control _configControl;
|
||||
private cms.businesslogic.packager.repositories.Repository _repo;
|
||||
private readonly cms.businesslogic.packager.Installer _installer = new cms.businesslogic.packager.Installer();
|
||||
private string _tempFileName = "";
|
||||
|
||||
protected void Page_Load(object sender, System.EventArgs e)
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
var ex = new Exception();
|
||||
if (!cms.businesslogic.packager.Settings.HasFileAccess(ref ex))
|
||||
@@ -312,19 +318,6 @@ namespace umbraco.presentation.developer.packages
|
||||
Response.Redirect("installer.aspx?installing=businesslogic&dir=" + tempFile.Value + "&pId=" + pId.ToString());
|
||||
}
|
||||
|
||||
|
||||
private void DrawConfig()
|
||||
{
|
||||
HideAllPanes();
|
||||
|
||||
_configControl = new System.Web.UI.UserControl().LoadControl(SystemDirectories.Root + helper.Request("config"));
|
||||
_configControl.ID = "packagerConfigControl";
|
||||
|
||||
pane_optional.Controls.Add(_configControl);
|
||||
pane_optional.Visible = true;
|
||||
}
|
||||
|
||||
|
||||
private void HideAllPanes()
|
||||
{
|
||||
pane_authenticate.Visible = false;
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using umbraco.BasePages;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.businesslogic.relation;
|
||||
using umbraco.DataLayer;
|
||||
using umbraco.uicontrols;
|
||||
@@ -14,26 +15,31 @@ namespace umbraco.cms.presentation.developer.RelationTypes
|
||||
/// </summary>
|
||||
public partial class EditRelationType : UmbracoEnsuredPage
|
||||
{
|
||||
public EditRelationType()
|
||||
{
|
||||
CurrentApp = DefaultApps.developer.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class scope reference to the current RelationType being edited
|
||||
/// </summary>
|
||||
private RelationType relationType = null;
|
||||
private RelationType _relationType = null;
|
||||
|
||||
/// <summary>
|
||||
/// Class scope reference to the relations associated with the current RelationType
|
||||
/// </summary>
|
||||
private List<ReadOnlyRelation> relations = null;
|
||||
private List<ReadOnlyRelation> _relations = null;
|
||||
|
||||
/// <summary>
|
||||
/// Umbraco ObjectType used to represent all parent items in this relation type
|
||||
/// </summary>
|
||||
///
|
||||
private uQuery.UmbracoObjectType parentObjectType = uQuery.UmbracoObjectType.Unknown;
|
||||
private uQuery.UmbracoObjectType _parentObjectType = uQuery.UmbracoObjectType.Unknown;
|
||||
|
||||
/// <summary>
|
||||
/// Umbraco ObjectType used to represent all child items in this relation type
|
||||
/// </summary>
|
||||
private uQuery.UmbracoObjectType childObjectType = uQuery.UmbracoObjectType.Unknown;
|
||||
private uQuery.UmbracoObjectType _childObjectType = uQuery.UmbracoObjectType.Unknown;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the parent object type for all relations in this relation type
|
||||
@@ -42,7 +48,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.parentObjectType.GetName(); //UmbracoHelper.GetName(this.parentObjectType);
|
||||
return this._parentObjectType.GetName(); //UmbracoHelper.GetName(this.parentObjectType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +59,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.childObjectType.GetName(); //UmbracoHelper.GetName(this.childObjectType);
|
||||
return this._childObjectType.GetName(); //UmbracoHelper.GetName(this.childObjectType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +70,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.relationType.Dual == true ? "bidirectional" : "parentToChild";
|
||||
return this._relationType.Dual == true ? "bidirectional" : "parentToChild";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,13 +81,11 @@ namespace umbraco.cms.presentation.developer.RelationTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.relations == null)
|
||||
if (this._relations == null)
|
||||
{
|
||||
this.relations = new List<ReadOnlyRelation>();
|
||||
this._relations = new List<ReadOnlyRelation>();
|
||||
|
||||
ReadOnlyRelation readOnlyRelation;
|
||||
|
||||
using (IRecordsReader reader = uQuery.SqlHelper.ExecuteReader(@"
|
||||
using (var reader = uQuery.SqlHelper.ExecuteReader(@"
|
||||
SELECT A.id,
|
||||
A.parentId,
|
||||
B.[text] AS parentText,
|
||||
@@ -93,11 +97,11 @@ namespace umbraco.cms.presentation.developer.RelationTypes
|
||||
FROM umbracoRelation A
|
||||
LEFT OUTER JOIN umbracoNode B ON A.parentId = B.id
|
||||
LEFT OUTER JOIN umbracoNode C ON A.childId = C.id
|
||||
WHERE A.relType = " + this.relationType.Id.ToString()))
|
||||
WHERE A.relType = " + this._relationType.Id.ToString()))
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
readOnlyRelation = new ReadOnlyRelation();
|
||||
var readOnlyRelation = new ReadOnlyRelation();
|
||||
|
||||
readOnlyRelation.Id = reader.GetInt("id");
|
||||
readOnlyRelation.ParentId = reader.GetInt("parentId");
|
||||
@@ -108,12 +112,12 @@ namespace umbraco.cms.presentation.developer.RelationTypes
|
||||
readOnlyRelation.DateTime = reader.GetDateTime("datetime");
|
||||
readOnlyRelation.Comment = reader.GetString("comment");
|
||||
|
||||
this.relations.Add(readOnlyRelation);
|
||||
this._relations.Add(readOnlyRelation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this.relations;
|
||||
return this._relations;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,16 +131,16 @@ namespace umbraco.cms.presentation.developer.RelationTypes
|
||||
int id;
|
||||
if (int.TryParse(Request.QueryString["id"], out id))
|
||||
{
|
||||
this.relationType = new RelationType(id);
|
||||
if (this.relationType != null)
|
||||
this._relationType = new RelationType(id);
|
||||
if (this._relationType != null)
|
||||
{
|
||||
// API doens't allow us to pull the object Type, so sql needed
|
||||
// this.parentObjectType = UmbracoHelper.GetUmbracoObjectType(uQuery.SqlHelper.ExecuteScalar<Guid>("SELECT parentObjectType FROM umbracoRelationType WHERE id = " + this.relationType.Id.ToString()));
|
||||
// this.childObjectType = UmbracoHelper.GetUmbracoObjectType(uQuery.SqlHelper.ExecuteScalar<Guid>("SELECT childObjectType FROM umbracoRelationType WHERE id = " + this.relationType.Id.ToString()));
|
||||
|
||||
// uQuery has the above in a helper method, so no sql needed now
|
||||
this.parentObjectType = this.relationType.GetParentUmbracoObjectType();
|
||||
this.childObjectType = this.relationType.GetChildUmbracoObjectType();
|
||||
this._parentObjectType = this._relationType.GetParentUmbracoObjectType();
|
||||
this._childObjectType = this._relationType.GetChildUmbracoObjectType();
|
||||
|
||||
// -----------
|
||||
|
||||
@@ -144,11 +148,11 @@ namespace umbraco.cms.presentation.developer.RelationTypes
|
||||
{
|
||||
this.EnsureChildControls();
|
||||
|
||||
this.idLiteral.Text = this.relationType.Id.ToString();
|
||||
this.nameTextBox.Text = this.relationType.Name;
|
||||
this.aliasTextBox.Text = this.relationType.Alias;
|
||||
this.idLiteral.Text = this._relationType.Id.ToString();
|
||||
this.nameTextBox.Text = this._relationType.Name;
|
||||
this.aliasTextBox.Text = this._relationType.Alias;
|
||||
|
||||
if (this.relationType.Dual)
|
||||
if (this._relationType.Dual)
|
||||
{
|
||||
this.dualRadioButtonList.Items.FindByValue("1").Selected = true;
|
||||
}
|
||||
@@ -157,8 +161,8 @@ namespace umbraco.cms.presentation.developer.RelationTypes
|
||||
this.dualRadioButtonList.Items.FindByValue("0").Selected = true;
|
||||
}
|
||||
|
||||
this.parentLiteral.Text = this.parentObjectType.GetFriendlyName(); // UmbracoHelper.GetFriendlyName(this.parentObjectType);
|
||||
this.childLiteral.Text = this.childObjectType.GetFriendlyName(); // UmbracoHelper.GetFriendlyName(this.childObjectType);
|
||||
this.parentLiteral.Text = this._parentObjectType.GetFriendlyName(); // UmbracoHelper.GetFriendlyName(this.parentObjectType);
|
||||
this.childLiteral.Text = this._childObjectType.GetFriendlyName(); // UmbracoHelper.GetFriendlyName(this.childObjectType);
|
||||
|
||||
this.relationsCountLiteral.Text = this.Relations.Count.ToString();
|
||||
|
||||
@@ -184,26 +188,26 @@ namespace umbraco.cms.presentation.developer.RelationTypes
|
||||
{
|
||||
base.CreateChildControls();
|
||||
|
||||
TabPage relationTypeTabPage = this.tabControl.NewTabPage("Relation Type");
|
||||
var relationTypeTabPage = this.tabControl.NewTabPage("Relation Type");
|
||||
relationTypeTabPage.Controls.Add(this.idPane);
|
||||
relationTypeTabPage.Controls.Add(this.nameAliasPane);
|
||||
relationTypeTabPage.Controls.Add(this.directionPane);
|
||||
relationTypeTabPage.Controls.Add(this.objectTypePane);
|
||||
|
||||
MenuImageButton saveMenuImageButton = relationTypeTabPage.Menu.NewImageButton();
|
||||
var saveMenuImageButton = relationTypeTabPage.Menu.NewImageButton();
|
||||
saveMenuImageButton.AlternateText = "save relation type";
|
||||
saveMenuImageButton.Click += new ImageClickEventHandler(this.SaveMenuImageButton_Click);
|
||||
saveMenuImageButton.Click += this.SaveMenuImageButton_Click;
|
||||
saveMenuImageButton.ImageURL = "/umbraco/images/editor/save.gif";
|
||||
saveMenuImageButton.CausesValidation = true;
|
||||
saveMenuImageButton.ValidationGroup = "RelationType";
|
||||
|
||||
TabPage relationsTabPage = this.tabControl.NewTabPage("Relations");
|
||||
var relationsTabPage = this.tabControl.NewTabPage("Relations");
|
||||
relationsTabPage.Controls.Add(this.relationsCountPane);
|
||||
relationsTabPage.Controls.Add(this.relationsPane);
|
||||
|
||||
MenuImageButton refreshMenuImageButton = relationsTabPage.Menu.NewImageButton();
|
||||
var refreshMenuImageButton = relationsTabPage.Menu.NewImageButton();
|
||||
refreshMenuImageButton.AlternateText = "refresh relations";
|
||||
refreshMenuImageButton.Click += new ImageClickEventHandler(this.RefreshMenuImageButton_Click);
|
||||
refreshMenuImageButton.Click += this.RefreshMenuImageButton_Click;
|
||||
refreshMenuImageButton.ImageUrl = "/umbraco/developer/RelationTypes/Images/Refresh.gif";
|
||||
refreshMenuImageButton.CausesValidation = false;
|
||||
}
|
||||
@@ -216,7 +220,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes
|
||||
protected void AliasCustomValidator_ServerValidate(object source, ServerValidateEventArgs args)
|
||||
{
|
||||
args.IsValid = (RelationType.GetByAlias(this.aliasTextBox.Text.Trim()) == null) ||
|
||||
(this.aliasTextBox.Text.Trim() == this.relationType.Alias);
|
||||
(this.aliasTextBox.Text.Trim() == this._relationType.Alias);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -237,9 +241,9 @@ namespace umbraco.cms.presentation.developer.RelationTypes
|
||||
{
|
||||
if (this.Page.IsValid)
|
||||
{
|
||||
bool nameChanged = this.relationType.Name != this.nameTextBox.Text.Trim();
|
||||
bool aliasChanged = this.relationType.Alias != this.aliasTextBox.Text.Trim();
|
||||
bool directionChanged = this.relationType.Dual != (this.dualRadioButtonList.SelectedValue == "1");
|
||||
var nameChanged = this._relationType.Name != this.nameTextBox.Text.Trim();
|
||||
var aliasChanged = this._relationType.Alias != this.aliasTextBox.Text.Trim();
|
||||
var directionChanged = this._relationType.Dual != (this.dualRadioButtonList.SelectedValue == "1");
|
||||
|
||||
if (nameChanged || aliasChanged || directionChanged)
|
||||
{
|
||||
@@ -249,28 +253,28 @@ namespace umbraco.cms.presentation.developer.RelationTypes
|
||||
{
|
||||
bubbleBody += "Name, ";
|
||||
|
||||
this.relationType.Name = this.nameTextBox.Text.Trim();
|
||||
this._relationType.Name = this.nameTextBox.Text.Trim();
|
||||
|
||||
// Refresh tree, as the name as changed
|
||||
BasePage.Current.ClientTools.SyncTree(this.relationType.Id.ToString(), true);
|
||||
ClientTools.SyncTree(this._relationType.Id.ToString(), true);
|
||||
}
|
||||
|
||||
if (directionChanged)
|
||||
{
|
||||
bubbleBody += "Direction, ";
|
||||
this.relationType.Dual = this.dualRadioButtonList.SelectedValue == "1";
|
||||
this._relationType.Dual = this.dualRadioButtonList.SelectedValue == "1";
|
||||
}
|
||||
|
||||
if (aliasChanged)
|
||||
{
|
||||
bubbleBody += "Alias, ";
|
||||
this.relationType.Alias = this.aliasTextBox.Text.Trim();
|
||||
this._relationType.Alias = this.aliasTextBox.Text.Trim();
|
||||
}
|
||||
|
||||
bubbleBody = bubbleBody.Remove(bubbleBody.LastIndexOf(','), 1);
|
||||
bubbleBody = bubbleBody + "Changed";
|
||||
|
||||
BasePage.Current.ClientTools.ShowSpeechBubble(speechBubbleIcon.save, "Relation Type Updated", bubbleBody);
|
||||
ClientTools.ShowSpeechBubble(speechBubbleIcon.save, "Relation Type Updated", bubbleBody);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Web.UI.WebControls;
|
||||
using umbraco.BasePages;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.businesslogic.relation;
|
||||
|
||||
namespace umbraco.cms.presentation.developer.RelationTypes
|
||||
@@ -10,6 +11,11 @@ namespace umbraco.cms.presentation.developer.RelationTypes
|
||||
/// </summary>
|
||||
public partial class NewRelationType : UmbracoEnsuredPage
|
||||
{
|
||||
public NewRelationType()
|
||||
{
|
||||
CurrentApp = DefaultApps.developer.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On Load event
|
||||
/// </summary>
|
||||
@@ -44,9 +50,9 @@ namespace umbraco.cms.presentation.developer.RelationTypes
|
||||
/// <param name="e">expects EventArgs for addButton</param>
|
||||
protected void AddButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.Page.IsValid)
|
||||
if (Page.IsValid)
|
||||
{
|
||||
string newRelationTypeAlias = this.aliasTextBox.Text.Trim();
|
||||
var newRelationTypeAlias = this.aliasTextBox.Text.Trim();
|
||||
|
||||
uQuery.SqlHelper.ExecuteNonQuery(
|
||||
string.Format("INSERT INTO umbracoRelationType ([dual], parentObjectType, childObjectType, name, alias) VALUES ({0}, '{1}', '{2}', '{3}', '{4}')",
|
||||
@@ -56,11 +62,11 @@ namespace umbraco.cms.presentation.developer.RelationTypes
|
||||
this.descriptionTextBox.Text,
|
||||
newRelationTypeAlias));
|
||||
|
||||
int newRelationTypeId = uQuery.SqlHelper.ExecuteScalar<int>("SELECT id FROM umbracoRelationType WHERE alias = '" + newRelationTypeAlias + "'");
|
||||
var newRelationTypeId = uQuery.SqlHelper.ExecuteScalar<int>("SELECT id FROM umbracoRelationType WHERE alias = '" + newRelationTypeAlias + "'");
|
||||
|
||||
// base.speechBubble(BasePage.speechBubbleIcon.success, "New Relation Type", "relation type created");
|
||||
|
||||
BasePage.Current.ClientTools.ChangeContentFrameUrl("/umbraco/developer/RelationTypes/EditRelationType.aspx?id=" + newRelationTypeId.ToString()).CloseModalWindow().ChildNodeCreated();
|
||||
ClientTools.ChangeContentFrameUrl("/umbraco/developer/RelationTypes/EditRelationType.aspx?id=" + newRelationTypeId.ToString()).CloseModalWindow().ChildNodeCreated();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Linq;
|
||||
using umbraco.BusinessLogic;
|
||||
|
||||
namespace umbraco.developer
|
||||
{
|
||||
@@ -17,56 +18,40 @@ namespace umbraco.developer
|
||||
/// </summary>
|
||||
public partial class autoDoc : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
|
||||
protected void Page_Load(object sender, System.EventArgs e)
|
||||
public autoDoc()
|
||||
{
|
||||
CurrentApp = DefaultApps.developer.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
// Put user code to initialize the page here
|
||||
foreach(cms.businesslogic.web.DocumentType dt in cms.businesslogic.web.DocumentType.GetAllAsList())
|
||||
foreach(var dt in cms.businesslogic.web.DocumentType.GetAllAsList())
|
||||
{
|
||||
LabelDoc.Text +=
|
||||
"<div class=\"propertyType\"><p class=\"documentType\">" + dt.Text + "</p><p class=\"type\">Id: " + dt.Id.ToString() + ", Alias: " + dt.Alias + ")</p>";
|
||||
if (dt.PropertyTypes.Count > 0)
|
||||
LabelDoc.Text += "<p class=\"docHeader\">Property Types:</p>";
|
||||
foreach (cms.businesslogic.propertytype.PropertyType pt in dt.PropertyTypes)
|
||||
foreach (var pt in dt.PropertyTypes)
|
||||
LabelDoc.Text +=
|
||||
"<p class=\"type\">" + pt.Id.ToString() + ", " + pt.Alias + ", " + pt.Name + "</p>";
|
||||
if (dt.getVirtualTabs.Length > 0)
|
||||
LabelDoc.Text += "<p class=\"docHeader\">Tabs:</p>";
|
||||
foreach (cms.businesslogic.ContentType.TabI t in dt.getVirtualTabs.ToList())
|
||||
foreach (var t in dt.getVirtualTabs.ToList())
|
||||
LabelDoc.Text +=
|
||||
"<p class=\"type\">" + t.Id.ToString() + ", " + t.Caption + "</p>";
|
||||
if (dt.AllowedChildContentTypeIDs.Length > 0)
|
||||
LabelDoc.Text += "<p class=\"docHeader\">Allowed children:</p>";
|
||||
foreach (int child in dt.AllowedChildContentTypeIDs.ToList())
|
||||
foreach (var child in dt.AllowedChildContentTypeIDs.ToList())
|
||||
{
|
||||
cms.businesslogic.ContentType _child = new cms.businesslogic.ContentType(child);
|
||||
var contentType = new cms.businesslogic.ContentType(child);
|
||||
LabelDoc.Text +=
|
||||
"<p class=\"type\">" + _child.Id.ToString() + ", " + _child.Text + "</p>";
|
||||
"<p class=\"type\">" + contentType.Id.ToString() + ", " + contentType.Text + "</p>";
|
||||
}
|
||||
|
||||
LabelDoc.Text += "</div>";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#region Web Form Designer generated code
|
||||
override protected void OnInit(EventArgs e)
|
||||
{
|
||||
//
|
||||
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
|
||||
//
|
||||
InitializeComponent();
|
||||
base.OnInit(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Web.UI.WebControls;
|
||||
using umbraco.BasePages;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.businesslogic.language;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
|
||||
@@ -11,47 +12,51 @@ namespace umbraco.dialogs
|
||||
/// </summary>
|
||||
public partial class AssignDomain : UmbracoEnsuredPage
|
||||
{
|
||||
private int currentID;
|
||||
private int editDomain;
|
||||
private int _currentId;
|
||||
private int _editDomain;
|
||||
|
||||
public AssignDomain()
|
||||
{
|
||||
CurrentApp = DefaultApps.content.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
currentID = int.Parse(helper.Request("id"));
|
||||
prop_domain.Text = umbraco.ui.Text("assignDomain", "domain", this.getUser());
|
||||
prop_lang.Text = umbraco.ui.Text("general", "language", this.getUser());
|
||||
pane_addnew.Text = umbraco.ui.Text("assignDomain", "addNew", this.getUser());
|
||||
pane_edit.Text = umbraco.ui.Text("assignDomain", "orEdit", this.getUser());
|
||||
_currentId = int.Parse(helper.Request("id"));
|
||||
prop_domain.Text = ui.Text("assignDomain", "domain", this.getUser());
|
||||
prop_lang.Text = ui.Text("general", "language", this.getUser());
|
||||
pane_addnew.Text = ui.Text("assignDomain", "addNew", this.getUser());
|
||||
pane_edit.Text = ui.Text("assignDomain", "orEdit", this.getUser());
|
||||
|
||||
// Put user code to initialize the page here
|
||||
if (helper.Request("editDomain").Trim() != "")
|
||||
{
|
||||
editDomain = int.Parse(helper.Request("editDomain"));
|
||||
_editDomain = int.Parse(helper.Request("editDomain"));
|
||||
}
|
||||
|
||||
if (helper.Request("delDomain").Trim() != "")
|
||||
{
|
||||
Domain d = new Domain(int.Parse(helper.Request("delDomain")));
|
||||
FeedBackMessage.type = umbraco.uicontrols.Feedback.feedbacktype.success;
|
||||
FeedBackMessage.Text = ui.Text("assignDomain", "domainDeleted", d.Name, base.getUser());
|
||||
var d = new Domain(int.Parse(helper.Request("delDomain")));
|
||||
FeedBackMessage.type = uicontrols.Feedback.feedbacktype.success;
|
||||
FeedBackMessage.Text = ui.Text("assignDomain", "domainDeleted", d.Name, getUser());
|
||||
d.Delete();
|
||||
updateDomainList();
|
||||
UpdateDomainList();
|
||||
}
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
// Add caption to button
|
||||
ok.Text = ui.Text("assignDomain", "addNew", base.getUser());
|
||||
ok.Text = ui.Text("assignDomain", "addNew", getUser());
|
||||
|
||||
|
||||
int selectedLanguage = -1;
|
||||
var selectedLanguage = -1;
|
||||
|
||||
// Maybe add editing info - not the best way this is made ;-)
|
||||
if (editDomain > 0)
|
||||
if (_editDomain > 0)
|
||||
{
|
||||
Domain d = new Domain(editDomain);
|
||||
var d = new Domain(_editDomain);
|
||||
selectedLanguage = d.Language.id;
|
||||
DomainName.Text = d.Name.StartsWith("*") ? "*" : d.Name;
|
||||
ok.Text = ui.Text("general", "update", base.getUser());
|
||||
ok.Text = ui.Text("general", "update", getUser());
|
||||
}
|
||||
|
||||
// Add caption to language validator
|
||||
@@ -63,9 +68,9 @@ namespace umbraco.dialogs
|
||||
DomainValidator2.ValidationExpression = @"^(\*|((?i:http[s]?://)?([-\w]+(\.[-\w]+)*)(:\d+)?(/[-\w]*)?))$";
|
||||
|
||||
Languages.Items.Add(new ListItem(ui.Text("general", "choose", base.getUser()), ""));
|
||||
foreach (Language l in Language.getAll)
|
||||
foreach (var l in Language.getAll)
|
||||
{
|
||||
ListItem li = new ListItem();
|
||||
var li = new ListItem();
|
||||
li.Text = l.FriendlyName;
|
||||
li.Value = l.id.ToString();
|
||||
if (selectedLanguage == l.id)
|
||||
@@ -74,102 +79,84 @@ namespace umbraco.dialogs
|
||||
}
|
||||
}
|
||||
|
||||
updateDomainList();
|
||||
UpdateDomainList();
|
||||
}
|
||||
|
||||
private void updateDomainList()
|
||||
private void UpdateDomainList()
|
||||
{
|
||||
|
||||
Domain[] domainList = Domain.GetDomainsById(currentID);
|
||||
var domainList = Domain.GetDomainsById(_currentId);
|
||||
|
||||
if (domainList.Length > 0) {
|
||||
if (domainList.Length > 0)
|
||||
{
|
||||
allDomains.Text = "<table border=\"0\" cellspacing=\"10\">";
|
||||
|
||||
foreach (Domain d in domainList) {
|
||||
var name = d.Name.StartsWith("*") ? "*" : d.Name;
|
||||
allDomains.Text += "<tr><td>" + name + "</td><td>(" + d.Language.CultureAlias + ")</td><td><a href=\"?id=" + currentID + "&editDomain=" +
|
||||
d.Id.ToString() + "\">" + ui.Text("edit") + "</a></td><td><a href=\"?id=" + currentID +
|
||||
foreach (var d in domainList)
|
||||
{
|
||||
var name = d.Name.StartsWith("*") ? "*" : d.Name;
|
||||
allDomains.Text += "<tr><td>" + name + "</td><td>(" + d.Language.CultureAlias + ")</td><td><a href=\"?id=" + _currentId + "&editDomain=" +
|
||||
d.Id.ToString() + "\">" + ui.Text("edit") + "</a></td><td><a href=\"?id=" + _currentId +
|
||||
"&delDomain=" + d.Id.ToString() + "\" onClick=\"return confirm('" +
|
||||
ui.Text("defaultdialogs", "confirmdelete", base.getUser()) +
|
||||
"');\" style=\"color: red\">" + ui.Text("delete") + "</a></td></tr>";
|
||||
}
|
||||
|
||||
allDomains.Text += "</table>";
|
||||
pane_edit.Visible = true;
|
||||
} else {
|
||||
pane_edit.Visible = false;
|
||||
pane_edit.Visible = true;
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
pane_edit.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void SaveDomain(object sender, EventArgs e)
|
||||
{
|
||||
if (Page.IsValid)
|
||||
{
|
||||
if (editDomain > 0)
|
||||
if (_editDomain > 0)
|
||||
{
|
||||
Domain d = new Domain(editDomain);
|
||||
var d = new Domain(_editDomain);
|
||||
d.Language = new Language(int.Parse(Languages.SelectedValue));
|
||||
d.Name = DomainName.Text.ToLower();
|
||||
FeedBackMessage.type = umbraco.uicontrols.Feedback.feedbacktype.success;
|
||||
FeedBackMessage.Text = ui.Text("assignDomain", "domainUpdated", DomainName.Text, base.getUser());
|
||||
FeedBackMessage.type = uicontrols.Feedback.feedbacktype.success;
|
||||
FeedBackMessage.Text = ui.Text("assignDomain", "domainUpdated", DomainName.Text, getUser());
|
||||
d.Save();
|
||||
|
||||
DomainName.Text = "";
|
||||
Languages.SelectedIndex = 0;
|
||||
updateDomainList();
|
||||
UpdateDomainList();
|
||||
|
||||
//this is probably the worst webform I've ever seen...
|
||||
Response.Redirect("AssignDomain.aspx?id=" + currentID.ToString());
|
||||
Response.Redirect("AssignDomain.aspx?id=" + _currentId.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
// have to handle wildcard
|
||||
var domainName = DomainName.Text.Trim();
|
||||
domainName = domainName == "*" ? ("*" + currentID.ToString()) : domainName;
|
||||
domainName = domainName == "*" ? ("*" + _currentId.ToString()) : domainName;
|
||||
|
||||
if (!Domain.Exists(domainName.ToLower()))
|
||||
{
|
||||
Domain.MakeNew(domainName, currentID, int.Parse(Languages.SelectedValue));
|
||||
FeedBackMessage.Text = ui.Text("assignDomain", "domainCreated", domainName, base.getUser());
|
||||
FeedBackMessage.type = umbraco.uicontrols.Feedback.feedbacktype.success;
|
||||
if (!Domain.Exists(domainName.ToLower()))
|
||||
{
|
||||
Domain.MakeNew(domainName, _currentId, int.Parse(Languages.SelectedValue));
|
||||
FeedBackMessage.Text = ui.Text("assignDomain", "domainCreated", domainName, getUser());
|
||||
FeedBackMessage.type = uicontrols.Feedback.feedbacktype.success;
|
||||
|
||||
DomainName.Text = "";
|
||||
Languages.SelectedIndex = 0;
|
||||
updateDomainList();
|
||||
UpdateDomainList();
|
||||
|
||||
//this is probably the worst webform I've ever seen...
|
||||
Response.Redirect("AssignDomain.aspx?id=" + currentID.ToString());
|
||||
} else {
|
||||
FeedBackMessage.Text = ui.Text("assignDomain", "domainExists", DomainName.Text.Trim(), base.getUser());
|
||||
FeedBackMessage.type = umbraco.uicontrols.Feedback.feedbacktype.error;
|
||||
Response.Redirect("AssignDomain.aspx?id=" + _currentId.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
FeedBackMessage.Text = ui.Text("assignDomain", "domainExists", DomainName.Text.Trim(), getUser());
|
||||
FeedBackMessage.type = uicontrols.Feedback.feedbacktype.error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Web Form Designer generated code
|
||||
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
//
|
||||
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
|
||||
//
|
||||
InitializeComponent();
|
||||
base.OnInit(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -18,10 +18,15 @@ namespace umbraco.presentation.dialogs
|
||||
{
|
||||
public partial class Preview : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
public Preview()
|
||||
{
|
||||
CurrentApp = DefaultApps.content.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
Document d = new Document(int.Parse(helper.Request("id")));
|
||||
PreviewContent pc = new PreviewContent(base.getUser(), Guid.NewGuid(), false);
|
||||
var d = new Document(int.Parse(helper.Request("id")));
|
||||
var pc = new PreviewContent(base.getUser(), Guid.NewGuid(), false);
|
||||
pc.PrepareDocument(base.getUser(), d, true);
|
||||
pc.SavePreviewSet();
|
||||
docLit.Text = d.Text;
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Web.SessionState;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.BusinessLogic.Actions;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
|
||||
@@ -19,18 +20,23 @@ namespace umbraco.dialogs
|
||||
/// </summary>
|
||||
public partial class SendPublish : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
protected void Page_Load(object sender, System.EventArgs e)
|
||||
public SendPublish()
|
||||
{
|
||||
CurrentApp = DefaultApps.content.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Request.QueryString["id"]))
|
||||
{
|
||||
int docID;
|
||||
if (int.TryParse(Request.QueryString["id"], out docID))
|
||||
int docId;
|
||||
if (int.TryParse(Request.QueryString["id"], out docId))
|
||||
{
|
||||
Document _document = new Document(docID);
|
||||
if (_document != null)
|
||||
BusinessLogic.Actions.Action.RunActionHandlers(_document, ActionToPublish.Instance);
|
||||
var document = new Document(docId);
|
||||
BusinessLogic.Actions.Action.RunActionHandlers(document, ActionToPublish.Instance);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.businesslogic.skinning;
|
||||
using umbraco.cms.businesslogic.template;
|
||||
using umbraco.cms.businesslogic;
|
||||
@@ -13,39 +14,40 @@ namespace umbraco.presentation.umbraco.dialogs
|
||||
{
|
||||
public partial class TemplateSkinning : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
private int templateID = 0;
|
||||
private int _templateId = 0;
|
||||
|
||||
private cms.businesslogic.packager.repositories.Repository repo;
|
||||
private string repoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66";
|
||||
private readonly cms.businesslogic.packager.repositories.Repository _repo;
|
||||
private const string RepoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66";
|
||||
|
||||
public TemplateSkinning()
|
||||
{
|
||||
repo = cms.businesslogic.packager.repositories.Repository.getByGuid(repoGuid);
|
||||
CurrentApp = DefaultApps.settings.ToString();
|
||||
_repo = cms.businesslogic.packager.repositories.Repository.getByGuid(RepoGuid);
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
templateID = int.Parse(Request["id"]);
|
||||
Template t = new Template(templateID);
|
||||
_templateId = int.Parse(Request["id"]);
|
||||
var t = new Template(_templateId);
|
||||
|
||||
if (Skinning.StarterKitGuid(templateID).HasValue)
|
||||
if (Skinning.StarterKitGuid(_templateId).HasValue)
|
||||
{
|
||||
p_apply.Visible = true;
|
||||
|
||||
string currentSkin = Skinning.GetCurrentSkinAlias(templateID);
|
||||
int templateRoot = FindTemplateRoot((CMSNode)t);
|
||||
var currentSkin = Skinning.GetCurrentSkinAlias(_templateId);
|
||||
var templateRoot = FindTemplateRoot(t);
|
||||
|
||||
dd_skins.Items.Add("Choose...");
|
||||
foreach (KeyValuePair<string,string> kvp in Skinning.AllowedSkins(templateRoot))
|
||||
foreach (var kvp in Skinning.AllowedSkins(templateRoot))
|
||||
{
|
||||
ListItem li = new ListItem(kvp.Value, kvp.Key);
|
||||
var li = new ListItem(kvp.Value, kvp.Key);
|
||||
if (kvp.Key == currentSkin)
|
||||
li.Selected = true;
|
||||
|
||||
dd_skins.Items.Add(li);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Skinning.GetCurrentSkinAlias(templateID)))
|
||||
if (!string.IsNullOrEmpty(Skinning.GetCurrentSkinAlias(_templateId)))
|
||||
{
|
||||
ph_rollback.Visible = true;
|
||||
}
|
||||
@@ -56,26 +58,25 @@ namespace umbraco.presentation.umbraco.dialogs
|
||||
{
|
||||
if (t.ParentId < 0)
|
||||
return t.Id;
|
||||
else
|
||||
return FindTemplateRoot(t.Parent);
|
||||
return FindTemplateRoot(t.Parent);
|
||||
}
|
||||
|
||||
protected void openRepo(object sender, EventArgs e) {
|
||||
|
||||
Guid? g = Skinning.StarterKitGuid(templateID);
|
||||
var g = Skinning.StarterKitGuid(_templateId);
|
||||
|
||||
|
||||
if (g == null || !Skinning.HasAvailableSkins(templateID))
|
||||
if (g == null || !Skinning.HasAvailableSkins(_templateId))
|
||||
{
|
||||
bt_repo.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (repo.HasConnection())
|
||||
if (_repo.HasConnection())
|
||||
{
|
||||
try
|
||||
{
|
||||
rep_starterKitDesigns.DataSource = repo.Webservice.Skins(g.ToString());
|
||||
rep_starterKitDesigns.DataSource = _repo.Webservice.Skins(g.ToString());
|
||||
rep_starterKitDesigns.DataBind();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -85,10 +86,6 @@ namespace umbraco.presentation.umbraco.dialogs
|
||||
//ShowConnectionError();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//ShowConnectionError();
|
||||
}
|
||||
}
|
||||
|
||||
p_apply.Visible = false;
|
||||
@@ -100,16 +97,16 @@ namespace umbraco.presentation.umbraco.dialogs
|
||||
{
|
||||
if (((Button)sender).CommandName == "apply")
|
||||
{
|
||||
Skin s = Skin.CreateFromName(((Button)sender).CommandArgument);
|
||||
var s = Skin.CreateFromName(((Button)sender).CommandArgument);
|
||||
Skinning.ActivateAsCurrentSkin(s);
|
||||
|
||||
Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())));
|
||||
}
|
||||
else if (((Button)sender).CommandName == "remove")
|
||||
{
|
||||
NodeFactory.Node n = NodeFactory.Node.GetCurrent();
|
||||
var n = NodeFactory.Node.GetCurrent();
|
||||
|
||||
Template t = new Template(n.template);
|
||||
var t = new Template(n.template);
|
||||
Skinning.RollbackSkin(t.Id);
|
||||
|
||||
Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())));
|
||||
@@ -117,37 +114,31 @@ namespace umbraco.presentation.umbraco.dialogs
|
||||
else
|
||||
{
|
||||
|
||||
Guid kitGuid = new Guid(((Button)sender).CommandArgument);
|
||||
var kitGuid = new Guid(((Button)sender).CommandArgument);
|
||||
|
||||
cms.businesslogic.packager.Installer installer = new cms.businesslogic.packager.Installer();
|
||||
|
||||
if (repo.HasConnection())
|
||||
if (_repo.HasConnection())
|
||||
{
|
||||
cms.businesslogic.packager.Installer p = new cms.businesslogic.packager.Installer();
|
||||
var p = new cms.businesslogic.packager.Installer();
|
||||
|
||||
string tempFile = p.Import(repo.fetch(kitGuid.ToString()));
|
||||
var tempFile = p.Import(_repo.fetch(kitGuid.ToString()));
|
||||
p.LoadConfig(tempFile);
|
||||
int pID = p.CreateManifest(tempFile, kitGuid.ToString(), repoGuid);
|
||||
var pId = p.CreateManifest(tempFile, kitGuid.ToString(), RepoGuid);
|
||||
|
||||
p.InstallFiles(pID, tempFile);
|
||||
p.InstallBusinessLogic(pID, tempFile);
|
||||
p.InstallCleanUp(pID, tempFile);
|
||||
p.InstallFiles(pId, tempFile);
|
||||
p.InstallBusinessLogic(pId, tempFile);
|
||||
p.InstallCleanUp(pId, tempFile);
|
||||
|
||||
//NOTE: This seems excessive to have to re-load all content from the database here!?
|
||||
library.RefreshContent();
|
||||
|
||||
if (cms.businesslogic.skinning.Skinning.GetAllSkins().Count > 0)
|
||||
if (Skinning.GetAllSkins().Count > 0)
|
||||
{
|
||||
cms.businesslogic.skinning.Skinning.ActivateAsCurrentSkin(cms.businesslogic.skinning.Skinning.GetAllSkins()[0]);
|
||||
Skinning.ActivateAsCurrentSkin(Skinning.GetAllSkins()[0]);
|
||||
}
|
||||
|
||||
|
||||
Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())));
|
||||
}
|
||||
else
|
||||
{
|
||||
//ShowConnectionError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,34 +146,34 @@ namespace umbraco.presentation.umbraco.dialogs
|
||||
|
||||
if (dd_skins.SelectedIndex > 0)
|
||||
{
|
||||
Skin s = Skin.CreateFromAlias(dd_skins.SelectedValue);
|
||||
var s = Skin.CreateFromAlias(dd_skins.SelectedValue);
|
||||
Skinning.ActivateAsCurrentSkin(s);
|
||||
}
|
||||
|
||||
}
|
||||
protected void rollback(object sender, EventArgs e) {
|
||||
|
||||
Skinning.RollbackSkin(templateID);
|
||||
Skinning.RollbackSkin(_templateId);
|
||||
}
|
||||
|
||||
protected void rep_starterKitDesigns_ItemDataBound(object sender, RepeaterItemEventArgs e)
|
||||
{
|
||||
if (e.Item.DataItem != null)
|
||||
{
|
||||
cms.businesslogic.packager.repositories.Skin s = (cms.businesslogic.packager.repositories.Skin)e.Item.DataItem;
|
||||
var s = (cms.businesslogic.packager.repositories.Skin)e.Item.DataItem;
|
||||
|
||||
if (Skinning.IsSkinInstalled(s.RepoGuid))
|
||||
{
|
||||
Button inst = (Button)e.Item.FindControl("Button1");
|
||||
var inst = (Button)e.Item.FindControl("Button1");
|
||||
inst.Text = "Apply (already downloaded)";
|
||||
inst.CommandName = "apply";
|
||||
inst.CommandArgument = s.Text;
|
||||
|
||||
}
|
||||
|
||||
if (Skin.CreateFromAlias(Skinning.GetCurrentSkinAlias(templateID)).Name == s.Text)
|
||||
if (Skin.CreateFromAlias(Skinning.GetCurrentSkinAlias(_templateId)).Name == s.Text)
|
||||
{
|
||||
Button inst = (Button)e.Item.FindControl("Button1");
|
||||
var inst = (Button)e.Item.FindControl("Button1");
|
||||
inst.Text = "Rollback (active skin)";
|
||||
inst.CommandName = "remove";
|
||||
inst.CommandArgument = s.Text;
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Web.UI.WebControls;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
using System.IO;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.IO;
|
||||
using Umbraco.Core;
|
||||
|
||||
@@ -18,8 +19,13 @@ namespace umbraco.dialogs
|
||||
[Obsolete("Use the ImageViewer user control instead")]
|
||||
public partial class imageViewer : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
|
||||
public imageViewer()
|
||||
{
|
||||
CurrentApp = DefaultApps.media.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, System.EventArgs e)
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
//Response.Write(umbraco.helper.Request("id"));
|
||||
//Response.End();
|
||||
@@ -29,53 +35,55 @@ namespace umbraco.dialogs
|
||||
if (Request.QueryString["id"] != "")
|
||||
{
|
||||
//TODO: fix Nasty FAST'N'CANELINE HACK. ..
|
||||
int MediaId = int.Parse(Request.QueryString["id"]);
|
||||
var mediaId = int.Parse(Request.QueryString["id"]);
|
||||
|
||||
image.Controls.Clear();
|
||||
int fileWidth = 0;
|
||||
int fileHeight = 0;
|
||||
string fileName = "/blank.gif";
|
||||
string altText = "";
|
||||
var fileWidth = 0;
|
||||
var fileHeight = 0;
|
||||
var fileName = "/blank.gif";
|
||||
var altText = "";
|
||||
|
||||
try
|
||||
{
|
||||
cms.businesslogic.media.Media m = new cms.businesslogic.media.Media(MediaId);
|
||||
try
|
||||
{
|
||||
var m = new cms.businesslogic.media.Media(mediaId);
|
||||
|
||||
// TODO: Remove "Magic strings" from code.
|
||||
try
|
||||
{
|
||||
fileName = m.getProperty("fileName").Value.ToString();
|
||||
}
|
||||
catch
|
||||
{
|
||||
try
|
||||
{
|
||||
// TODO: Remove "Magic strings" from code.
|
||||
try
|
||||
{
|
||||
fileName = m.getProperty("fileName").Value.ToString();
|
||||
}
|
||||
catch
|
||||
{
|
||||
try
|
||||
{
|
||||
fileName = m.getProperty(Constants.Conventions.Media.File).Value.ToString();
|
||||
}
|
||||
catch
|
||||
{
|
||||
fileName = m.getProperty("file").Value.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
fileName = m.getProperty("file").Value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
altText = m.Text;
|
||||
try
|
||||
{
|
||||
altText = m.Text;
|
||||
try
|
||||
{
|
||||
fileWidth = int.Parse(m.getProperty(Constants.Conventions.Media.Width).Value.ToString());
|
||||
fileHeight = int.Parse(m.getProperty(Constants.Conventions.Media.Height).Value.ToString());
|
||||
}
|
||||
catch {
|
||||
|
||||
}
|
||||
string fileNameOrg = fileName;
|
||||
string ext = fileNameOrg.Substring(fileNameOrg.LastIndexOf(".")+1, fileNameOrg.Length-fileNameOrg.LastIndexOf(".")-1);
|
||||
string fileNameThumb = SystemDirectories.Root + fileNameOrg.Replace("."+ext, "_thumb.jpg");
|
||||
image.Controls.Add(new LiteralControl("<a href=\"" + SystemDirectories.Root + fileNameOrg + "\" title=\"Zoom\"><img src=\"" + fileNameThumb + "\" border=\"0\"/></a>"));
|
||||
}
|
||||
catch {
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
image.Controls.Add(new LiteralControl("<script>\nparent.updateImageSource('" + SystemDirectories.Root + fileName.Replace("'", "\\'") + "','" + altText + "','" + fileWidth.ToString() + "','" + fileHeight.ToString() + "')\n</script>"));
|
||||
}
|
||||
var fileNameOrg = fileName;
|
||||
var ext = fileNameOrg.Substring(fileNameOrg.LastIndexOf(".") + 1, fileNameOrg.Length - fileNameOrg.LastIndexOf(".") - 1);
|
||||
var fileNameThumb = SystemDirectories.Root + fileNameOrg.Replace("." + ext, "_thumb.jpg");
|
||||
image.Controls.Add(new LiteralControl("<a href=\"" + SystemDirectories.Root + fileNameOrg + "\" title=\"Zoom\"><img src=\"" + fileNameThumb + "\" border=\"0\"/></a>"));
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
image.Controls.Add(new LiteralControl("<script>\nparent.updateImageSource('" + SystemDirectories.Root + fileName.Replace("'", "\\'") + "','" + altText + "','" + fileWidth.ToString() + "','" + fileHeight.ToString() + "')\n</script>"));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,10 @@ using System.Web.UI.WebControls;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
using System.Reflection;
|
||||
using Umbraco.Core.IO;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.DataLayer;
|
||||
using umbraco.IO;
|
||||
using umbraco.businesslogic.Exceptions;
|
||||
|
||||
namespace umbraco.dialogs
|
||||
{
|
||||
@@ -20,8 +22,18 @@ namespace umbraco.dialogs
|
||||
/// </summary>
|
||||
public partial class insertMacro : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
protected System.Web.UI.WebControls.Button Button1;
|
||||
protected void Page_Load(object sender, System.EventArgs e)
|
||||
protected Button Button1;
|
||||
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
base.OnInit(e);
|
||||
|
||||
//this could be used for media or content so we need to at least validate that the user has access to one or the other
|
||||
if (!ValidateUserApp(DefaultApps.content.ToString()) && !ValidateUserApp(DefaultApps.media.ToString()))
|
||||
throw new UserAuthorizationException("The current user doesn't have access to the section/app");
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
pane_edit.Text = ui.Text("general", "edit",this.getUser()) + " " + ui.Text("general", "macro",this.getUser());
|
||||
pane_insert.Text = ui.Text("general", "insert",this.getUser()) + " " + ui.Text("general", "macro",this.getUser());
|
||||
@@ -31,27 +43,24 @@ namespace umbraco.dialogs
|
||||
// Put user code to initialize the page here
|
||||
cms.businesslogic.macro.Macro m;
|
||||
if (helper.Request("macroID") != "")
|
||||
m = new umbraco.cms.businesslogic.macro.Macro(int.Parse(helper.Request("macroID")));
|
||||
m = new cms.businesslogic.macro.Macro(int.Parse(helper.Request("macroID")));
|
||||
else
|
||||
m = cms.businesslogic.macro.Macro.GetByAlias(helper.Request("macroAlias"));
|
||||
|
||||
String macroAssembly = "";
|
||||
String macroType = "";
|
||||
|
||||
foreach (cms.businesslogic.macro.MacroProperty mp in m.Properties) {
|
||||
foreach (var mp in m.Properties) {
|
||||
|
||||
macroAssembly = mp.Type.Assembly;
|
||||
macroType = mp.Type.Type;
|
||||
var macroAssembly = mp.Type.Assembly;
|
||||
var macroType = mp.Type.Type;
|
||||
try
|
||||
{
|
||||
|
||||
Assembly assembly = Assembly.LoadFrom( IOHelper.MapPath(SystemDirectories.Bin + "/" + macroAssembly + ".dll"));
|
||||
var assembly = Assembly.LoadFrom( IOHelper.MapPath(SystemDirectories.Bin + "/" + macroAssembly + ".dll"));
|
||||
|
||||
Type type = assembly.GetType(macroAssembly+"."+macroType);
|
||||
interfaces.IMacroGuiRendering typeInstance = Activator.CreateInstance(type) as interfaces.IMacroGuiRendering;
|
||||
var typeInstance = Activator.CreateInstance(type) as interfaces.IMacroGuiRendering;
|
||||
if (typeInstance != null)
|
||||
{
|
||||
Control control = Activator.CreateInstance(type) as Control;
|
||||
var control = Activator.CreateInstance(type) as Control;
|
||||
control.ID = mp.Alias;
|
||||
if (Request[mp.Alias] != null)
|
||||
{
|
||||
@@ -62,7 +71,7 @@ namespace umbraco.dialogs
|
||||
}
|
||||
|
||||
// register alias
|
||||
umbraco.uicontrols.PropertyPanel pp = new umbraco.uicontrols.PropertyPanel();
|
||||
var pp = new uicontrols.PropertyPanel();
|
||||
pp.Text = mp.Name;
|
||||
pp.Controls.Add(control);
|
||||
|
||||
@@ -103,29 +112,6 @@ namespace umbraco.dialogs
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#region Web Form Designer generated code
|
||||
override protected void OnInit(EventArgs e)
|
||||
{
|
||||
//
|
||||
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
|
||||
//
|
||||
InitializeComponent();
|
||||
base.OnInit(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,34 +4,44 @@ using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.businesslogic;
|
||||
|
||||
namespace umbraco.presentation.umbraco.dialogs {
|
||||
public partial class insertMasterpageContent : BasePages.UmbracoEnsuredPage {
|
||||
protected void Page_Load(object sender, EventArgs e) {
|
||||
namespace umbraco.presentation.umbraco.dialogs
|
||||
{
|
||||
public partial class insertMasterpageContent : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
public insertMasterpageContent()
|
||||
{
|
||||
CurrentApp = DefaultApps.settings.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
//Add a default Item
|
||||
ListItem li = new ListItem("Choose ID...");
|
||||
var li = new ListItem("Choose ID...");
|
||||
li.Selected = true;
|
||||
dd_detectedAlias.Items.Add(li);
|
||||
|
||||
cms.businesslogic.template.Template t = new cms.businesslogic.template.Template(int.Parse(Request["id"]) );
|
||||
|
||||
var t = new cms.businesslogic.template.Template(int.Parse(Request["id"]));
|
||||
|
||||
if (t.MasterTemplate > 0) {
|
||||
|
||||
if (t.MasterTemplate > 0)
|
||||
{
|
||||
t = new cms.businesslogic.template.Template(t.MasterTemplate);
|
||||
|
||||
|
||||
}
|
||||
|
||||
foreach(string cpId in t.contentPlaceholderIds()){
|
||||
|
||||
foreach (string cpId in t.contentPlaceholderIds())
|
||||
{
|
||||
dd_detectedAlias.Items.Add(cpId);
|
||||
}
|
||||
|
||||
|
||||
//string mp = System.IO.File.ReadAllText(masterPageFile);
|
||||
|
||||
|
||||
//string pat = "<asp:ContentPlaceHolder+(\\s+[a-zA-Z]+\\s*=\\s*(\"([^\"]*)\"|'([^']*)'))*\\s*/?>";
|
||||
|
||||
|
||||
/* Instantiate the regular expression object.
|
||||
Regex r = new Regex(pat, RegexOptions.IgnoreCase);
|
||||
|
||||
@@ -53,17 +63,15 @@ namespace umbraco.presentation.umbraco.dialogs {
|
||||
//just to be sure that they have something to select, we will add the default placeholder....
|
||||
|
||||
*
|
||||
*/
|
||||
|
||||
if(dd_detectedAlias.Items.Count == 1)
|
||||
*/
|
||||
|
||||
if (dd_detectedAlias.Items.Count == 1)
|
||||
dd_detectedAlias.Items.Add("ContentPlaceHolderDefault");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected override void OnPreInit(EventArgs e) {
|
||||
base.OnPreInit(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@ using System.Collections;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Xml;
|
||||
using Umbraco.Core.IO;
|
||||
using umbraco.BasePages;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco.presentation;
|
||||
using umbraco.cms.businesslogic.media;
|
||||
using Umbraco.Core.IO;
|
||||
using System.Linq;
|
||||
using umbraco.cms.businesslogic;
|
||||
using umbraco.cms.presentation.user;
|
||||
@@ -23,7 +23,14 @@ namespace umbraco.dialogs
|
||||
public partial class moveOrCopy : UmbracoEnsuredPage
|
||||
{
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
CurrentApp = Request["app"];
|
||||
|
||||
base.OnInit(e);
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
JTree.DataBind();
|
||||
|
||||
@@ -32,10 +39,9 @@ namespace umbraco.dialogs
|
||||
{
|
||||
pp_relate.Text = ui.Text("moveOrCopy", "relateToOriginal");
|
||||
|
||||
//Document Type copy Hack...
|
||||
var app = Request.GetItemAsString("app");
|
||||
//Document Type copy Hack...
|
||||
|
||||
if (app == Constants.Applications.Settings)
|
||||
if (CurrentApp == Constants.Applications.Settings)
|
||||
{
|
||||
pane_form.Visible = false;
|
||||
pane_form_notice.Visible = false;
|
||||
@@ -50,13 +56,15 @@ namespace umbraco.dialogs
|
||||
masterType.Attributes.Add("style", "width: 350px;");
|
||||
masterType.Items.Add(new ListItem(ui.Text("none") + "...", "0"));
|
||||
foreach (var docT in DocumentType.GetAllAsList())
|
||||
{
|
||||
masterType.Items.Add(new ListItem(docT.Text, docT.Id.ToString()));
|
||||
}
|
||||
|
||||
masterType.SelectedValue = documentType.MasterContentType.ToString();
|
||||
|
||||
//hack to close window if not a doctype...
|
||||
rename.Text = string.Format("{0} (copy)", documentType.Text);
|
||||
rename.Text = documentType.Text + " (copy)";
|
||||
pane_settings.Text = "Make a copy of the document type '" + documentType.Text + "' and save it under a new name";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -73,7 +81,7 @@ namespace umbraco.dialogs
|
||||
var cmsNode = new CMSNode(int.Parse(Request.GetItemAsString("id")));
|
||||
|
||||
var validAction = true;
|
||||
if (app == Constants.Applications.Content && cmsNode.HasChildren)
|
||||
if (CurrentApp == Constants.Applications.Content && cmsNode.HasChildren)
|
||||
validAction = ValidAction(Request.GetItemAsString("mode") == "cut" ? 'M' : 'O');
|
||||
|
||||
|
||||
@@ -105,7 +113,7 @@ namespace umbraco.dialogs
|
||||
}
|
||||
|
||||
private bool CheckPermissions(CMSNode node, IAction currentAction)
|
||||
{
|
||||
{
|
||||
var currUserPermissions = new UserPermissions(CurrentUser);
|
||||
var lstCurrUserActions = currUserPermissions.GetExistingNodePermission(node.Id);
|
||||
|
||||
@@ -120,6 +128,7 @@ namespace umbraco.dialogs
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//PPH Handle doctype copies..
|
||||
@@ -179,18 +188,17 @@ namespace umbraco.dialogs
|
||||
public void HandleMoveOrCopy(object sender, EventArgs e)
|
||||
{
|
||||
if (Request["app"] == Constants.Applications.Settings)
|
||||
HandleDocumentTypeCopy();
|
||||
else
|
||||
HandleDocumentTypeCopy();
|
||||
else
|
||||
HandleDocumentMoveOrCopy();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPreRender(EventArgs e)
|
||||
{
|
||||
base.OnPreRender(e);
|
||||
|
||||
ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/cmsnode.asmx"));
|
||||
ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/legacyAjaxCalls.asmx"));
|
||||
}
|
||||
base.OnPreRender(e);
|
||||
ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/cmsnode.asmx"));
|
||||
ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/legacyAjaxCalls.asmx"));
|
||||
}
|
||||
|
||||
private void HandleDocumentMoveOrCopy()
|
||||
{
|
||||
|
||||
@@ -1,19 +1,12 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Web;
|
||||
using System.Web.SessionState;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
using System.Threading;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco.cms.helpers;
|
||||
using umbraco.BusinessLogic;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.BasePages;
|
||||
|
||||
namespace umbraco.dialogs
|
||||
@@ -21,18 +14,24 @@ namespace umbraco.dialogs
|
||||
/// <summary>
|
||||
/// Summary description for publish.
|
||||
/// </summary>
|
||||
public partial class publish : BasePages.UmbracoEnsuredPage
|
||||
public partial class publish : UmbracoEnsuredPage
|
||||
{
|
||||
protected System.Web.UI.WebControls.Literal total;
|
||||
protected Literal total;
|
||||
|
||||
private int nodeId;
|
||||
private int nodesPublished = 0;
|
||||
private int _nodeId;
|
||||
private int _nodesPublished = 0;
|
||||
private readonly List<cms.businesslogic.web.Document> _documents = new List<cms.businesslogic.web.Document>();
|
||||
public static string pageName = "";
|
||||
|
||||
protected void Page_Load(object sender, System.EventArgs e)
|
||||
public publish()
|
||||
{
|
||||
CurrentApp = DefaultApps.content.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
nodeId = int.Parse(helper.Request("id"));
|
||||
cms.businesslogic.web.Document d = new cms.businesslogic.web.Document(nodeId);
|
||||
_nodeId = int.Parse(helper.Request("id"));
|
||||
var d = new cms.businesslogic.web.Document(_nodeId);
|
||||
pageName = d.Text;
|
||||
|
||||
if (d.Level > 1 && d.PathPublished == false)
|
||||
@@ -40,37 +39,37 @@ namespace umbraco.dialogs
|
||||
TheForm.Visible = false;
|
||||
theEnd.Visible = true;
|
||||
feedbackMsg.type = uicontrols.Feedback.feedbacktype.notice;
|
||||
feedbackMsg.Text = ui.Text("publish", "contentPublishedFailedByParent", d.Text, base.getUser()) + "</p><p><a href='#' onClick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
|
||||
feedbackMsg.Text = ui.Text("publish", "contentPublishedFailedByParent", d.Text, getUser()) + "</p><p><a href='#' onClick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// add control prefix to variable for support with masterpages
|
||||
string prefix = PublishUnpublishedItems.ClientID.Replace(PublishUnpublishedItems.ID, "");
|
||||
var prefix = PublishUnpublishedItems.ClientID.Replace(PublishUnpublishedItems.ID, "");
|
||||
masterPagePrefix.Text = prefix;
|
||||
|
||||
// by default we only count the published ones
|
||||
int TotalNodesToPublish = cms.businesslogic.web.Document.CountSubs(nodeId, true);
|
||||
var totalNodesToPublish = cms.businesslogic.web.Document.CountSubs(_nodeId, true);
|
||||
try
|
||||
{
|
||||
Application.Lock();
|
||||
// We add both all nodes and only published nodes to the application variables so we can ajax query depending on checkboxes
|
||||
Application["publishTotalAll" + nodeId.ToString()] = cms.businesslogic.CMSNode.CountSubs(nodeId).ToString();
|
||||
Application["publishTotal" + nodeId.ToString()] = TotalNodesToPublish.ToString();
|
||||
Application["publishDone" + nodeId.ToString()] = "0";
|
||||
Application["publishTotalAll" + _nodeId.ToString()] = cms.businesslogic.CMSNode.CountSubs(_nodeId).ToString();
|
||||
Application["publishTotal" + _nodeId.ToString()] = totalNodesToPublish.ToString();
|
||||
Application["publishDone" + _nodeId.ToString()] = "0";
|
||||
}
|
||||
finally
|
||||
{
|
||||
Application.UnLock();
|
||||
}
|
||||
total.Text = TotalNodesToPublish.ToString();
|
||||
total.Text = totalNodesToPublish.ToString();
|
||||
|
||||
// Put user code to initialize the page here
|
||||
if (!IsPostBack)
|
||||
{
|
||||
// Add caption to checkbox
|
||||
PublishAll.Text = ui.Text("publish", "publishAll", d.Text, base.getUser());
|
||||
ok.Text = ui.Text("content", "publish", base.getUser());
|
||||
PublishAll.Text = ui.Text("publish", "publishAll", d.Text, getUser());
|
||||
ok.Text = ui.Text("content", "publish", getUser());
|
||||
ok.Attributes.Add("style", "width: 60px");
|
||||
ok.Attributes.Add("onClick", "startPublication();");
|
||||
|
||||
@@ -85,36 +84,36 @@ namespace umbraco.dialogs
|
||||
|
||||
if (PublishAll.Checked)
|
||||
{
|
||||
nodesPublished = 0;
|
||||
_nodesPublished = 0;
|
||||
|
||||
doPublishSubs(d);
|
||||
DoPublishSubs(d);
|
||||
|
||||
Application.Lock();
|
||||
Application["publishTotal" + nodeId.ToString()] = 0;
|
||||
Application["publishTotal" + _nodeId.ToString()] = 0;
|
||||
Application.UnLock();
|
||||
|
||||
feedbackMsg.type = umbraco.uicontrols.Feedback.feedbacktype.success;
|
||||
feedbackMsg.type = uicontrols.Feedback.feedbacktype.success;
|
||||
|
||||
feedbackMsg.Text = ui.Text("publish", "nodePublishAll", d.Text, base.getUser()) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
|
||||
feedbackMsg.Text = ui.Text("publish", "nodePublishAll", d.Text, getUser()) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
|
||||
|
||||
ClientTools.ReloadActionNode(true, true);
|
||||
|
||||
Application.Lock();
|
||||
|
||||
Application["publishTotal" + nodeId.ToString()] = null;
|
||||
Application["publishDone" + nodeId.ToString()] = null;
|
||||
Application["publishTotal" + _nodeId.ToString()] = null;
|
||||
Application["publishDone" + _nodeId.ToString()] = null;
|
||||
Application.UnLock();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (d.PublishWithResult(base.getUser()))
|
||||
if (d.PublishWithResult(getUser()))
|
||||
{
|
||||
feedbackMsg.type = umbraco.uicontrols.Feedback.feedbacktype.success;
|
||||
feedbackMsg.Text = ui.Text("publish", "nodePublish", d.Text, base.getUser()) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
|
||||
feedbackMsg.type = uicontrols.Feedback.feedbacktype.success;
|
||||
feedbackMsg.Text = ui.Text("publish", "nodePublish", d.Text, getUser()) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
|
||||
}
|
||||
else {
|
||||
feedbackMsg.type = umbraco.uicontrols.Feedback.feedbacktype.notice;
|
||||
feedbackMsg.Text = ui.Text("publish", "contentPublishedFailedByEvent", d.Text, base.getUser()) + "</p><p><a href='#' onClick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
|
||||
feedbackMsg.type = uicontrols.Feedback.feedbacktype.notice;
|
||||
feedbackMsg.Text = ui.Text("publish", "contentPublishedFailedByEvent", d.Text, getUser()) + "</p><p><a href='#' onClick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
|
||||
}
|
||||
ClientTools.ReloadActionNode(true, false);
|
||||
}
|
||||
@@ -122,9 +121,9 @@ namespace umbraco.dialogs
|
||||
TheForm.Visible = false;
|
||||
theEnd.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void doPublishSubs(Document d)
|
||||
private void DoPublishSubs(cms.businesslogic.web.Document d)
|
||||
{
|
||||
if (d.Published || PublishUnpublishedItems.Checked)
|
||||
{
|
||||
@@ -132,28 +131,29 @@ namespace umbraco.dialogs
|
||||
{
|
||||
|
||||
|
||||
nodesPublished++;
|
||||
_nodesPublished++;
|
||||
Application.Lock();
|
||||
Application["publishDone" + nodeId.ToString()] = nodesPublished.ToString();
|
||||
Application["publishDone" + _nodeId.ToString()] = _nodesPublished.ToString();
|
||||
Application.UnLock();
|
||||
foreach (cms.businesslogic.web.Document dc in d.Children)
|
||||
foreach (var dc in d.Children)
|
||||
{
|
||||
doPublishSubs(dc);
|
||||
DoPublishSubs(dc);
|
||||
}
|
||||
}
|
||||
else {
|
||||
LogHelper.Debug<publish>(string.Format("Publishing node {0} failed due to event cancelling the publishing", d.Id));
|
||||
else
|
||||
{
|
||||
LogHelper.Warn<publish>("Publishing failed due to event cancelling the publishing for document " + d.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPreRender(EventArgs e) {
|
||||
base.OnPreRender(e);
|
||||
|
||||
ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/publication.asmx"));
|
||||
ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/legacyAjaxCalls.asmx"));
|
||||
}
|
||||
protected override void OnPreRender(EventArgs e)
|
||||
{
|
||||
base.OnPreRender(e);
|
||||
|
||||
ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/publication.asmx"));
|
||||
ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/legacyAjaxCalls.asmx"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// masterPagePrefix control.
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Umbraco.Core;
|
||||
using UmbracoExamine;
|
||||
using System.Xml;
|
||||
using Examine;
|
||||
@@ -15,50 +16,52 @@ namespace umbraco.presentation.dialogs
|
||||
{
|
||||
public partial class search : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
CurrentApp = IndexTypes.Content;
|
||||
if (!string.IsNullOrEmpty(Request["app"]))
|
||||
{
|
||||
CurrentApp = Request["app"].ToLower();
|
||||
}
|
||||
|
||||
base.OnInit(e);
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.Page.Form.DefaultButton = this.searchButton.UniqueID;
|
||||
Page.Form.DefaultButton = searchButton.UniqueID;
|
||||
|
||||
if (!IsPostBack && UmbracoContext.Current.Request["search"] != "")
|
||||
if (!IsPostBack && Request["search"] != "")
|
||||
{
|
||||
keyword.Text = UmbracoContext.Current.Request["search"];
|
||||
doSearch();
|
||||
keyword.Text = Request["search"];
|
||||
DoSearch();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void search_Click(object sender, EventArgs e)
|
||||
{
|
||||
doSearch();
|
||||
|
||||
|
||||
DoSearch();
|
||||
}
|
||||
|
||||
private void doSearch()
|
||||
private void DoSearch()
|
||||
{
|
||||
|
||||
var txt = keyword.Text.ToLower();
|
||||
|
||||
//the app can be Content or Media only, otherwise an exception will be thrown
|
||||
var app = UmbracoExamine.IndexTypes.Content;
|
||||
if (!string.IsNullOrEmpty(UmbracoContext.Current.Request["app"]))
|
||||
{
|
||||
app = UmbracoContext.Current.Request["app"].ToLower();
|
||||
}
|
||||
|
||||
int limit;
|
||||
if (!int.TryParse(UmbracoContext.Current.Request["limit"], out limit))
|
||||
if (!int.TryParse(Request["limit"], out limit))
|
||||
{
|
||||
limit = 100;
|
||||
}
|
||||
|
||||
//if it doesn't start with "*", then search only nodeName and nodeId
|
||||
var internalSearcher = (app == Constants.Applications.Members)
|
||||
var internalSearcher = (CurrentApp == Constants.Applications.Members)
|
||||
? UmbracoContext.Current.InternalMemberSearchProvider
|
||||
: UmbracoContext.Current.InternalSearchProvider;
|
||||
|
||||
//create some search criteria, make everything combined to be 'And' and only search the current app
|
||||
var criteria = internalSearcher.CreateSearchCriteria(app, Examine.SearchCriteria.BooleanOperation.And);
|
||||
var criteria = internalSearcher.CreateSearchCriteria(CurrentApp, Examine.SearchCriteria.BooleanOperation.And);
|
||||
|
||||
IEnumerable<SearchResult> results;
|
||||
if (txt.StartsWith("*"))
|
||||
@@ -71,39 +74,32 @@ namespace umbraco.presentation.dialogs
|
||||
var operation = criteria.Field("__nodeName", txt.MultipleCharacterWildcard());
|
||||
|
||||
// ensure the user can only find nodes they are allowed to see
|
||||
if (UmbracoContext.Current.UmbracoUser.StartNodeId > 0)
|
||||
if (CurrentUser.StartNodeId > 0)
|
||||
{
|
||||
operation = operation.And().Id(UmbracoContext.Current.UmbracoUser.StartNodeId);
|
||||
operation = operation.And().Id(CurrentUser.StartNodeId);
|
||||
}
|
||||
|
||||
results = internalSearcher.Search(operation.Compile());
|
||||
|
||||
}
|
||||
|
||||
if (results.Count() == 0)
|
||||
{
|
||||
nothingFound.Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
nothingFound.Visible = false;
|
||||
}
|
||||
nothingFound.Visible = !results.Any();
|
||||
|
||||
searchResult.XPathNavigator = ResultsAsXml(results).CreateNavigator();
|
||||
}
|
||||
|
||||
private XmlDocument ResultsAsXml(IEnumerable<SearchResult> results)
|
||||
{
|
||||
XmlDocument result = new XmlDocument();
|
||||
var result = new XmlDocument();
|
||||
result.LoadXml("<results/>");
|
||||
|
||||
foreach (var r in results)
|
||||
{
|
||||
XmlNode x = xmlHelper.addTextNode(result, "result", "");
|
||||
x.Attributes.Append(xmlHelper.addAttribute(result, "id", r.Id.ToString()));
|
||||
x.Attributes.Append(xmlHelper.addAttribute(result, "title", r.Fields["nodeName"]));
|
||||
x.Attributes.Append(xmlHelper.addAttribute(result, "author", r.Fields["writerName"]));
|
||||
x.Attributes.Append(xmlHelper.addAttribute(result, "changeDate", r.Fields["updateDate"]));
|
||||
var x = XmlHelper.AddTextNode(result, "result", "");
|
||||
x.Attributes.Append(XmlHelper.AddAttribute(result, "id", r.Id.ToString()));
|
||||
x.Attributes.Append(XmlHelper.AddAttribute(result, "title", r.Fields["nodeName"]));
|
||||
x.Attributes.Append(XmlHelper.AddAttribute(result, "author", r.Fields["writerName"]));
|
||||
x.Attributes.Append(XmlHelper.AddAttribute(result, "changeDate", r.Fields["updateDate"]));
|
||||
result.DocumentElement.AppendChild(x);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,9 +20,14 @@ namespace umbraco.presentation.dialogs
|
||||
{
|
||||
private CMSNode _currentPage;
|
||||
|
||||
public sendToTranslation()
|
||||
{
|
||||
CurrentApp = DefaultApps.content.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
_currentPage = new cms.businesslogic.CMSNode(int.Parse(helper.Request("id")));
|
||||
_currentPage = new CMSNode(int.Parse(helper.Request("id")));
|
||||
|
||||
pp_translator.Text = ui.Text("translation","translator", this.getUser());
|
||||
pp_language.Text = ui.Text("translation", "translateTo", this.getUser());
|
||||
@@ -34,9 +39,9 @@ namespace umbraco.presentation.dialogs
|
||||
if (!IsPostBack)
|
||||
{
|
||||
// default language
|
||||
int selectedLanguage = 0;
|
||||
var selectedLanguage = 0;
|
||||
|
||||
Domain[] domains = library.GetCurrentDomains(_currentPage.Id);
|
||||
var domains = library.GetCurrentDomains(_currentPage.Id);
|
||||
if (domains != null)
|
||||
{
|
||||
selectedLanguage = domains[0].Language.id;
|
||||
@@ -49,9 +54,9 @@ namespace umbraco.presentation.dialogs
|
||||
|
||||
// languages
|
||||
language.Items.Add(new ListItem(ui.Text("general", "choose", base.getUser()), ""));
|
||||
foreach (cms.businesslogic.language.Language l in cms.businesslogic.language.Language.getAll)
|
||||
foreach (var l in cms.businesslogic.language.Language.getAll)
|
||||
{
|
||||
ListItem li = new ListItem();
|
||||
var li = new ListItem();
|
||||
li.Text = l.FriendlyName;
|
||||
li.Value = l.id.ToString();
|
||||
if (selectedLanguage == l.id)
|
||||
@@ -64,13 +69,13 @@ namespace umbraco.presentation.dialogs
|
||||
includeSubpages.Enabled = false;
|
||||
|
||||
// Translators
|
||||
foreach (User u in BusinessLogic.User.getAll())
|
||||
foreach (var u in BusinessLogic.User.getAll())
|
||||
if (u.UserType.Alias.ToLower() == "translator")
|
||||
translator.Items.Add(new ListItem(u.Name, u.Id.ToString()));
|
||||
|
||||
if (translator.Items.Count == 0) {
|
||||
feedback.Text = ui.Text("translation", "noTranslators");
|
||||
feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.error;
|
||||
feedback.type = uicontrols.Feedback.feedbacktype.error;
|
||||
doTranslation.Enabled = false;
|
||||
}
|
||||
|
||||
@@ -94,7 +99,7 @@ namespace umbraco.presentation.dialogs
|
||||
pl_buttons.Visible = false;
|
||||
|
||||
feedback.Text = ui.Text("translation","pageHasBeenSendToTranslation", _currentPage.Text, base.getUser()) + "</p><p><a href=\"#\" onclick=\"" + ClientTools.Scripts.CloseModalWindow() + "\">" + ui.Text("defaultdialogs", "closeThisWindow") + "</a></p>";
|
||||
feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.success;
|
||||
feedback.type = uicontrols.Feedback.feedbacktype.success;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,11 +23,17 @@ namespace umbraco.cms.presentation
|
||||
{
|
||||
private readonly List<SortableNode> _nodes = new List<SortableNode>();
|
||||
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
CurrentApp = helper.Request("app");
|
||||
|
||||
base.OnInit(e);
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
sortDone.Text = ui.Text("sort", "sortDone");
|
||||
}
|
||||
|
||||
protected override void OnPreRender(EventArgs e)
|
||||
{
|
||||
base.OnPreRender(e);
|
||||
@@ -131,27 +137,6 @@ namespace umbraco.cms.presentation
|
||||
public DateTime createDate;
|
||||
}
|
||||
|
||||
|
||||
#region Web Form Designer generated code
|
||||
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
//
|
||||
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
|
||||
//
|
||||
InitializeComponent();
|
||||
base.OnInit(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class nodeNameCompare : IComparer<sort.SortableNode>
|
||||
|
||||
@@ -5,8 +5,8 @@ using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Persistence.Caching;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.IO;
|
||||
using umbraco.BusinessLogic.Actions;
|
||||
using umbraco.IO;
|
||||
using umbraco.uicontrols.DatePicker;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
@@ -101,7 +101,7 @@ namespace umbraco.cms.presentation
|
||||
|
||||
foreach (uicontrols.TabPage tp in _cControl.GetPanels())
|
||||
{
|
||||
addPreviewButton(tp.Menu, _document.Id);
|
||||
AddPreviewButton(tp.Menu, _document.Id);
|
||||
}
|
||||
|
||||
plc.Controls.Add(_cControl);
|
||||
@@ -134,8 +134,8 @@ namespace umbraco.cms.presentation
|
||||
|
||||
// Template
|
||||
var template = new PlaceHolder();
|
||||
var documentType = new DocumentType(_document.ContentType.Id);
|
||||
_cControl.PropertiesPane.addProperty(ui.Text("documentType"), new LiteralControl(documentType.Text));
|
||||
var DocumentType = new DocumentType(_document.ContentType.Id);
|
||||
_cControl.PropertiesPane.addProperty(ui.Text("documentType"), new LiteralControl(DocumentType.Text));
|
||||
|
||||
|
||||
//template picker
|
||||
@@ -149,14 +149,14 @@ namespace umbraco.cms.presentation
|
||||
if (UmbracoUser.UserType.Name == "writer")
|
||||
{
|
||||
if (defaultTemplate != 0)
|
||||
template.Controls.Add(new LiteralControl(cms.businesslogic.template.Template.GetTemplate(defaultTemplate).Text));
|
||||
template.Controls.Add(new LiteralControl(businesslogic.template.Template.GetTemplate(defaultTemplate).Text));
|
||||
else
|
||||
template.Controls.Add(new LiteralControl(ui.Text("content", "noDefaultTemplate")));
|
||||
}
|
||||
else
|
||||
{
|
||||
_ddlDefaultTemplate.Items.Add(new ListItem(ui.Text("choose") + "...", ""));
|
||||
foreach (var t in documentType.allowedTemplates)
|
||||
foreach (var t in DocumentType.allowedTemplates)
|
||||
{
|
||||
|
||||
var tTemp = new ListItem(t.Text, t.Id.ToString());
|
||||
@@ -192,12 +192,12 @@ namespace umbraco.cms.presentation
|
||||
_cControl.tpProp.Controls.AddAt(2, _linkProps);
|
||||
|
||||
// add preview to properties pane too
|
||||
addPreviewButton(_cControl.tpProp.Menu, _document.Id);
|
||||
AddPreviewButton(_cControl.tpProp.Menu, _document.Id);
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, System.EventArgs e)
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!_contentId.HasValue)
|
||||
return;
|
||||
@@ -349,7 +349,7 @@ namespace umbraco.cms.presentation
|
||||
}
|
||||
}
|
||||
|
||||
protected void UnPublishDo(object sender, System.EventArgs e)
|
||||
protected void UnPublishDo(object sender, EventArgs e)
|
||||
{
|
||||
_document.UnPublish();
|
||||
_littPublishStatus.Text = ui.Text("content", "itemNotPublished", UmbracoUser);
|
||||
@@ -366,11 +366,9 @@ namespace umbraco.cms.presentation
|
||||
|
||||
void UpdateNiceUrlProperties(string niceUrlText, string altUrlsText)
|
||||
{
|
||||
Literal lit;
|
||||
|
||||
_linkProps.Controls.Clear();
|
||||
|
||||
lit = new Literal();
|
||||
var lit = new Literal();
|
||||
lit.Text = niceUrlText;
|
||||
_linkProps.addProperty(ui.Text("content", "urls", UmbracoUser), lit);
|
||||
|
||||
@@ -507,14 +505,14 @@ namespace umbraco.cms.presentation
|
||||
ShowUserValidationError("<h3>The current user doesn't have access to this application</h3><p>Please contact the system administrator if you think that you should have access.</p>");
|
||||
return false;
|
||||
}
|
||||
if (!base.ValidateUserNodeTreePermissions(_document.Path, ActionBrowse.Instance.Letter.ToString()))
|
||||
if (!ValidateUserNodeTreePermissions(_document.Path, ActionBrowse.Instance.Letter.ToString()))
|
||||
{
|
||||
ShowUserValidationError(
|
||||
"<h3>The current user doesn't have permissions to browse this document</h3><p>Please contact the system administrator if you think that you should have access.</p>");
|
||||
return false;
|
||||
}
|
||||
//TODO: Change this, when we add view capabilities, the user will be able to view but not edit!
|
||||
if (!base.ValidateUserNodeTreePermissions(_document.Path, ActionUpdate.Instance.Letter.ToString()))
|
||||
if (!ValidateUserNodeTreePermissions(_document.Path, ActionUpdate.Instance.Letter.ToString()))
|
||||
{
|
||||
ShowUserValidationError("<h3>The current user doesn't have permissions to edit this document</h3><p>Please contact the system administrator if you think that you should have access.</p>");
|
||||
return false;
|
||||
@@ -522,7 +520,7 @@ namespace umbraco.cms.presentation
|
||||
return true;
|
||||
}
|
||||
|
||||
private void addPreviewButton(uicontrols.ScrollingMenu menu, int id)
|
||||
private void AddPreviewButton(uicontrols.ScrollingMenu menu, int id)
|
||||
{
|
||||
uicontrols.MenuIconI menuItem;
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@ namespace umbraco.presentation.members
|
||||
|
||||
public partial class search : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
|
||||
public search()
|
||||
{
|
||||
CurrentApp = DefaultApps.member.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,23 @@ using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.businesslogic.Exceptions;
|
||||
|
||||
namespace umbraco.presentation.umbraco.plugins.tinymce3
|
||||
{
|
||||
public partial class InsertAnchor : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
base.OnInit(e);
|
||||
|
||||
//this could be used for media or content so we need to at least validate that the user has access to one or the other
|
||||
if (!ValidateUserApp(DefaultApps.content.ToString()) && !ValidateUserApp(DefaultApps.media.ToString()))
|
||||
throw new UserAuthorizationException("The current user doesn't have access to the section/app");
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
|
||||
@@ -3,11 +3,22 @@ using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.businesslogic.Exceptions;
|
||||
|
||||
namespace umbraco.presentation.umbraco.plugins.tinymce3
|
||||
{
|
||||
public partial class insertChar : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
base.OnInit(e);
|
||||
|
||||
//this could be used for media or content so we need to at least validate that the user has access to one or the other
|
||||
if (!ValidateUserApp(DefaultApps.content.ToString()) && !ValidateUserApp(DefaultApps.media.ToString()))
|
||||
throw new UserAuthorizationException("The current user doesn't have access to the section/app");
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
|
||||
@@ -3,6 +3,8 @@ using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.businesslogic.Exceptions;
|
||||
|
||||
namespace umbraco.presentation.plugins.tinymce3
|
||||
{
|
||||
@@ -11,7 +13,7 @@ namespace umbraco.presentation.plugins.tinymce3
|
||||
protected uicontrols.TabView tbv = new uicontrols.TabView();
|
||||
|
||||
|
||||
protected void Page_Load(object sender, System.EventArgs e)
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
ClientLoader.DataBind();
|
||||
|
||||
@@ -27,38 +29,29 @@ namespace umbraco.presentation.plugins.tinymce3
|
||||
Title = ui.Text("insertimage");
|
||||
|
||||
// Put user code to initialize the page here
|
||||
uicontrols.TabPage tp = tv_options.NewTabPage(ui.Text("choose"));
|
||||
var tp = tv_options.NewTabPage(ui.Text("choose"));
|
||||
tp.HasMenu = false;
|
||||
tp.Controls.Add(pane_select);
|
||||
|
||||
uicontrols.TabPage tp2 = tv_options.NewTabPage(ui.Text("create") + " " + ui.Text("new"));
|
||||
var tp2 = tv_options.NewTabPage(ui.Text("create") + " " + ui.Text("new"));
|
||||
tp2.HasMenu = false;
|
||||
tp2.Controls.Add(pane_upload);
|
||||
}
|
||||
|
||||
#region Web Form Designer generated code
|
||||
override protected void OnInit(EventArgs e)
|
||||
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
//
|
||||
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
|
||||
//
|
||||
tbv.ID = "tabview1";
|
||||
tbv.AutoResize = false;
|
||||
tbv.Width = 500;
|
||||
tbv.Height = 290;
|
||||
|
||||
InitializeComponent();
|
||||
//this could be used for media or content so we need to at least validate that the user has access to one or the other
|
||||
if (!ValidateUserApp(DefaultApps.content.ToString()) && !ValidateUserApp(DefaultApps.media.ToString()))
|
||||
throw new UserAuthorizationException("The current user doesn't have access to the section/app");
|
||||
|
||||
base.OnInit(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,17 +4,22 @@ using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Umbraco.Core;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.businesslogic.Exceptions;
|
||||
|
||||
namespace umbraco.presentation.plugins.tinymce3
|
||||
{
|
||||
public partial class insertLink : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
//protected uicontrols.TabView tbv = new uicontrols.TabView();
|
||||
public insertLink()
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
CurrentApp = BusinessLogic.DefaultApps.content.ToString();
|
||||
base.OnInit(e);
|
||||
|
||||
//this could be used for media or content so we need to at least validate that the user has access to one or the other
|
||||
if (!ValidateUserApp(DefaultApps.content.ToString()) && !ValidateUserApp(DefaultApps.media.ToString()))
|
||||
throw new UserAuthorizationException("The current user doesn't have access to the section/app");
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, System.EventArgs e)
|
||||
{
|
||||
ClientLoader.DataBind();
|
||||
@@ -49,23 +54,11 @@ namespace umbraco.presentation.plugins.tinymce3
|
||||
base.Render(writer);
|
||||
}
|
||||
|
||||
public BusinessLogic.User GetUser()
|
||||
public User GetUser()
|
||||
{
|
||||
return base.getUser();
|
||||
}
|
||||
|
||||
override protected void OnInit(EventArgs e)
|
||||
{
|
||||
//
|
||||
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
|
||||
//
|
||||
//tbv.ID = "tabview1";
|
||||
//tbv.Width = 300;
|
||||
//tbv.Height = 320;
|
||||
//tbv.AutoResize = false;
|
||||
|
||||
base.OnInit(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,12 +5,13 @@ using System.Reflection;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
using Umbraco.Core.IO;
|
||||
using umbraco.BasePages;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.businesslogic.Exceptions;
|
||||
using umbraco.cms.businesslogic.macro;
|
||||
using umbraco.interfaces;
|
||||
using umbraco.DataLayer;
|
||||
using umbraco.IO;
|
||||
|
||||
namespace umbraco.presentation.tinymce3
|
||||
{
|
||||
@@ -20,15 +21,24 @@ namespace umbraco.presentation.tinymce3
|
||||
public partial class insertMacro : UmbracoEnsuredPage
|
||||
{
|
||||
protected Button Button1;
|
||||
private ArrayList _dataFields = new ArrayList();
|
||||
private readonly ArrayList _dataFields = new ArrayList();
|
||||
public Macro m;
|
||||
private string _scriptOnLoad = "";
|
||||
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
base.OnInit(e);
|
||||
|
||||
//this could be used for media or content so we need to at least validate that the user has access to one or the other
|
||||
if (!ValidateUserApp(DefaultApps.content.ToString()) && !ValidateUserApp(DefaultApps.media.ToString()))
|
||||
throw new UserAuthorizationException("The current user doesn't have access to the section/app");
|
||||
}
|
||||
|
||||
protected override void OnPreRender(EventArgs e)
|
||||
{
|
||||
base.OnPreRender(e);
|
||||
|
||||
if (!String.IsNullOrEmpty(_scriptOnLoad))
|
||||
if (!string.IsNullOrEmpty(_scriptOnLoad))
|
||||
{
|
||||
jQueryReady.Text = _scriptOnLoad;
|
||||
}
|
||||
@@ -40,14 +50,14 @@ namespace umbraco.presentation.tinymce3
|
||||
|
||||
_scriptOnLoad = "";
|
||||
|
||||
string reqMacroID = UmbracoContext.Current.Request["umb_macroID"];
|
||||
string reqMacroAlias = UmbracoContext.Current.Request["umb_macroAlias"];
|
||||
bool ignoreForm = string.IsNullOrEmpty(UmbracoContext.Current.Request["class"]);
|
||||
var reqMacroId = Request["umb_macroID"];
|
||||
var reqMacroAlias = Request["umb_macroAlias"];
|
||||
var ignoreForm = string.IsNullOrEmpty(Request["class"]);
|
||||
|
||||
pane_insert.Text = ui.Text("insertMacro");
|
||||
Page.Title = ui.Text("insertMacro");
|
||||
|
||||
if (!String.IsNullOrEmpty(reqMacroID) || !String.IsNullOrEmpty(reqMacroAlias))
|
||||
if (!string.IsNullOrEmpty(reqMacroId) || !string.IsNullOrEmpty(reqMacroAlias))
|
||||
{
|
||||
|
||||
pane_edit.Visible = true;
|
||||
@@ -56,9 +66,9 @@ namespace umbraco.presentation.tinymce3
|
||||
insert_buttons.Visible = false;
|
||||
|
||||
// Put user code to initialize the page here
|
||||
if (!string.IsNullOrEmpty(reqMacroID))
|
||||
if (!string.IsNullOrEmpty(reqMacroId))
|
||||
{
|
||||
m = new Macro(int.Parse(reqMacroID));
|
||||
m = new Macro(int.Parse(reqMacroId));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -68,9 +78,6 @@ namespace umbraco.presentation.tinymce3
|
||||
pane_edit.Text = ui.Text("edit") + " " + m.Name;
|
||||
Page.Title = ui.Text("edit") + " " + m.Name;
|
||||
|
||||
String macroAssembly = "";
|
||||
String macroType = "";
|
||||
|
||||
if (m.Properties.Length == 0)
|
||||
{
|
||||
|
||||
@@ -80,7 +87,7 @@ namespace umbraco.presentation.tinymce3
|
||||
}
|
||||
else
|
||||
{
|
||||
Literal fb = new Literal();
|
||||
var fb = new Literal();
|
||||
fb.Text = "<p>" + ui.Text("macroDoesNotHaveProperties") + "</p><p><a href='#' onClick='tinyMCEPopup.close();'>" + ui.Text("closeThisWindow") + "</a>";
|
||||
macroProperties.Controls.Add(fb);
|
||||
edit_buttons.Visible = false;
|
||||
@@ -89,20 +96,20 @@ namespace umbraco.presentation.tinymce3
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (MacroProperty mp in m.Properties)
|
||||
foreach (var mp in m.Properties)
|
||||
{
|
||||
|
||||
macroAssembly = mp.Type.Assembly;
|
||||
macroType = mp.Type.Type;
|
||||
var macroAssembly = mp.Type.Assembly;
|
||||
var macroType = mp.Type.Type;
|
||||
try
|
||||
{
|
||||
Assembly assembly = Assembly.LoadFrom(IOHelper.MapPath(SystemDirectories.Bin + "/" + macroAssembly + ".dll"));
|
||||
var assembly = Assembly.LoadFrom(IOHelper.MapPath(SystemDirectories.Bin + "/" + macroAssembly + ".dll"));
|
||||
|
||||
Type type = assembly.GetType(macroAssembly + "." + macroType);
|
||||
IMacroGuiRendering typeInstance = Activator.CreateInstance(type) as IMacroGuiRendering;
|
||||
var type = assembly.GetType(macroAssembly + "." + macroType);
|
||||
var typeInstance = Activator.CreateInstance(type) as IMacroGuiRendering;
|
||||
if (typeInstance != null)
|
||||
{
|
||||
Control control = Activator.CreateInstance(type) as Control;
|
||||
var control = Activator.CreateInstance(type) as Control;
|
||||
control.ID = mp.Alias;
|
||||
|
||||
if (!IsPostBack)
|
||||
@@ -129,16 +136,15 @@ namespace umbraco.presentation.tinymce3
|
||||
}
|
||||
|
||||
|
||||
uicontrols.PropertyPanel pp = new global::umbraco.uicontrols.PropertyPanel();
|
||||
var pp = new uicontrols.PropertyPanel();
|
||||
pp.Text = mp.Name;
|
||||
pp.Controls.Add(control);
|
||||
_scriptOnLoad += "\t\tregisterAlias('" + control.ID + "');\n";
|
||||
// pp.Controls.Add(new LiteralControl("<script type=\"text/javascript\"></script>\n"));
|
||||
macroProperties.Controls.Add(pp);
|
||||
|
||||
_dataFields.Add(control);
|
||||
|
||||
//macroProperties.Controls.Add(new LiteralControl("</td></tr>"));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -158,7 +164,7 @@ namespace umbraco.presentation.tinymce3
|
||||
else
|
||||
{
|
||||
IRecordsReader macroRenderings;
|
||||
if (UmbracoContext.Current.Request["editor"] != "")
|
||||
if (Request["editor"] != "")
|
||||
macroRenderings = SqlHelper.ExecuteReader("select macroAlias, macroName from cmsMacro where macroUseInEditor = 1 order by macroName");
|
||||
else
|
||||
macroRenderings = SqlHelper.ExecuteReader("select macroAlias, macroName from cmsMacro order by macroName");
|
||||
@@ -174,19 +180,19 @@ namespace umbraco.presentation.tinymce3
|
||||
|
||||
protected void renderMacro_Click(object sender, EventArgs e)
|
||||
{
|
||||
int pageID = int.Parse(UmbracoContext.Current.Request["umbPageId"]);
|
||||
var pageId = int.Parse(Request["umbPageId"]);
|
||||
|
||||
string macroAttributes = string.Format("macroAlias=\"{0}\"", m.Alias);
|
||||
var macroAttributes = string.Format("macroAlias=\"{0}\"", m.Alias);
|
||||
|
||||
Guid pageVersion = new Guid(UmbracoContext.Current.Request["umbVersionId"]);
|
||||
var pageVersion = new Guid(Request["umbVersionId"]);
|
||||
|
||||
Hashtable attributes = new Hashtable { { "macroAlias", m.Alias } };
|
||||
var attributes = new Hashtable { { "macroAlias", m.Alias } };
|
||||
|
||||
foreach (Control c in _dataFields)
|
||||
{
|
||||
try
|
||||
{
|
||||
IMacroGuiRendering ic = (IMacroGuiRendering)c;
|
||||
var ic = (IMacroGuiRendering)c;
|
||||
attributes.Add(c.ID.ToLower(), ic.Value);
|
||||
macroAttributes += string.Format(" {0}=\"{1}\"", c.ID, ic.Value.Replace("\"", "\\\"").Replace("\n", "\\n").Replace("\r", "\\r"));
|
||||
}
|
||||
@@ -196,11 +202,11 @@ namespace umbraco.presentation.tinymce3
|
||||
}
|
||||
|
||||
HttpContext.Current.Items["macrosAdded"] = 0;
|
||||
HttpContext.Current.Items["pageID"] = pageID.ToString();
|
||||
HttpContext.Current.Items["pageID"] = pageId.ToString();
|
||||
|
||||
string div = macro.renderMacroStartTag(attributes, pageID, pageVersion).Replace("\\", "\\\\").Replace("'", "\\'");
|
||||
var div = macro.renderMacroStartTag(attributes, pageId, pageVersion).Replace("\\", "\\\\").Replace("'", "\\'");
|
||||
|
||||
string macroContent = macro.MacroContentByHttp(pageID, pageVersion, attributes).Replace("\\", "\\\\").Replace("'", "\\'").Replace("/", "\\/").Replace("\n", "\\n");
|
||||
var macroContent = macro.MacroContentByHttp(pageId, pageVersion, attributes).Replace("\\", "\\\\").Replace("'", "\\'").Replace("/", "\\/").Replace("\n", "\\n");
|
||||
|
||||
if (macroContent.Length > 0 && macroContent.ToLower().IndexOf("<script") > -1)
|
||||
macroContent = "<b>Macro rendering contains script code</b><br/>This macro won\\'t be rendered in the editor because it contains script code. It will render correct during runtime.";
|
||||
|
||||
@@ -8,17 +8,23 @@ using System.Web.SessionState;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using umbraco.BusinessLogic;
|
||||
|
||||
namespace umbraco.cms.presentation.settings.modal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for ShowUmbracoTags.
|
||||
/// </summary>
|
||||
public partial class ShowUmbracoTags : umbraco.BasePages.UmbracoEnsuredPage
|
||||
public partial class ShowUmbracoTags : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
|
||||
public ShowUmbracoTags()
|
||||
{
|
||||
CurrentApp = DefaultApps.settings.ToString();
|
||||
}
|
||||
|
||||
public static string alias = "";
|
||||
protected void Page_Load(object sender, System.EventArgs e)
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
alias = Request.QueryString["alias"].Replace(" ", "").Trim();
|
||||
// Put user code to initialize the page here
|
||||
@@ -31,6 +37,6 @@ namespace umbraco.cms.presentation.settings.modal
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.Pane Pane7;
|
||||
protected uicontrols.Pane Pane7;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.businesslogic.task;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco.cms.businesslogic.relation;
|
||||
@@ -20,25 +20,33 @@ namespace umbraco.presentation.translation
|
||||
public string originalUrl = "";
|
||||
public string translatedUrl = "";
|
||||
|
||||
public preview()
|
||||
{
|
||||
CurrentApp = DefaultApps.translation.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
int taskId = int.Parse(helper.Request("id"));
|
||||
var taskId = int.Parse(helper.Request("id"));
|
||||
|
||||
Task t = new Task(taskId);
|
||||
Document translated = new Document(t.Node.Id);
|
||||
var t = new Task(taskId);
|
||||
var translated = new Document(t.Node.Id);
|
||||
|
||||
translatedUrl = String.Format("../dialogs/preview.aspx?id={0}", translated.Id.ToString(), translated.Version.ToString());
|
||||
translatedUrl = string.Format("../dialogs/preview.aspx?id={0}", translated.Id.ToString());
|
||||
|
||||
Relation[] orgRel = Relation.GetRelations(t.Node.Id, RelationType.GetByAlias("relateDocumentOnCopy"));
|
||||
if (orgRel.Length > 0) {
|
||||
Document original = new Document(orgRel[0].Parent.Id);
|
||||
originalUrl = String.Format("../dialogs/preview.aspx?id={0}", original.Id.ToString(), original.Version.ToString());
|
||||
} else {
|
||||
var orgRel = Relation.GetRelations(t.Node.Id, RelationType.GetByAlias("relateDocumentOnCopy"));
|
||||
if (orgRel.Length > 0)
|
||||
{
|
||||
var original = new Document(orgRel[0].Parent.Id);
|
||||
originalUrl = String.Format("../dialogs/preview.aspx?id={0}", original.Id.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Redirect(translatedUrl);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ using System.Web.UI.HtmlControls;
|
||||
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using Umbraco.Core;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.businesslogic.task;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco.IO;
|
||||
@@ -19,21 +21,26 @@ namespace umbraco.presentation.translation
|
||||
{
|
||||
public partial class xml : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
private XmlDocument xd = new XmlDocument();
|
||||
private readonly XmlDocument _xd = new XmlDocument();
|
||||
|
||||
public xml()
|
||||
{
|
||||
CurrentApp = DefaultApps.translation.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
Response.ContentType = "text/xml";
|
||||
int pageId;
|
||||
|
||||
XmlNode root = xd.CreateElement("tasks");
|
||||
XmlNode root = _xd.CreateElement("tasks");
|
||||
|
||||
if (int.TryParse(Request["id"], out pageId))
|
||||
{
|
||||
Task t = new Task(pageId);
|
||||
var t = new Task(pageId);
|
||||
if (t.User.Id == base.getUser().Id || t.ParentUser.Id == base.getUser().Id)
|
||||
{
|
||||
XmlNode x = CreateTaskNode(t, xd);
|
||||
XmlNode x = CreateTaskNode(t, _xd);
|
||||
root.AppendChild(x);
|
||||
|
||||
xmlContents.Text = root.OuterXml;
|
||||
@@ -43,27 +50,27 @@ namespace umbraco.presentation.translation
|
||||
}
|
||||
else
|
||||
{
|
||||
SortedList nodes = new SortedList();
|
||||
var nodes = new SortedList();
|
||||
int totalWords = 0;
|
||||
|
||||
foreach (Task t in Task.GetTasks(base.getUser(), false))
|
||||
{
|
||||
if (!nodes.ContainsKey(t.Node.Path))
|
||||
{
|
||||
XmlElement xTask = CreateTaskNode(t, xd);
|
||||
var xTask = CreateTaskNode(t, _xd);
|
||||
totalWords += int.Parse(xTask.Attributes.GetNamedItem("TotalWords").Value);
|
||||
nodes.Add(t.Node.Path, xTask);
|
||||
}
|
||||
}
|
||||
|
||||
// Arrange nodes in tree
|
||||
IDictionaryEnumerator ide = nodes.GetEnumerator();
|
||||
var ide = nodes.GetEnumerator();
|
||||
while (ide.MoveNext())
|
||||
{
|
||||
XmlElement x = (XmlElement)ide.Value;
|
||||
string parentXpath = UmbracoSettings.UseLegacyXmlSchema ? "//node [@id = '" + x.SelectSingleNode("//node").Attributes.GetNamedItem("parentID").Value + "']" :
|
||||
var x = (XmlElement)ide.Value;
|
||||
var parentXpath = UmbracoSettings.UseLegacyXmlSchema ? "//node [@id = '" + x.SelectSingleNode("//node").Attributes.GetNamedItem("parentID").Value + "']" :
|
||||
"//* [@isDoc and @id = '" + x.SelectSingleNode("//* [@isDoc]").Attributes.GetNamedItem("parentID").Value + "']";
|
||||
XmlNode parent = xd.SelectSingleNode(parentXpath);
|
||||
var parent = _xd.SelectSingleNode(parentXpath);
|
||||
|
||||
if (parent == null)
|
||||
parent = root;
|
||||
@@ -73,7 +80,7 @@ namespace umbraco.presentation.translation
|
||||
parent.AppendChild((XmlElement)ide.Value);
|
||||
}
|
||||
|
||||
root.Attributes.Append(global::umbraco.xmlHelper.addAttribute(xd, "TotalWords", totalWords.ToString()));
|
||||
root.Attributes.Append(XmlHelper.AddAttribute(_xd, "TotalWords", totalWords.ToString()));
|
||||
xmlContents.Text = root.OuterXml;
|
||||
Response.AddHeader("Content-Disposition", "attachment; filename=all.xml");
|
||||
|
||||
@@ -82,17 +89,17 @@ namespace umbraco.presentation.translation
|
||||
|
||||
private XmlElement CreateTaskNode(Task t, XmlDocument xd)
|
||||
{
|
||||
Document d = new Document(t.Node.Id);
|
||||
XmlNode x = d.ToPreviewXml(xd);// xd.CreateNode(XmlNodeType.Element, "node", "");
|
||||
var d = new Document(t.Node.Id);
|
||||
var x = d.ToPreviewXml(xd);// xd.CreateNode(XmlNodeType.Element, "node", "");
|
||||
|
||||
XmlElement xTask = xd.CreateElement("task");
|
||||
xTask.SetAttributeNode(xmlHelper.addAttribute(xd, "Id", t.Id.ToString()));
|
||||
xTask.SetAttributeNode(xmlHelper.addAttribute(xd, "Date", t.Date.ToString("s")));
|
||||
xTask.SetAttributeNode(xmlHelper.addAttribute(xd, "NodeId", t.Node.Id.ToString()));
|
||||
xTask.SetAttributeNode(xmlHelper.addAttribute(xd, "TotalWords", cms.businesslogic.translation.Translation.CountWords(d.Id).ToString()));
|
||||
xTask.AppendChild(xmlHelper.addCDataNode(xd, "Comment", t.Comment));
|
||||
var xTask = xd.CreateElement("task");
|
||||
xTask.SetAttributeNode(XmlHelper.AddAttribute(xd, "Id", t.Id.ToString()));
|
||||
xTask.SetAttributeNode(XmlHelper.AddAttribute(xd, "Date", t.Date.ToString("s")));
|
||||
xTask.SetAttributeNode(XmlHelper.AddAttribute(xd, "NodeId", t.Node.Id.ToString()));
|
||||
xTask.SetAttributeNode(XmlHelper.AddAttribute(xd, "TotalWords", cms.businesslogic.translation.Translation.CountWords(d.Id).ToString()));
|
||||
xTask.AppendChild(XmlHelper.AddCDataNode(xd, "Comment", t.Comment));
|
||||
string protocol = GlobalSettings.UseSSL ? "https" : "http";
|
||||
xTask.AppendChild(xmlHelper.addTextNode(xd, "PreviewUrl", protocol + "://" + Request.ServerVariables["SERVER_NAME"] + SystemDirectories.Umbraco + "/translation/preview.aspx?id=" + t.Id.ToString()));
|
||||
xTask.AppendChild(XmlHelper.AddTextNode(xd, "PreviewUrl", protocol + "://" + Request.ServerVariables["SERVER_NAME"] + SystemDirectories.Umbraco + "/translation/preview.aspx?id=" + t.Id.ToString()));
|
||||
// d.XmlPopulate(xd, ref x, false);
|
||||
xTask.AppendChild(x);
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using System;
|
||||
using Umbraco.Core.Logging;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.businesslogic.Exceptions;
|
||||
using umbraco.IO;
|
||||
|
||||
namespace umbraco.BasePages
|
||||
{
|
||||
@@ -84,7 +85,7 @@ namespace umbraco.BasePages
|
||||
{
|
||||
ensureContext();
|
||||
|
||||
if (!String.IsNullOrEmpty(CurrentApp))
|
||||
if (!string.IsNullOrEmpty(CurrentApp))
|
||||
{
|
||||
if (!ValidateUserApp(CurrentApp))
|
||||
throw new UserAuthorizationException(String.Format("The current user doesn't have access to the section/app '{0}'", CurrentApp));
|
||||
@@ -92,7 +93,7 @@ namespace umbraco.BasePages
|
||||
}
|
||||
catch (UserAuthorizationException ex)
|
||||
{
|
||||
LogHelper.Error<UmbracoEnsuredPage>(String.Format("Tried to access '{0}'", CurrentApp), ex);
|
||||
LogHelper.Warn<UmbracoEnsuredPage>(string.Format("{0} tried to access '{1}'", CurrentUser.Id, CurrentApp));
|
||||
throw;
|
||||
}
|
||||
catch
|
||||
|
||||
Reference in New Issue
Block a user