Compare commits

..

57 Commits

Author SHA1 Message Date
Stephan 244977dc95 packages - trace errors 2017-04-28 13:34:35 +02:00
Stephan efc3261163 scope - dont break 2017-04-28 11:43:48 +02:00
Stephan 8c6aa9875d scope - dont rename 2017-04-28 11:26:41 +02:00
Stephan f89ce1ff26 scope - cleanup 2017-04-28 10:58:57 +02:00
Shannon d24b0aa9eb oops undeletes a couple files that are still needed for the custom package ascx page 2017-04-28 10:30:47 +10:00
Shannon 9f505a7976 bumps to rc3 version 2017-04-28 08:27:31 +10:00
Shannon 1b27114014 Merge branch 'temp-CON-1267' into dev-v7.6 2017-04-28 07:53:16 +10:00
Shannon Deminick d8b235ad62 Merge pull request #1906 from umbraco/temp-CON-1267
CON-1267 Update Our to not offer v6 to people on < 7.6.0
2017-04-28 07:52:19 +10:00
Shannon 56581478c8 Merge remote-tracking branch 'origin/dev-v7' into temp-CON-1267 2017-04-28 07:48:04 +10:00
Shannon 2be330d237 adds notes, changes to protected 2017-04-28 07:45:01 +10:00
Shannon 4381a700ba Updates UmbracoVirtualNodeRouteHandler to have a new protected GetUmbracoContext method used to get the umb context used in the rest of the code 2017-04-28 07:38:03 +10:00
Shannon 99821954f1 adds notes 2017-04-28 07:31:44 +10:00
Shannon Deminick 10a15be8ad Merge pull request #1901 from tompipe/U4-9384-StaleVariableFix
Quick/simple fix for the stale variable
2017-04-28 07:28:00 +10:00
Stephan d1094eea7a Merge pull request #1905 from umbraco/temp-tasks
Publicize more IBackgroundTask plumbing
2017-04-27 14:46:33 +02:00
Shannon c629a50f39 Fixes entity service and figuring out which GUID to go with which object type 2017-04-27 13:29:31 +10:00
Shannon 430f906ae6 Merge remote-tracking branch 'origin/dev-v7.6' into temp-CON-1267 2017-04-27 13:28:34 +10:00
Shannon 736798c769 Merge remote-tracking branch 'origin/dev-v7' into temp-CON-1267
# Conflicts:
#	src/Umbraco.Core/Exceptions/ConnectionException.cs
#	src/Umbraco.Core/Services/PackagingService.cs
#	src/Umbraco.Web/Editors/PackageInstallController.cs
2017-04-27 13:27:23 +10:00
Shannon e913034d93 Changes PackagingService to not have a different base class since it was not needed 2017-04-27 13:21:56 +10:00
Shannon bed5f8a03b backports updates from 7.6 so that the packages.umbraco.org endpoint is not used for fetching package files any longer 2017-04-27 13:21:07 +10:00
Stephan 0291ab615d Fix shadow wrapper cleanup 2017-04-26 17:38:06 +02:00
Stephan ceeea7827e Fix shadow wrapper cleanup 2017-04-26 14:44:48 +02:00
Shannon 756b4d24c0 Updates endpoint to include hidden package files 2017-04-26 22:10:34 +10:00
Stephan ffe3fc9257 deploy-293 - fix normalization 2017-04-26 13:25:54 +02:00
Shannon 26bd3c7c0b removes unneeded closing of stream since it's disposed 2017-04-26 19:42:58 +10:00
Shannon 944b3dcaac New method for IPackagingService to fetch a package from the repo, removes usages of the old repo endpoint, removes ability to push a package from the back office to Our since that would require a different endpoint. 2017-04-26 19:02:36 +10:00
Stephan ba489afe9a Publicize more IBackgroundTask plumbing 2017-04-26 09:07:48 +02:00
Shannon 968d52e490 Removes old packager files that should absolutely never be used 2017-04-26 15:46:07 +10:00
Shannon ebbe9f6ed0 Removes old packager files that should absolutely never be used 2017-04-26 15:45:37 +10:00
Shannon ba32636fe7 Merge remote-tracking branch 'origin/dev-v7' into temp-CON-1267 2017-04-26 14:18:27 +10:00
Shannon a6f9d14a1b Merge remote-tracking branch 'origin/dev-v7.6' into temp-CON-1267 2017-04-26 14:18:05 +10:00
Shannon 7cd385dd6b disables ssl by default 2017-04-26 14:17:24 +10:00
Shannon 5d4a97591a Cherry picks changes for package fetching for Our to use the new endpoint and passes in the current version 2017-04-26 14:08:37 +10:00
Shannon bfb81f6362 Allows for the umb pckage repo rest api endpoint to be configurable - for testing 2017-04-26 14:04:47 +10:00
Warren Buckley ca3dc030bc Merge pull request #1893 from umbraco/temp-u4-9764
U4-9764 - add FirstChild with predicate extension
2017-04-25 11:37:37 +01:00
mikkelhm 4775aff749 Bump version to RC2 2017-04-25 11:15:51 +02:00
Warren Buckley 9d20ee293b Merge pull request #1889 from umbraco/temp-U4-9758
U4-9758 New index can't be applied when CmsMember table has very long login names
2017-04-25 10:01:35 +01:00
Warren Buckley a9b820de31 Merge branch 'dev-v7.6' into temp-U4-9758 2017-04-25 09:58:20 +01:00
Stephan 3813653852 deploy-293 - only if not already 7.6 2017-04-25 10:46:37 +02:00
Warren Buckley a4720a2221 Adds null check - So that we still add the index if we don't have any member entries as of yet 2017-04-25 09:13:48 +01:00
Warren Buckley 728b71c4bd Merge pull request #1902 from umbraco/temp-deploy-293
temp-deploy-293
2017-04-24 16:08:01 +01:00
Stephan 9d7975d970 deploy-293 - fix 2017-04-24 16:52:31 +02:00
Emil Wangaa 7505401511 Merge pull request #1896 from umbraco/temp-U4-9760
U4-9760 - Master Templates & Tree Bug
2017-04-24 16:04:00 +02:00
Warren Buckley 7ee0a278f7 Adss null check 2017-04-24 14:57:57 +01:00
Stephan 1adbe9ddcb deploy-293 - normalize template guids on upgrade to 7.6 2017-04-24 15:52:44 +02:00
Tom Pipe 67e3ec2ae0 Quick/simple fix for the stale variable
The umbracoContext variable can hold a null reference to UmbracoContext.Current. 

If a request containing a file extension is passed through an UmbracoVirtualNodeRouteHandler, the UmbracoContext will be null, because a context is never created for urls containing extensions due to https://github.com/umbraco/Umbraco-CMS/blob/5397f2c53acbdeb0805e1fe39fda938f571d295a/src/Umbraco.Core/UriExtensions.cs#L143

A call can be made to EnsureContext in the overridden FindContent method, but the fresh context would never get picked up, instead the variable always contains a null reference, and an exception is then thrown on line 23
2017-04-24 13:23:12 +01:00
Warren Buckley d6272b0cdb Merge branch 'temp-U4-9760' of https://github.com/umbraco/Umbraco-CMS into temp-U4-9760 2017-04-24 13:19:36 +01:00
Warren Buckley ce7dd19a8f Updates the template controller save method - to take into account if the master you are updating to is a sub master that has children that there path's need updating too 2017-04-24 13:19:30 +01:00
Shannon d295174e53 Updates JS to include the current umbraco version when requesting a package's details, updates the c# to use a new endpoint on OUR to ensure that the correct file is downloaded based on the umb version passed in. 2017-04-24 21:31:35 +10:00
Mads Rasmussen 55022e2aaf fix removeNode check to only be for the root node 2017-04-24 12:46:45 +02:00
Warren Buckley 4ffca2e4bf Merge pull request #1900 from umbraco/temp-deploy-103
deploy-103 - fix PublicAccessRepository
2017-04-24 09:53:52 +01:00
Stephan 4a38b8acd1 Fix broken refs to some libs 2017-04-24 10:50:25 +02:00
Stephan d93b8b869e deploy-103 - fix PublicAccessRepository 2017-04-21 16:02:29 +02:00
Shannon Deminick da8c46e426 Merge pull request #1859 from alexxn/dev-v7
Add basic xss prevention logic
2017-04-21 13:05:40 +10:00
Warren Buckley c34a1060f7 When we create a brand new template & set a master template we were removing the entire tree for templates - this adds in a check to not do the remove of the old node if its a brand new template we are creating 2017-04-20 15:49:49 +01:00
Stephan 5880df3859 U4-9764 - add FirstChild with predicate extension 2017-04-19 18:56:12 +02:00
Shannon 13cfb42287 Resizes LoginName column so that it can be indexed but only if the data in the column doesn't exceed a max size 2017-04-19 20:16:43 +10:00
Alex Novgorodov de9739118e Add basic xss prevention logic 2017-04-04 18:11:48 +03:00
80 changed files with 787 additions and 3378 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
# Usage: on line 2 put the release version, on line 3 put the version comment (example: beta)
7.6.0
RC1
RC3
+1 -1
View File
@@ -12,4 +12,4 @@ using System.Resources;
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("7.6.0")]
[assembly: AssemblyInformationalVersion("7.6.0-RC1")]
[assembly: AssemblyInformationalVersion("7.6.0-RC3")]
@@ -8,6 +8,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
Guid Id { get; }
string RepositoryUrl { get; }
string WebServiceUrl { get; }
bool HasCustomWebServiceUrl { get; }
bool HasCustomWebServiceUrl { get; }
string RestApiUrl { get; }
}
}
@@ -0,0 +1,19 @@
using System;
using System.Linq;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public static class RepositoryConfigExtensions
{
//Our package repo
private static readonly Guid RepoGuid = new Guid("65194810-1f85-11dd-bd0b-0800200c9a66");
public static IRepository GetDefault(this IRepositoriesSection repos)
{
var found = repos.Repositories.FirstOrDefault(x => x.Id == RepoGuid);
if (found == null)
throw new InvalidOperationException("No default package repository found with id " + RepoGuid);
return found;
}
}
}
@@ -38,9 +38,16 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
get
{
var prop = Properties["webserviceurl"];
var repoUrl = this[prop] as ConfigurationElement;
return (repoUrl != null && repoUrl.ElementInformation.IsPresent);
return (string) prop.DefaultValue != (string) this[prop];
}
}
[ConfigurationProperty("restapiurl", DefaultValue = "https://our.umbraco.org/webapi/packages/v1")]
public string RestApiUrl
{
get { return (string)base["restapiurl"]; }
set { base["restapiurl"] = value; }
}
}
}
@@ -24,7 +24,7 @@ namespace Umbraco.Core.Configuration
/// Gets the version comment (like beta or RC).
/// </summary>
/// <value>The version comment.</value>
public static string CurrentComment { get { return "RC1"; } }
public static string CurrentComment { get { return "RC3"; } }
// Get the version of the umbraco.dll by looking at a class in that dll
// Had to do it like this due to medium trust issues, see: http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx
@@ -5,8 +5,10 @@ using System.Linq;
namespace Umbraco.Core.Events
{
/// <summary>
/// This event manager supports event cancellation and will raise the events as soon as they are tracked, it does not store tracked events
/// An IEventDispatcher that immediately raise all events.
/// </summary>
/// <remarks>This means that events will be raised during the scope transaction,
/// whatever happens, and the transaction could roll back in the end.</remarks>
internal class PassThroughEventDispatcher : IEventDispatcher
{
public bool DispatchCancelable(EventHandler eventHandler, object sender, CancellableEventArgs args, string eventName = null)
@@ -3,11 +3,9 @@ using Umbraco.Core.IO;
namespace Umbraco.Core.Events
{
/// <summary>
/// This event manager is created for each scope and is aware of if it is nested in an outer scope
/// An IEventDispatcher that queues events, and raise them when the scope
/// exits and has been completed.
/// </summary>
/// <remarks>
/// The outer scope is the only scope that can raise events, the inner scope's will defer to the outer scope
/// </remarks>
internal class ScopeEventDispatcher : ScopeEventDispatcherBase
{
public ScopeEventDispatcher()
@@ -4,6 +4,15 @@ using System.Linq;
namespace Umbraco.Core.Events
{
/// <summary>
/// An IEventDispatcher that queues events.
/// </summary>
/// <remarks>
/// <para>Can raise, or ignore, cancelable events, depending on option.</para>
/// <para>Implementations must override ScopeExitCompleted to define what
/// to do with the events when the scope exits and has been completed.</para>
/// <para>If the scope exits without being completed, events are ignored.</para>
/// </remarks>
public abstract class ScopeEventDispatcherBase : IEventDispatcher
{
private List<IEventDefinition> _events;
@@ -0,0 +1,12 @@
using System;
namespace Umbraco.Core.Exceptions
{
internal class ConnectionException : Exception
{
public ConnectionException(string message, Exception innerException) : base(message, innerException)
{
}
}
}
@@ -7,7 +7,7 @@ namespace Umbraco.Core.Exceptions
public T Operation { get; private set; }
public DataOperationException(T operation, string message)
:base(message)
: base(message)
{
Operation = operation;
}
+14 -3
View File
@@ -52,9 +52,20 @@ namespace Umbraco.Core.IO
try
{
Directory.Delete(dir, true);
dir = dir.Substring(0, dir.Length - _shadowPath.Length - 1);
if (Directory.EnumerateFileSystemEntries(dir).Any() == false)
Directory.Delete(dir, true);
// shadowPath make be path/to/dir, remove each
dir = dir.Replace("/", "\\");
var min = IOHelper.MapPath("~/App_Data/TEMP/ShadowFs").Length;
var pos = dir.LastIndexOf("\\", StringComparison.OrdinalIgnoreCase);
while (pos > min)
{
dir = dir.Substring(0, pos);
if (Directory.EnumerateFileSystemEntries(dir).Any() == false)
Directory.Delete(dir, true);
else
break;
pos = dir.LastIndexOf("\\", StringComparison.OrdinalIgnoreCase);
}
}
catch
{
@@ -1,4 +1,5 @@
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Column;
using System;
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Column;
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Expressions;
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Table;
using Umbraco.Core.Persistence.SqlSyntax;
@@ -25,6 +26,15 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter
return new AlterTableBuilder(_context, _databaseProviders, expression);
}
/// <summary>
/// The problem with this is that only under particular circumstances is the expression added to the context
/// so you wouldn't actually know if you are using it correctly or not and chances are you are not and therefore
/// the statement won't even execute whereas using the IAlterTableSyntax to modify a column is guaranteed to add
/// the expression to the context.
/// </summary>
/// <param name="columnName"></param>
/// <returns></returns>
[Obsolete("Use the IAlterTableSyntax to modify a column instead, this will be removed in future versions")]
public IAlterColumnSyntax Column(string columnName)
{
var expression = new AlterColumnExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax) {Column = {Name = columnName}};
@@ -1,11 +1,22 @@
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Column;
using System;
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Column;
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Table;
namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter
{
public interface IAlterSyntaxBuilder : IFluentSyntax
{
IAlterTableSyntax Table(string tableName);
IAlterTableSyntax Table(string tableName);
/// <summary>
/// The problem with this is that only under particular circumstances is the expression added to the context
/// so you wouldn't actually know if you are using it correctly or not and chances are you are not and therefore
/// the statement won't even execute whereas using the IAlterTableSyntax to modify a column is guaranteed to add
/// the expression to the context.
/// </summary>
/// <param name="columnName"></param>
/// <returns></returns>
[Obsolete("Use the IAlterTableSyntax to modify a column instead, this will be removed in future versions")]
IAlterColumnSyntax Column(string columnName);
}
}
@@ -4,7 +4,7 @@ using Umbraco.Core.Persistence.SqlSyntax;
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSixZero
{
[Migration("7.6.0", 0, Constants.System.UmbracoMigrationName)]
[Migration("7.6.0", 3, Constants.System.UmbracoMigrationName)]
public class AddIndexToCmsMemberLoginName : MigrationBase
{
public AddIndexToCmsMemberLoginName(ISqlSyntaxProvider sqlSyntax, ILogger logger)
@@ -12,18 +12,43 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSixZero
{ }
public override void Up()
{
var dbIndexes = SqlSyntax.GetDefinedIndexesDefinitions(Context.Database);
//make sure it doesn't already exist
if (dbIndexes.Any(x => x.IndexName.InvariantEquals("IX_cmsMember_LoginName")) == false)
{
Execute.Code(database =>
{
Create.Index("IX_cmsMember_LoginName").OnTable("cmsMember")
.OnColumn("LoginName")
.Ascending()
.WithOptions()
.NonClustered();
}
//Now we need to check if we can actually d6 this because we won't be able to if there's data in there that is too long
//http://issues.umbraco.org/issue/U4-9758
var colLen = (SqlSyntax is MySqlSyntaxProvider)
? database.ExecuteScalar<int?>("select max(LENGTH(LoginName)) from cmsMember")
: database.ExecuteScalar<int?>("select max(datalength(LoginName)) from cmsMember");
if (colLen < 900 == false && colLen != null)
{
return null;
}
var dbIndexes = SqlSyntax.GetDefinedIndexesDefinitions(Context.Database);
//make sure it doesn't already exist
if (dbIndexes.Any(x => x.IndexName.InvariantEquals("IX_cmsMember_LoginName")) == false)
{
var localContext = new LocalMigrationContext(Context.CurrentDatabaseProvider, database, SqlSyntax, Logger);
//we can apply the index
localContext.Create.Index("IX_cmsMember_LoginName").OnTable("cmsMember")
.OnColumn("LoginName")
.Ascending()
.WithOptions()
.NonClustered();
return localContext.GetSql();
}
return null;
});
}
public override void Down()
@@ -0,0 +1,50 @@
using System;
using System.Linq;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence.SqlSyntax;
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSixZero
{
[Migration("7.6.0", 0, Constants.System.UmbracoMigrationName)]
public class NormalizeTemplateGuids : MigrationBase
{
public NormalizeTemplateGuids(ISqlSyntaxProvider sqlSyntax, ILogger logger)
: base(sqlSyntax, logger)
{ }
public override void Up()
{
Execute.Code(UpdateTemplateGuids);
}
private static string UpdateTemplateGuids(Database database)
{
// we need this migration because ppl running pre-7.6 on Cloud and Courier have templates in different
// environments having different GUIDs (Courier does not sync template GUIDs) and we need to normalize
// these GUIDs so templates with the same alias on different environments have the same GUID.
// however, if already running a prerelease version of 7.6, we do NOT want to normalize the GUIDs as quite
// probably, we are already running Deploy and the GUIDs are OK. assuming noone is running a prerelease
// of 7.6 on Courier.
// so... testing if we already have a 7.6.0 version installed. not pretty but...?
//
var version = database.FirstOrDefault<string>("SELECT version FROM umbracoMigration WHERE name=@name ORDER BY version DESC", new { name = Constants.System.UmbracoMigrationName });
if (version != null && version.StartsWith("7.6.0")) return string.Empty;
var updates = database.Query<dynamic>(@"SELECT umbracoNode.id, cmsTemplate.alias FROM umbracoNode
JOIN cmsTemplate ON umbracoNode.id=cmsTemplate.nodeId
WHERE nodeObjectType = @guid", new { guid = Constants.ObjectTypes.TemplateTypeGuid})
.Select(template => Tuple.Create((int) template.id, ("template____" + (string) template.alias).ToGuid()))
.ToList();
foreach (var update in updates)
database.Execute("UPDATE umbracoNode set uniqueId=@guid WHERE id=@id", new { guid = update.Item2, id = update.Item1 });
return string.Empty;
}
public override void Down()
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,52 @@
using System.Linq;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence.SqlSyntax;
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSixZero
{
[Migration("7.6.0", 2, Constants.System.UmbracoMigrationName)]
public class ReduceLoginNameColumnsSize : MigrationBase
{
public ReduceLoginNameColumnsSize(ISqlSyntaxProvider sqlSyntax, ILogger logger)
: base(sqlSyntax, logger)
{ }
public override void Up()
{
//Now we need to check if we can actually d6 this because we won't be able to if there's data in there that is too long
//http://issues.umbraco.org/issue/U4-9758
Execute.Code(database =>
{
var dbIndexes = SqlSyntax.GetDefinedIndexesDefinitions(database);
var colLen = (SqlSyntax is MySqlSyntaxProvider)
? database.ExecuteScalar<int?>("select max(LENGTH(LoginName)) from cmsMember")
: database.ExecuteScalar<int?>("select max(datalength(LoginName)) from cmsMember");
if (colLen < 900 == false) return null;
var localContext = new LocalMigrationContext(Context.CurrentDatabaseProvider, database, SqlSyntax, Logger);
//if it exists we need to drop it first
if (dbIndexes.Any(x => x.IndexName.InvariantEquals("IX_cmsMember_LoginName")))
{
localContext.Delete.Index("IX_cmsMember_LoginName").OnTable("cmsMember");
}
//we can apply the col length change
localContext.Alter.Table("cmsMember")
.AlterColumn("LoginName")
.AsString(225)
.NotNullable();
return localContext.GetSql();
});
}
public override void Down()
{
}
}
}
@@ -29,7 +29,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZe
}).ToArray();
//must be non-nullable
Alter.Column("uniqueID").OnTable("umbracoNode").AsGuid().NotNullable();
Alter.Table("umbracoNode").AlterColumn("uniqueID").AsGuid().NotNullable();
//make sure it already exists
if (dbIndexes.Any(x => x.IndexName.InvariantEquals("IX_umbracoNodeUniqueID")))
@@ -132,6 +132,11 @@ namespace Umbraco.Core.Persistence.Repositories
Database.Update(dto);
foreach (var removedRule in entity.RemovedRules)
{
Database.Delete<AccessRuleDto>("WHERE id=@Id", new { Id = removedRule });
}
foreach (var rule in entity.Rules)
{
if (rule.HasIdentity)
@@ -157,10 +162,6 @@ namespace Umbraco.Core.Persistence.Repositories
rule.Id = rule.Key.GetHashCode();
}
}
foreach (var removedRule in entity.RemovedRules)
{
Database.Delete<AccessRuleDto>("WHERE id=@Id", new {Id = removedRule});
}
entity.ClearRemovedRules();
@@ -8,5 +8,6 @@ namespace Umbraco.Core.Persistence.UnitOfWork
IScope Scope { get; }
EventMessages Messages { get; }
IEventDispatcher Events { get; }
void Flush();
}
}
@@ -160,7 +160,33 @@ namespace Umbraco.Core.Persistence.UnitOfWork
_key = Guid.NewGuid();
}
public object Key
public void Flush()
{
if (_readOnly)
throw new NotSupportedException("This unit of work is read-only.");
while (_operations.Count > 0)
{
var operation = _operations.Dequeue();
switch (operation.Type)
{
case TransactionType.Insert:
operation.Repository.PersistNewItem(operation.Entity);
break;
case TransactionType.Delete:
operation.Repository.PersistDeletedItem(operation.Entity);
break;
case TransactionType.Update:
operation.Repository.PersistUpdatedItem(operation.Entity);
break;
}
}
_operations.Clear();
_key = Guid.NewGuid();
}
public object Key
{
get { return _key; }
}
+1
View File
@@ -465,6 +465,7 @@ namespace Umbraco.Core.Scoping
}
finally
{
// removes the ambient context (ambient scope already gone)
_scopeProvider.SetAmbient(null);
}
}
+41 -35
View File
@@ -1,16 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Umbraco.Core.Scoping
{
public class ScopeContext : IInstanceIdentifiable
{
private Dictionary<string, IEnlistedObject> _enlisted;
private bool _exiting;
public void ScopeExit(bool completed)
{
if (_enlisted == null)
return;
_exiting = true;
List<Exception> exceptions = null;
foreach (var enlisted in Enlisted.Values)
foreach (var enlisted in _enlisted.Values.OrderBy(x => x.Priority))
{
try
{
@@ -23,6 +30,7 @@ namespace Umbraco.Core.Scoping
exceptions.Add(e);
}
}
if (exceptions != null)
throw new AggregateException("Exceptions were thrown by listed actions.", exceptions);
}
@@ -42,73 +50,71 @@ namespace Umbraco.Core.Scoping
private interface IEnlistedObject
{
void Execute(bool completed);
int Priority { get; }
}
private class EnlistedObject<T> : IEnlistedObject
{
private readonly Action<bool, T> _action;
public EnlistedObject(T item)
{
Item = item;
}
public EnlistedObject(T item, Action<bool, T> action)
public EnlistedObject(T item, Action<bool, T> action, int priority)
{
Item = item;
Priority = priority;
_action = action;
}
public T Item { get; private set; }
public int Priority { get; private set; }
public void Execute(bool completed)
{
_action(completed, Item);
}
}
/// <inheritdoc />
// todo: replace with optional parameters when we can break things
public T Enlist<T>(string key, Func<T> creator)
{
IEnlistedObject enlisted;
if (Enlisted.TryGetValue(key, out enlisted))
{
var enlistedAs = enlisted as EnlistedObject<T>;
if (enlistedAs == null) throw new Exception("An item with a different type has already been enlisted with the same key.");
return enlistedAs.Item;
}
var enlistedOfT = new EnlistedObject<T>(creator());
Enlisted[key] = enlistedOfT;
return enlistedOfT.Item;
return Enlist(key, creator, null, 100);
}
/// <inheritdoc />
// todo: replace with optional parameters when we can break things
public T Enlist<T>(string key, Func<T> creator, Action<bool, T> action)
{
IEnlistedObject enlisted;
if (Enlisted.TryGetValue(key, out enlisted))
{
var enlistedAs = enlisted as EnlistedObject<T>;
if (enlistedAs == null) throw new Exception("An item with a different type has already been enlisted with the same key.");
return enlistedAs.Item;
}
var enlistedOfT = new EnlistedObject<T>(creator(), action);
Enlisted[key] = enlistedOfT;
return enlistedOfT.Item;
return Enlist(key, creator, action, 100);
}
/// <inheritdoc />
// todo: replace with optional parameters when we can break things
public void Enlist(string key, Action<bool> action)
{
Enlist<object>(key, null, (completed, item) => action(completed), 100);
}
public void Enlist(string key, Action<bool> action, int priority)
{
Enlist<object>(key, null, (completed, item) => action(completed), priority);
}
public T Enlist<T>(string key, Func<T> creator, Action<bool, T> action, int priority)
{
if (_exiting)
throw new InvalidOperationException("Cannot enlist now, context is exiting.");
var enlistedObjects = _enlisted ?? (_enlisted = new Dictionary<string, IEnlistedObject>());
IEnlistedObject enlisted;
if (Enlisted.TryGetValue(key, out enlisted))
if (enlistedObjects.TryGetValue(key, out enlisted))
{
var enlistedAs = enlisted as EnlistedObject<object>;
if (enlistedAs == null) throw new Exception("An item with a different type has already been enlisted with the same key.");
return;
var enlistedAs = enlisted as EnlistedObject<T>;
if (enlistedAs == null) throw new InvalidOperationException("An item with the key already exists, but with a different type.");
if (enlistedAs.Priority != priority) throw new InvalidOperationException("An item with the key already exits, but with a different priority.");
return enlistedAs.Item;
}
var enlistedOfT = new EnlistedObject<object>(null, (completed, item) => action(completed));
var enlistedOfT = new EnlistedObject<T>(creator == null ? default(T) : creator(), action, priority);
Enlisted[key] = enlistedOfT;
return enlistedOfT.Item;
}
}
}
+5 -29
View File
@@ -124,35 +124,11 @@ namespace Umbraco.Core.Services
private static Guid GetNodeObjectTypeGuid(UmbracoObjectTypes umbracoObjectType)
{
switch (umbracoObjectType)
{
case UmbracoObjectTypes.Document:
return Constants.ObjectTypes.DocumentGuid;
case UmbracoObjectTypes.MemberType:
return Constants.ObjectTypes.MemberTypeGuid;
case UmbracoObjectTypes.Media:
return Constants.ObjectTypes.MediaGuid;
case UmbracoObjectTypes.Template:
return Constants.ObjectTypes.TemplateTypeGuid;
case UmbracoObjectTypes.MediaType:
return Constants.ObjectTypes.MediaTypeGuid;
case UmbracoObjectTypes.DocumentType:
return Constants.ObjectTypes.DocumentTypeGuid;
case UmbracoObjectTypes.Member:
return Constants.ObjectTypes.MemberGuid;
case UmbracoObjectTypes.DataType:
return Constants.ObjectTypes.DataTypeGuid;
case UmbracoObjectTypes.MemberGroup:
return Constants.ObjectTypes.MemberGroupGuid;
case UmbracoObjectTypes.RecycleBin:
case UmbracoObjectTypes.Stylesheet:
case UmbracoObjectTypes.ContentItem:
case UmbracoObjectTypes.ContentItemType:
case UmbracoObjectTypes.ROOT:
case UmbracoObjectTypes.Unknown:
default:
throw new NotSupportedException("Unsupported object type (" + umbracoObjectType + ").");
}
var guid = umbracoObjectType.GetGuid();
if (guid == Guid.Empty)
throw new NotSupportedException("Unsupported object type (" + umbracoObjectType + ").");
return guid;
}
public IUmbracoEntity GetByKey(Guid key, bool loadBaseType = true)
+11 -1
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Xml.Linq;
using Umbraco.Core.Models;
@@ -6,6 +7,15 @@ namespace Umbraco.Core.Services
{
public interface IPackagingService : IService
{
/// <summary>
/// This will fetch an Umbraco package file from the package repository and return the relative file path to the downloaded package file
/// </summary>
/// <param name="packageId"></param>
/// <param name="umbracoVersion"></param>
/// <param name="userId">The current user id performing the operation</param>
/// <returns></returns>
string FetchPackageFile(Guid packageId, Version umbracoVersion, int userId);
/// <summary>
/// Imports and saves package xml as <see cref="IContent"/>
/// </summary>
@@ -1,15 +1,20 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI.WebControls;
using System.Xml.Linq;
using System.Xml.XPath;
using Newtonsoft.Json;
using Umbraco.Core.Auditing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Events;
using Umbraco.Core.Exceptions;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
@@ -75,6 +80,61 @@ namespace Umbraco.Core.Services
_importedContentTypes = new Dictionary<string, IContentType>();
}
/// <summary>
/// This will fetch an Umbraco package file from the package repository and return the relative file path to the downloaded package file
/// </summary>
/// <param name="packageId"></param>
/// <param name="umbracoVersion"></param>
/// /// <param name="userId">The current user id performing the operation</param>
/// <returns></returns>
public string FetchPackageFile(Guid packageId, Version umbracoVersion, int userId)
{
var packageRepo = UmbracoConfig.For.UmbracoSettings().PackageRepositories.GetDefault();
using (var httpClient = new HttpClient())
using (var uow = _uowProvider.GetUnitOfWork())
{
//includeHidden = true because we don't care if it's hidden we want to get the file regardless
var url = string.Format("{0}/{1}?version={2}&includeHidden=true&asFile=true", packageRepo.RestApiUrl, packageId, umbracoVersion.ToString(3));
byte[] bytes;
try
{
bytes = httpClient.GetByteArrayAsync(url).GetAwaiter().GetResult();
}
catch (HttpRequestException ex)
{
throw new ConnectionException("An error occuring downloading the package from " + url, ex);
}
//successfull
if (bytes.Length > 0)
{
var packagePath = IOHelper.MapPath(SystemDirectories.Packages);
// Check for package directory
if (Directory.Exists(packagePath) == false)
Directory.CreateDirectory(packagePath);
var packageFilePath = Path.Combine(packagePath, packageId + ".umb");
using (var fs1 = new FileStream(packageFilePath, FileMode.Create))
{
fs1.Write(bytes, 0, bytes.Length);
return "packages\\" + packageId + ".umb";
}
}
Audit(uow, AuditType.PackagerInstall, string.Format("Package {0} fetched from {1}", packageId, packageRepo.Id), userId, -1);
return null;
}
}
private void Audit(IScopeUnitOfWork uow, AuditType type, string message, int userId, int objectId)
{
var auditRepo = _repositoryFactory.CreateAuditRepository(uow);
auditRepo.AddOrUpdate(new AuditItem(objectId, message, type, userId));
}
#region Content
/// <summary>
+4
View File
@@ -292,6 +292,7 @@
<Compile Include="Configuration\UmbracoSettings\RazorStaticMappingElement.cs" />
<Compile Include="Configuration\UmbracoSettings\RepositoriesCollection.cs" />
<Compile Include="Configuration\UmbracoSettings\RepositoriesElement.cs" />
<Compile Include="Configuration\UmbracoSettings\RepositoryConfigExtensions.cs" />
<Compile Include="Configuration\UmbracoSettings\RepositoryElement.cs" />
<Compile Include="Configuration\UmbracoSettings\RequestHandlerElement.cs" />
<Compile Include="Configuration\UmbracoSettings\ScheduledTaskElement.cs" />
@@ -338,6 +339,7 @@
<Compile Include="Events\IDeletingMediaFilesEventArgs.cs" />
<Compile Include="Events\ScopeEventDispatcherBase.cs" />
<Compile Include="Events\ScopeLifespanMessagesFactory.cs" />
<Compile Include="Exceptions\ConnectionException.cs" />
<Compile Include="IHttpContextAccessor.cs" />
<Compile Include="Models\PublishedContent\PublishedContentTypeConverter.cs" />
<Compile Include="OrderedHashSet.cs" />
@@ -514,6 +516,8 @@
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenSixZero\AddIndexToUser2NodePermission.cs" />
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenSixZero\AddRelationTypeUniqueIdColumn.cs" />
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenSixZero\AddMacroUniqueIdColumn.cs" />
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenSixZero\ReduceLoginNameColumnsSize.cs" />
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenSixZero\NormalizeTemplateGuids.cs" />
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenSixZero\RemovePropertyDataIdIndex.cs" />
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenSixZero\RemoveUmbracoDeployTables.cs" />
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenThreeTwo\EnsureMigrationsTableIdentityIsCorrect.cs" />
+39 -1
View File
@@ -591,7 +591,7 @@ namespace Umbraco.Tests.Scoping
Assert.IsNull(scopeProvider.AmbientContext);
// back to original thread
ScopeProvider.HttpContextItemsGetter = () => httpContextItems;
ScopeProvider.HttpContextItemsGetter = () => httpContextItems;
}
Assert.IsNotNull(scopeProvider.AmbientScope);
Assert.AreSame(scope, scopeProvider.AmbientScope);
@@ -656,6 +656,44 @@ namespace Umbraco.Tests.Scoping
Assert.IsNotNull(ambientContext); // the context is still there
}
[TestCase(true)]
[TestCase(false)]
public void ScopeContextEnlistAgain(bool complete)
{
var scopeProvider = DatabaseContext.ScopeProvider;
bool? completed = null;
Exception exception = null;
Assert.IsNull(scopeProvider.AmbientScope);
using (var scope = scopeProvider.CreateScope())
{
scopeProvider.Context.Enlist("name", c =>
{
completed = c;
// at that point the scope is gone, but the context is still there
var ambientContext = scopeProvider.AmbientContext;
try
{
ambientContext.Enlist("another", c2 => { });
}
catch (Exception e)
{
exception = e;
}
});
if (complete)
scope.Complete();
}
Assert.IsNull(scopeProvider.AmbientScope);
Assert.IsNull(scopeProvider.AmbientContext);
Assert.IsNotNull(completed);
Assert.IsNotNull(exception);
Assert.IsInstanceOf<InvalidOperationException>(exception);
}
[Test]
public void ScopeContextException()
{
@@ -5,15 +5,14 @@
**/
function ourPackageRepositoryResource($q, $http, umbDataFormatter, umbRequestHelper) {
//var baseurl = "http://localhost:24292/webapi/packages/v1";
var baseurl = "https://our.umbraco.org/webapi/packages/v1";
var baseurl = Umbraco.Sys.ServerVariables.umbracoUrls.packagesRestApiBaseUrl;
return {
getDetails: function (packageId) {
return umbRequestHelper.resourcePromise(
$http.get(baseurl + "/" + packageId),
$http.get(baseurl + "/" + packageId + "?version=" + Umbraco.Sys.ServerVariables.application.version),
'Failed to get package details');
},
@@ -60,10 +60,13 @@
// sync tree
// if master template alias has changed move the node to it's new location
if(oldMasterTemplateAlias !== vm.template.masterTemplateAlias) {
// move node to new location in tree
//first we need to remove the node that we're working on
treeService.removeNode(vm.page.menu.currentNode);
// When creating a new template the id is -1. Make sure We don't remove the root node.
if (vm.page.menu.currentNode.id !== "-1") {
// move node to new location in tree
//first we need to remove the node that we're working on
treeService.removeNode(vm.page.menu.currentNode);
}
// update stored alias to the new one so the node won't move again unless the alias is changed again
oldMasterTemplateAlias = vm.template.masterTemplateAlias;
+7 -27
View File
@@ -40,7 +40,8 @@
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile />
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort>44319</IISExpressSSLPort>
<IISExpressSSLPort>
</IISExpressSSLPort>
<IISExpressAnonymousAuthentication>enabled</IISExpressAnonymousAuthentication>
<IISExpressWindowsAuthentication>disabled</IISExpressWindowsAuthentication>
<IISExpressUseClassicPipelineMode>false</IISExpressUseClassicPipelineMode>
@@ -206,8 +207,8 @@
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Collections.Immutable, Version=1.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
<Reference Include="System.Collections.Immutable, Version=1.1.36.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.configuration" />
@@ -239,8 +240,8 @@
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="System.Reflection.Metadata, Version=1.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.Metadata.1.4.2\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
<Reference Include="System.Reflection.Metadata, Version=1.0.21.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.Metadata.1.0.21\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
@@ -348,13 +349,6 @@
<Compile Include="..\SolutionInfo.cs">
<Link>Properties\SolutionInfo.cs</Link>
</Compile>
<Compile Include="Umbraco\Install\Legacy\LoadStarterKits.ascx.cs">
<DependentUpon>loadStarterKits.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Umbraco\Install\Legacy\LoadStarterKits.ascx.designer.cs">
<DependentUpon>loadStarterKits.ascx</DependentUpon>
</Compile>
<Compile Include="Config\splashes\NoNodes.aspx.cs">
<DependentUpon>noNodes.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -453,13 +447,6 @@
<Compile Include="Umbraco\Developer\Packages\DirectoryBrowser.aspx.designer.cs">
<DependentUpon>directoryBrowser.aspx</DependentUpon>
</Compile>
<Compile Include="Umbraco\Developer\Packages\StarterKits.aspx.cs">
<DependentUpon>StarterKits.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Umbraco\Developer\Packages\StarterKits.aspx.designer.cs">
<DependentUpon>StarterKits.aspx</DependentUpon>
</Compile>
<Compile Include="Umbraco\Developer\Python\EditPython.aspx.cs">
<DependentUpon>editPython.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -579,9 +566,9 @@
<Content Include="Config\Lang\sv-SE.user.xml" />
<Content Include="Config\Lang\zh-CN.user.xml" />
<Content Include="Umbraco\Config\Lang\cs.xml" />
<Content Include="Umbraco\Install\Legacy\loadStarterKits.ascx" />
<Content Include="Umbraco\ClientRedirect.aspx" />
<Content Include="Umbraco\create.aspx" />
<Content Include="Umbraco\Developer\Packages\installer.aspx" />
<Content Include="Umbraco\Logout.aspx" />
<Content Include="Umbraco\umbraco.aspx" />
<Content Include="Umbraco_Client\Application\JQuery\jquery.unobtrusive-ajax.min.js" />
@@ -1546,7 +1533,6 @@
<Content Include="Umbraco_Client\Installer\Js\jquery.ui.selectmenu.js" />
<Content Include="Umbraco\Config\Lang\ko.xml" />
<Content Include="Umbraco\Dashboard\FeedProxy.aspx" />
<Content Include="Umbraco\Developer\Packages\StarterKits.aspx" />
<Content Include="Umbraco\helpRedirect.aspx" />
<Content Include="Umbraco\Images\aboutNew.png" />
<Content Include="Umbraco\Images\Editor\skin.gif" />
@@ -1716,7 +1702,6 @@
<Content Include="Umbraco_Client\Tree\Themes\Umbraco\li.gif" />
<Content Include="Umbraco_Client\Tree\Themes\Umbraco\style.css" />
<Content Include="Umbraco_Client\Tree\Themes\Umbraco\throbber.gif" />
<Content Include="Umbraco\Developer\Packages\proxy.htm" />
<Content Include="Umbraco\Developer\Xslt\xsltVisualize.aspx" />
<Content Include="Umbraco\Dialogs\empty.htm" />
<Content Include="Umbraco\Dialogs\insertMasterpageContent.aspx" />
@@ -1783,12 +1768,8 @@
<Content Include="Umbraco\Images\Umbraco\repository.gif" />
<Content Include="Umbraco\Images\Umbraco\uploadpackage.gif" />
<Content Include="Umbraco_Client\Application\JQuery\jquery.autocomplete.js" />
<Content Include="Umbraco\Developer\Packages\BrowseRepository.aspx" />
<Content Include="Umbraco\Developer\Packages\directoryBrowser.aspx" />
<Content Include="Umbraco\Developer\Packages\editPackage.aspx" />
<Content Include="Umbraco\Developer\Packages\installedPackage.aspx" />
<Content Include="Umbraco\Developer\Packages\LoadNitros.ascx" />
<Content Include="Umbraco\Developer\Packages\SubmitPackage.aspx" />
<Content Include="Umbraco\Dialogs\about.aspx" />
<Content Include="Umbraco\Dialogs\AssignDomain.aspx" />
<Content Include="Umbraco\Dialogs\create.aspx" />
@@ -1801,7 +1782,6 @@
<Content Include="Umbraco\Dialogs\insertTable.aspx" />
<Content Include="Umbraco\Dialogs\moveOrCopy.aspx" />
<Content Include="Umbraco\Dialogs\notifications.aspx" />
<Content Include="Umbraco\Developer\Packages\installer.aspx" />
<Content Include="Umbraco\Dialogs\protectPage.aspx" />
<Content Include="Umbraco\Dialogs\publish.aspx" />
<Content Include="Umbraco\Dialogs\RegexWs.aspx" />
+2 -2
View File
@@ -35,7 +35,7 @@
<package id="Owin" version="1.0" targetFramework="net45" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net45" />
<package id="SqlServerCE" version="4.0.0.1" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.3.1" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.4.2" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.36" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.21" targetFramework="net45" />
<package id="Umbraco.ModelsBuilder" version="3.0.7" targetFramework="net45" />
</packages>
@@ -1,106 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.UI;
using Umbraco.Core.Logging;
using Umbraco.Web.Install;
namespace Umbraco.Web.UI.Install.Steps.Skinning
{
public delegate void StarterKitInstalledEventHandler();
public partial class LoadStarterKits : UserControl
{
/// <summary>
/// Returns the string for the package installer web service base url
/// </summary>
protected string PackageInstallServiceBaseUrl { get; private set; }
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
//Get the URL for the package install service base url
var umbracoPath = Core.Configuration.GlobalSettings.UmbracoMvcArea;
var urlHelper = new UrlHelper(Context.Request.RequestContext);
//PackageInstallServiceBaseUrl = urlHelper.Action("Index", "InstallPackage", new { area = "UmbracoInstall" });
PackageInstallServiceBaseUrl = urlHelper.GetUmbracoApiService("Index", "InstallPackage", "UmbracoInstall");
}
/// <summary>
/// Flag to show if we can connect to the repo or not
/// </summary>
protected bool CannotConnect { get; private set; }
public event StarterKitInstalledEventHandler StarterKitInstalled;
protected virtual void OnStarterKitInstalled()
{
StarterKitInstalled();
}
private readonly global::umbraco.cms.businesslogic.packager.repositories.Repository _repo;
private const string RepoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66";
public LoadStarterKits()
{
_repo = global::umbraco.cms.businesslogic.packager.repositories.Repository.getByGuid(RepoGuid);
}
protected void Page_Load(object sender, EventArgs e)
{
}
//protected void NextStep(object sender, EventArgs e)
//{
// var p = (Default)this.Page;
// //InstallHelper.RedirectToNextStep(Page, Request.GetItemAsString("installStep"));
//}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
if (_repo == null)
{
throw new InvalidOperationException("Could not find repository with id " + RepoGuid);
}
//clear progressbar cache
//InstallHelper.ClearProgress();
if (_repo.HasConnection())
{
try
{
var r = new org.umbraco.our.Repository();
rep_starterKits.DataSource = r.Modules();
rep_starterKits.DataBind();
}
catch (Exception ex)
{
LogHelper.Error<LoadStarterKits>("Cannot connect to package repository", ex);
CannotConnect = true;
}
}
else
{
CannotConnect = true;
}
}
protected void GotoLastStep(object sender, EventArgs e)
{
//InstallHelper.RedirectToLastStep(Page);
}
}
}
@@ -1,60 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Umbraco.Web.UI.Install.Steps.Skinning {
public partial class LoadStarterKits {
/// <summary>
/// pl_loadStarterKits control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder pl_loadStarterKits;
/// <summary>
/// JsInclude1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude1;
/// <summary>
/// rep_starterKits control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Repeater rep_starterKits;
/// <summary>
/// LinkButton1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton LinkButton1;
/// <summary>
/// LinkButton2 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton LinkButton2;
}
}
@@ -1,98 +0,0 @@
<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="LoadStarterKits.ascx.cs" Inherits="Umbraco.Web.UI.Install.Steps.Skinning.LoadStarterKits" %>
<%@ Import Namespace="Umbraco.Web.org.umbraco.our" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<asp:PlaceHolder ID="pl_loadStarterKits" runat="server">
<umb:JsInclude ID="JsInclude1" runat="server" FilePath="installer/js/PackageInstaller.js" PathNameAlias="UmbracoClient" />
<% if (!CannotConnect) { %>
<script type="text/javascript">
(function ($) {
$(document).ready(function () {
var installer = new Umbraco.Installer.PackageInstaller({
starterKits: $("a.selectStarterKit"),
baseUrl: "<%= PackageInstallServiceBaseUrl %>",
serverError: $("#serverError"),
connectionError: $("#connectionError"),
setProgress: updateProgressBar,
setStatusMessage: updateStatusMessage
});
installer.init();
});
})(jQuery);
</script>
<% } %>
<div id="starter-kit-progress" style="display: none;">
<h2>Installation in progress...</h2>
<div class="loader">
<div class="hold">
<div class="progress-bar">
</div>
<span class="progress-bar-value">0%</span>
</div>
<strong></strong>
</div>
</div>
<asp:Repeater ID="rep_starterKits" runat="server">
<headertemplate>
<ul class="thumbnails">
</headertemplate>
<itemtemplate>
<li class="span4 add-<%# ((Package)Container.DataItem).Text.Replace(" ","").ToLower() %>">
<div class="thumbnail" style="margin-right: 10px; height: 260px">
<img src="http://our.umbraco.org<%# ((Package)Container.DataItem).Thumbnail %>?width=170" alt="<%# ((Package)Container.DataItem).Text %>">
<h4><%# ((Package)Container.DataItem).Text %></h4>
<%# ((Package)Container.DataItem).Description %>
<a href="#" class="btn btn-success single-tab selectStarterKit" data-name="<%# ((Package)Container.DataItem).Text %>" title="Install <%# ((Package)Container.DataItem).Text %>" data-repoid="<%# ((Package)Container.DataItem).RepoGuid %>">
Install
</a>
</div>
</li>
</itemtemplate>
<footertemplate>
</ul>
<%--<asp:LinkButton runat="server" ID="declineStarterKits" CssClass="declineKit" OnClientClick="return confirm('Are you sure you do not want to install a starter kit?');" OnClick="NextStep">
No thanks, do not install a starterkit!
</asp:LinkButton>--%>
</footertemplate>
</asp:Repeater>
</asp:PlaceHolder>
<div id="connectionError" style="<%= CannotConnect ? "" : "display:none;" %>">
<div style="padding: 0 100px 13px 5px;">
<h2>Oops...the installer can't connect to the repository</h2>
Starter Kits could not be fetched from the repository as there was no connection - which can occur if you are using a proxy server or firewall with certain configurations,
or if you are not currently connected to the internet.
<br />
Click <strong>Continue</strong> to complete the installation then navigate to the Developer section of your Umbraco installation
where you will find the Starter Kits listed in the Packages tree.
</div>
<!-- btn box -->
<footer class="btn-box">
<div class="t">&nbsp;</div>
<asp:LinkButton ID="LinkButton1" class="btn-step btn btn-continue" runat="server" OnClick="GotoLastStep"><span>Continue</span></asp:LinkButton>
</footer>
</div>
<div id="serverError" style="display:none;">
<div style="padding: 0 100px 13px 5px;">
<h2>Oops...the installer encountered an error</h2>
<div class="error-message"></div>
</div>
<!-- btn box -->
<footer class="btn-box">
<div class="t">&nbsp;</div>
<asp:LinkButton ID="LinkButton2" class="btn-step btn btn-continue" runat="server" OnClick="GotoLastStep"><span>Continue</span></asp:LinkButton>
</footer>
</div>
@@ -1,20 +0,0 @@
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="../../masterpages/umbracoPage.Master" Title="Browse Repository" CodeBehind="BrowseRepository.aspx.cs" Inherits="umbraco.presentation.developer.packages.BrowseRepository" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<asp:Content ContentPlaceHolderID="body" runat="server">
<cc1:UmbracoPanel id="Panel1" Text="Browse package repository" runat="server" Width="612px" Height="600px" hasMenu="false">
<cc1:Feedback ID="fb" runat="server" />
<asp:Literal runat="server" ID="iframeGen" />
</cc1:UmbracoPanel>
</asp:Content>
<asp:Content ContentPlaceHolderID="footer" runat="server">
<script type="text/javascript">
jQuery(document).ready(function() {
var frame = jQuery("#repoFrame");
var win = jQuery(window);
frame.height(win.height() - frame.offset().top - 40);
frame.width(win.width() - 35);
});
</script>
</asp:Content>
@@ -1,32 +0,0 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LoadNitros.ascx.cs" Inherits="umbraco.presentation.developer.packages.LoadNitros" %>
<asp:Panel id="loadNitros" runat="server">
<div id="list1a">
<span id="editorCategories">
<a class="accordianOpener">
Editors picks
<small>Recommended by the umbraco core team</small>
</a>
<div style="display: block;" class="accordianContainer">
<asp:PlaceHolder ID="ph_recommendedHolder" runat="server" />
</div>
</span>
<span id="generatedCategories">
<asp:Repeater ID="rep_nitros" runat="server" OnItemDataBound="onCategoryDataBound">
<ItemTemplate>
<a class="accordianOpener generated">
<asp:Literal ID="lit_name" runat="server" />
<small><asp:Literal ID="lit_desc" runat="server"/></small>
</a>
<div class="accordianContainer generated">
<asp:PlaceHolder ID="ph_nitroHolder" runat="server" />
</div>
</ItemTemplate>
</asp:Repeater>
</span>
</div>
<asp:Button runat="server" CssClass="loadNitrosButton" id="bt_install" OnClick="installNitros" OnClientClick="InstallPackages(this,'loadingBar'); return true;" Text="Install selected modules" />
</asp:Panel>
@@ -1,86 +0,0 @@
<%@ Page Language="C#" AutoEventWireup="True" MasterPageFile="../../masterpages/umbracoPage.Master" Title="Install starter kit" CodeBehind="StarterKits.aspx.cs" Inherits="Umbraco.Web.UI.Umbraco.Developer.Packages.StarterKits" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<umb:JsInclude ID="JsInclude1" runat="server" FilePath="ui/jqueryui.js" PathNameAlias="UmbracoClient" />
<script type="text/javascript">
var percentComplete = 0;
jQuery(document).ready(function() {
//bind to button click events
jQuery("a.selectStarterKit").click(function() {
jQuery(".progress-status").siblings(".install-dialog").hide();
jQuery(".progress-status").show();
});
});
function updateProgressBar(percent) {
percentComplete = percent;
}
function updateStatusMessage(message, error) {
if (message != null && message != undefined) {
jQuery(".progress-status").text(message + " (" + percentComplete + "%)");
}
}
</script>
<style type="text/css">
.progress-status {
display: none;
}
.add-thanks
{
position:absolute;
left:-2500;
display:none !important;
}
.zoom-list li {float: left; margin: 15px; display: block; width: 180px;}
.btn-prev, .btn-next, .paging, .btn-preview, .faik-mask , .faik-mask-ie6
{
display:none;
}
.image {float: left; margin: 15px; display: block; width: 140px;}
.image .gal-drop{padding-top:10px;}
ul{list-style-type: none;}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="body" runat="server">
<cc1:UmbracoPanel id="Panel1" Text="Starter kit" runat="server" Width="612px" Height="600px" hasMenu="false">
<cc1:Feedback ID="fb" runat="server" />
<cc1:Pane id="StarterKitNotInstalled" Text="Install starter kit" runat="server">
<h3>Available starter kits</h3>
<p>You can choose from the following starter kits, each having specific functionality.</p>
<div class="progress-status">Please wait...</div>
<div id="connectionError"></div>
<div id="serverError"></div>
<div class="install-dialog">
<asp:PlaceHolder ID="ph_starterkits" runat="server"></asp:PlaceHolder>
</div>
</cc1:Pane>
<cc1:Pane id="installationCompleted" Text="Installation completed" runat="server" Visible="false">
<p>Installation completed succesfully</p>
</cc1:Pane>
<cc1:Pane id="InstallationDirectoryNotAvailable" Text="Unable to install" runat="server" Visible="false">
<p>We can not install starterkits when the install directory or package repository is not present.</p>
</cc1:Pane>
</cc1:UmbracoPanel>
</asp:Content>
@@ -1,85 +0,0 @@
using System;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Web.UI.Install.Steps.Skinning;
using Umbraco.Web.UI.Pages;
using System.IO;
using umbraco.cms.businesslogic.packager;
namespace Umbraco.Web.UI.Umbraco.Developer.Packages
{
public partial class StarterKits : UmbracoEnsuredPage
{
private const string RepoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66";
protected void Page_Load(object sender, EventArgs e)
{
//check if a starter kit is already isntalled
var installed = InstalledPackage.GetAllInstalledPackages();
if (installed.Count == 0)
{
ShowStarterKits();
return;
}
var repo = global::umbraco.cms.businesslogic.packager.repositories.Repository.getByGuid(RepoGuid);
if (repo.HasConnection())
{
try
{
var kits = repo.Webservice.StarterKits();
var kitIds = kits.Select(x => x.RepoGuid).ToArray();
//if a starter kit is already installed show finish
if (installed.Any(x => kitIds.Contains(Guid.Parse(x.Data.PackageGuid))))
{
StarterKitNotInstalled.Visible = false;
installationCompleted.Visible = true;
}
else
{
ShowStarterKits();
}
}
catch (Exception ex)
{
LogHelper.Error<StarterKits>("Cannot connect to package repository", ex);
InstallationDirectoryNotAvailable.Visible = true;
StarterKitNotInstalled.Visible = false;
}
}
else
{
InstallationDirectoryNotAvailable.Visible = true;
StarterKitNotInstalled.Visible = false;
}
}
private void ShowStarterKits()
{
if (Directory.Exists(Server.MapPath(GlobalSettings.Path.EnsureEndsWith('/') + "install/Legacy")) == false)
{
InstallationDirectoryNotAvailable.Visible = true;
StarterKitNotInstalled.Visible = false;
return;
}
var starterkitsctrl = (LoadStarterKits)LoadControl(GlobalSettings.Path.EnsureEndsWith('/') + "install/Legacy/loadStarterKits.ascx");
ph_starterkits.Controls.Add(starterkitsctrl);
StarterKitNotInstalled.Visible = true;
}
}
}
@@ -1,78 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Umbraco.Web.UI.Umbraco.Developer.Packages {
public partial class StarterKits {
/// <summary>
/// JsInclude1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude1;
/// <summary>
/// Panel1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.UmbracoPanel Panel1;
/// <summary>
/// fb control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Feedback fb;
/// <summary>
/// StarterKitNotInstalled control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane StarterKitNotInstalled;
/// <summary>
/// ph_starterkits control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder ph_starterkits;
/// <summary>
/// installationCompleted control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane installationCompleted;
/// <summary>
/// InstallationDirectoryNotAvailable control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane InstallationDirectoryNotAvailable;
}
}
@@ -1,113 +0,0 @@
<%@ Page Language="C#" Title="Submit package" MasterPageFile="../../masterpages/umbracoPage.Master" AutoEventWireup="true" CodeBehind="SubmitPackage.aspx.cs" Inherits="umbraco.presentation.developer.packages.SubmitPackage" %>
<%@ Register TagPrefix="cc2" Namespace="umbraco.uicontrols" Assembly="controls" %>
<asp:Content ContentPlaceHolderID="footer" runat="server">
<script type="text/javascript">
var tb_email = document.getElementById('<%= tb_email.ClientID %>');
if (tb_email.value != "") {
onRepoChange();
}
</script>
</asp:Content>
<asp:Content ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">
function onRepoChange() {
var dropdown = document.getElementById('<%= dd_repositories.ClientID %>');
var myindex = dropdown.selectedIndex
var SelValue = dropdown.options[myindex].value
var repoLogin = document.getElementById('<%= pl_repoLogin.ClientID %>');
if (SelValue != "") {
var publicRepoHelp = document.getElementById('<%= publicRepoHelp.ClientID %>');
var privateRepoHelp = document.getElementById('<%= privateRepoHelp.ClientID %>');
publicRepoHelp.style.display = 'none';
privateRepoHelp.style.display = 'none';
if (SelValue == "65194810-1f85-11dd-bd0b-0800200c9a66") {
publicRepoHelp.style.display = 'block';
} else {
privateRepoHelp.style.display = 'block';
}
repoLogin.style.display = 'block';
} else {
repoLogin.style.display = 'none';
}
}
</script>
</asp:Content>
<asp:Content ContentPlaceHolderID="body" runat="server">
<cc2:UmbracoPanel ID="Panel1" Text="Submit package to repository" runat="server" Width="496px" Height="584px">
<br />
<cc2:Feedback ID="fb_feedback" runat="server" />
<asp:PlaceHolder ID="feedbackControls" runat="server" Visible="false">
<br />
<p>
<button onclick="window.location.href = 'editpackage.aspx?id=<%= Request.QueryString["id"] %>'; return false;">Ok</button>
</p>
</asp:PlaceHolder>
<cc2:Pane ID="Pane2" runat="server" Text="Repository">
<asp:Panel ID="pl_repoChoose" runat="server">
<cc2:PropertyPanel runat="server">
<p>Choose the repository you want to submit the package to</p>
</cc2:PropertyPanel>
<cc2:PropertyPanel Text="Repository" runat="server">
<asp:DropDownList ID="dd_repositories" runat="server" />
</cc2:PropertyPanel>
</asp:Panel>
<asp:Panel id="pl_repoLogin" style="display: none;" runat="server">
<cc2:PropertyPanel ID="PropertyPanel1" runat="server">
<h3 style="margin-left: 0px; padding-top: 15px;">Please enter your credentials to authenticate your user.</h3>
<p runat="server" id="publicRepoHelp" style="display: none">If you do not have a user on the umbraco package repository, you can create one <a href="http://packages.umbraco.org/create-user" target="_blank">here</a>.</p>
<p runat="server" id="privateRepoHelp" style="display: none">If you do not have a user on this private repository, contact your repository administrator to gain access</p>
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="PropertyPanel2" runat="server" Text="Email">
<asp:TextBox ID="tb_email" runat="server" /> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="tb_email" runat="server" ErrorMessage="*" />
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="PropertyPanel3" runat="server" Text="Password">
<asp:TextBox TextMode="Password" ID="tb_password" runat="server" /> <asp:RequiredFieldValidator ControlToValidate="tb_password" runat="server" ErrorMessage="*" />
</cc2:PropertyPanel>
</asp:Panel>
</cc2:Pane>
<cc2:Pane ID="Pane1" runat="server" Text="Documentation (.pdf only)">
<cc2:PropertyPanel ID="PropertyPanel4" runat="server">
<p>Upload additional documentation for your package to help new users getting started with your package</p>
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="PropertyPanel5" runat="server" Text="Documentation file">
<asp:FileUpload ID="fu_doc" runat="server" />
<asp:RegularExpressionValidator ID="doc_regex" runat="server" ControlToValidate="fu_doc" ValidationExpression="(.*?)\.(pdf|PDF)$" ErrorMessage="Only .pdf files are accepted" />
</cc2:PropertyPanel>
</cc2:Pane>
<asp:PlaceHolder runat="server" ID="submitControls">
<br />
<div class="notice">
<p>By clicking "submit package" below you understand that your package will be submitted to a package repository and will in some cases be publicly available to download.</p>
<p><strong>Please notice: </strong> only packages with complete read-me, author information and install information gets considered for inclusion.</p>
<p>The package administrators group reservers the right to decline packages based on lack of documentation, poorly written readme and missing author information</p>
</div>
<p>
<asp:Button ID="bt_submit" runat="server" Text="Submit package" OnClick="submitPackage" /> &nbsp;<em><%= umbraco.ui.Text("or") %></em> &nbsp;<a href="editpackage.aspx?id=<%= Request.QueryString["id"] %>"><%= umbraco.ui.Text("cancel") %></a>
</p>
</asp:PlaceHolder>
</cc2:UmbracoPanel>
</asp:Content>
@@ -39,7 +39,6 @@
<asp:TextBox ID="iconUrl" runat="server" Width="230px" CssClass="guiInputText"></asp:TextBox>
</cc2:PropertyPanel>
<cc2:PropertyPanel runat="server" ID="pp_file" Text="Package file (.zip):">
<asp:Button ID="bt_submitButton" runat="server" Text="Submit to repository" Visible="false" />
<asp:Literal ID="packageUmbFile" runat="server" />
</cc2:PropertyPanel>
@@ -1,184 +0,0 @@
<%@ Page Language="C#" MasterPageFile="../../masterpages/umbracoPage.Master" AutoEventWireup="true" CodeBehind="installedPackage.aspx.cs" Inherits="umbraco.presentation.developer.packages.installedPackage" %>
<%@ Register TagPrefix="cc2" Namespace="umbraco.uicontrols" Assembly="controls" %>
<asp:Content ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">
function toggleDiv(id, gotoDiv) {
var div = document.getElementById(id);
if (div.style.display == "none")
div.style.display = "block";
else
div.style.display = "none";
}
function openDemo(link, id) {
UmbClientMgr.openModalWindow("http://packages.umbraco.org/viewPackageData.aspx?id=" + id, link.innerHTML, true, 750, 550)
}
</script>
<style type="text/css">
.propertyItemheader {
width: 250px;
}
</style>
</asp:Content>
<asp:Content ContentPlaceHolderID="body" runat="server">
<cc2:Tabview ID="Panel1" Text="Installed package" runat="server" Width="496px" Height="584px">
<cc2:Pane ID="pane_meta" runat="server" Text="Package meta data">
<cc2:PropertyPanel ID="pp_name" runat="server">
<asp:Literal ID="lt_packagename" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="pp_version" runat="server">
<asp:Literal ID="lt_packageVersion" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="pp_author" runat="server">
<asp:Literal ID="lt_packageAuthor" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="pp_documentation" Visible="false" runat="server">
<asp:HyperLink id="hl_docLink" Target="_blank" runat="server" />
<asp:LinkButton id="lb_demoLink" OnClientClick="" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="pp_repository" Visible="false" runat="server">
<asp:HyperLink id="hl_packageRepo" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="pp_readme" runat="server">
<div style="position: relative; background: #fff; padding: 3px; border: 1px solid #ccc; width: 400px; white-space: normal !Important; overflow: auto;">
<asp:Literal ID="lt_readme" runat="server" /></div>
</cc2:PropertyPanel>
</cc2:Pane>
<cc2:Pane ID="pane_versions" runat="server" Text="Package version history" Visible="false">
<cc2:PropertyPanel ID="pp_versions" runat="server">
<asp:Repeater ID="rptr_versions" runat="server">
<headertemplate><ul></headertemplate>
<itemtemplate><li><a href="#"><%# ((umbraco.cms.businesslogic.packager.InstalledPackage)Container.DataItem).Data.Name %></a></li></itemtemplate>
<footertemplate></ul></footertemplate>
</asp:Repeater>
</cc2:PropertyPanel>
</cc2:Pane>
<cc2:Pane ID="pane_upgrade" runat="server" Text="Upgrade package" Visible="false">
<cc2:PropertyPanel runat="server">
<p>
<%= umbraco.ui.Text("packager", "packageUpgradeText") %>
</p>
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="pp_upgradeInstruction" Text="Upgrade instructions" runat="server">
<p>
<asp:Literal ID="lt_upgradeReadme" runat="server" />
</p>
<p>
<asp:Button ID="bt_gotoUpgrade" Text="Download update from the repository" runat="server" UseSubmitBehavior="false" />
</p>
</cc2:PropertyPanel>
</cc2:Pane>
<cc2:Pane ID="pane_noItems" Visible="false" runat="server" Text="Uninstaller doesn't contain any items">
<div class="guiDialogNormal" style="margin: 10px">
<%= umbraco.ui.Text("packager", "packageNoItemsText") %>
<p>
<asp:Button ID="bt_deletePackage" OnClick="delPack" runat="server" Text="Remove uninstaller" />
</p>
</div>
</cc2:Pane>
<cc2:Pane ID="pane_uninstall" runat="server" Text="Uninstall items installed by this package">
<p>
<%= umbraco.ui.Text("packager", "packageUninstallText") %>
</p>
<cc2:PropertyPanel runat="server" Text="Document Types" ID="pp_docTypes">
<asp:CheckBoxList ID="documentTypes" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel runat="server" Text="Templates" ID="pp_templates">
<asp:CheckBoxList ID="templates" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel runat="server" Text="Stylesheets" ID="pp_css">
<asp:CheckBoxList ID="stylesheets" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel runat="server" Text="Macros" ID="pp_macros">
<asp:CheckBoxList ID="macros" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="pp_files" runat="server" Text="Files">
<asp:CheckBoxList ID="files" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="pp_di" runat="server" Text="Dictionary Items">
<asp:CheckBoxList ID="dictionaryItems" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="pp_dt" runat="server" Text="Data types">
<asp:CheckBoxList ID="dataTypes" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="pp_confirm" runat="server" Text="&nbsp;">
<asp:Button ID="bt_confirmUninstall" OnClick="confirmUnInstall" OnClientClick="$('#loadingbar').show()" Text="Confirm uninstall" CssClass="btn btn-primary" runat="server" />
<div id="loadingbar" style="display: none">
<div class="umb-loader-wrapper">
<cc2:ProgressBar ID="progbar" runat="server" Title="Please wait..." />
</div>
</div>
</cc2:PropertyPanel>
</cc2:Pane>
<cc2:Pane id="pane_uninstalled" runat="server" Visible="false">
<div class="alert alert-block">
Package uninstall in progress, please wait while the browser is reloaded...
</div>
<script type="text/javascript">
//This is all a bit zany with double encoding because we have a URL in a hash (#) url part
// but it works and maintains query strings
var umbPath = "<%=umbraco.GlobalSettings.Path%>";
setTimeout(function () {
var mainWindow = UmbClientMgr.mainWindow();
//kill the tree and template cache
if (mainWindow.UmbClientMgr) {
mainWindow.UmbClientMgr._packageInstalled();
}
var baseUrl = mainWindow.location.href.substr(0, mainWindow.location.href.indexOf("#/developer/framed/"));
var framedUrl = baseUrl + "#/developer/framed/";
var refreshUrl = framedUrl + encodeURIComponent(encodeURIComponent(umbPath + "/developer/packages/installer.aspx?installing=uninstalled"));
var redirectUrl = umbPath + "/ClientRedirect.aspx?redirectUrl=" + refreshUrl;
mainWindow.location.href = redirectUrl;
}, 2000);
</script>
</cc2:Pane>
</cc2:Tabview>
</asp:Content>
@@ -1,67 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Repo proxy</title>
</head>
<body>
<script type="text/javascript">
//This is a stupid way of parsing a uri
//https://gist.github.com/jlong/2428561
try {
var parser = document.createElement('a');
parser.href = window.location.search.substring(1);
// This next line may seem redundant but is required to get around a bug in IE
// that doesn't set the parser.hostname or parser.protocol correctly for relative URLs.
// see https://gist.github.com/jlong/2428561#gistcomment-1461205
parser.href = parser.href;
// => "http:"
if (parser.protocol && (parser.protocol.toLowerCase() != "http:" && parser.protocol.toLowerCase() != "https:")) {
throw "invalid protocol";
};
// => "example.com"
if (!parser.hostname || parser.hostname == "") {
throw "invalid hostname";
}
//parser.port; // => "3000"
// => "/pathname/"
if (!parser.pathname || ((parser.pathname.length - parser.pathname.toLowerCase().indexOf("/developer/packages/installer.aspx")) != "/developer/packages/installer.aspx".length))
{
throw "invalid pathname";
}
// => "?search=test"
if (!parser.search || parser.search.toLowerCase().indexOf("?repoguid") != 0) {
throw "invalid search";
}
// => "#hash"
if (parser.hash && parser.hash != "") {
throw "invalid hash";
}
//parser.host; // => "example.com:3000"
if (!top.right) {
throw "invalid document";
}
top.right.document.location = window.location.search.substring(1);
} catch (e) {
alert(e);
}
</script>
</body>
</html>
@@ -27,7 +27,7 @@
<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery("#<%=JTree.ClientID%>").PermissionsEditor({
userId: <%=Request.QueryString["id"] %>,
userId: <%=Request.CleanForXss("id") %>,
pPanelSelector: "#permissionsPanel",
replacePChkBoxSelector: "#chkChildPermissions"});
});
@@ -22,6 +22,7 @@ using Newtonsoft.Json.Linq;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Manifest;
@@ -224,6 +225,9 @@ namespace Umbraco.Web.Editors
{"gridConfig", Url.Action("GetGridConfig", "BackOffice")},
{"serverVarsJs", Url.Action("Application", "BackOffice")},
//API URLs
{
"packagesRestApiBaseUrl", UmbracoConfig.For.UmbracoSettings().PackageRepositories.GetDefault().RestApiUrl
},
{
"redirectUrlManagementApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl<RedirectUrlManagementController>(
controller => controller.GetEnableState())
@@ -58,17 +58,25 @@ namespace Umbraco.Web.Editors
[HttpPost]
public IHttpActionResult Uninstall(int packageId)
{
var pack = InstalledPackage.GetById(packageId);
if (pack == null) return NotFound();
PerformUninstall(pack);
//now get all other packages by this name since we'll uninstall all versions
foreach (var installed in InstalledPackage.GetAllInstalledPackages()
.Where(x => x.Data.Name == pack.Data.Name && x.Data.Id != pack.Data.Id))
try
{
//remove from teh xml
installed.Delete(Security.GetUserId());
var pack = InstalledPackage.GetById(packageId);
if (pack == null) return NotFound();
PerformUninstall(pack);
//now get all other packages by this name since we'll uninstall all versions
foreach (var installed in InstalledPackage.GetAllInstalledPackages()
.Where(x => x.Data.Name == pack.Data.Name && x.Data.Id != pack.Data.Id))
{
//remove from teh xml
installed.Delete(Security.GetUserId());
}
}
catch (Exception e)
{
Logger.Error<PackageInstallController>("Failed to uninstall.", e);
throw;
}
return Ok();
@@ -176,7 +184,7 @@ namespace Umbraco.Web.Editors
pack.Save();
// uninstall actions
//TODO: We should probably report errors to the UI!!
//TODO: We should probably report errors to the UI!!
// This never happened before though, but we should do something now
if (pack.Data.Actions.IsNullOrWhiteSpace() == false)
{
@@ -185,7 +193,7 @@ namespace Umbraco.Web.Editors
var actionsXml = new XmlDocument();
actionsXml.LoadXml("<Actions>" + pack.Data.Actions + "</Actions>");
LogHelper.Debug<installedPackage>("executing undo actions: {0}", () => actionsXml.OuterXml);
LogHelper.Debug<PackageInstallController>("executing undo actions: {0}", () => actionsXml.OuterXml);
foreach (XmlNode n in actionsXml.DocumentElement.SelectNodes("//Action"))
{
@@ -196,13 +204,13 @@ namespace Umbraco.Web.Editors
}
catch (Exception ex)
{
LogHelper.Error<installedPackage>("An error occurred running undo actions", ex);
LogHelper.Error<PackageInstallController>("An error occurred running undo actions", ex);
}
}
}
catch (Exception ex)
{
LogHelper.Error<installedPackage>("An error occurred running undo actions", ex);
LogHelper.Error<PackageInstallController>("An error occurred running undo actions", ex);
}
}
@@ -471,11 +479,7 @@ namespace Umbraco.Web.Editors
string path = Path.Combine("packages", packageGuid + ".umb");
if (File.Exists(IOHelper.MapPath(Path.Combine(SystemDirectories.Data, path))) == false)
{
//our repo guid
using (var our = Repository.getByGuid("65194810-1f85-11dd-bd0b-0800200c9a66"))
{
path = our.fetch(packageGuid, Security.CurrentUser.Id);
}
path = Services.PackagingService.FetchPackageFile(Guid.Parse(packageGuid), UmbracoVersion.Current, Security.GetUserId());
}
var model = new LocalPackageInstallModel
+28 -3
View File
@@ -105,8 +105,7 @@ namespace Umbraco.Web.Editors
{
throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
}
if (display.Id > 0)
{
// update
@@ -131,8 +130,34 @@ namespace Umbraco.Web.Editors
}else
{
template.SetMasterTemplate(master);
}
//After updating the master - ensure we update the path property if it has any children already assigned
var templateHasChildren = Services.FileService.GetTemplateDescendants(display.Id);
foreach (var childTemplate in templateHasChildren)
{
//template ID to find
var templateIdInPath = "," + display.Id + ",";
if (string.IsNullOrEmpty(childTemplate.Path))
{
continue;
}
//Find position in current comma seperate string path (so we get the correct children path)
var positionInPath = childTemplate.Path.IndexOf(templateIdInPath) + templateIdInPath.Length;
//Get the substring of the child & any children (descendants it may have too)
var childTemplatePath = childTemplate.Path.Substring(positionInPath);
//As we are updating the template to be a child of a master
//Set the path to the master's path + its current template id + the current child path substring
childTemplate.Path = master.Path + "," + display.Id + "," + childTemplatePath;
//Save the children with the updated path
Services.FileService.SaveTemplate(childTemplate);
}
}
}
else
{
@@ -8,6 +8,7 @@ using System.Web.Http;
using Newtonsoft.Json.Linq;
using umbraco;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Web.Install.Models;
using Umbraco.Web.WebApi;
@@ -57,23 +58,15 @@ namespace Umbraco.Web.Install.Controllers
/// <returns></returns>
[HttpPost]
public HttpResponseMessage DownloadPackageFiles(InstallPackageModel model)
{
var repo = global::umbraco.cms.businesslogic.packager.repositories.Repository.getByGuid(RepoGuid);
if (repo == null)
{
return Json(
new {success = false, error = "No repository found with id " + RepoGuid},
HttpStatusCode.OK);
}
if (repo.HasConnection() == false)
{
return Json(
new { success = false, error = "cannot_connect" },
HttpStatusCode.OK);
}
var installer = new global::umbraco.cms.businesslogic.packager.Installer(UmbracoContext.Current.Security.CurrentUser.Id);
{
var packageFile = _applicationContext.Services.PackagingService.FetchPackageFile(
model.KitGuid,
UmbracoVersion.Current,
UmbracoContext.Current.Security.CurrentUser.Id);
var tempFile = installer.Import(repo.fetch(model.KitGuid.ToString(), UmbracoContext.Current.Security.CurrentUser.Id));
var installer = new global::umbraco.cms.businesslogic.packager.Installer(UmbracoContext.Current.Security.CurrentUser.Id);
var tempFile = installer.Import(packageFile);
installer.LoadConfig(tempFile);
var pId = installer.CreateManifest(tempFile, model.KitGuid.ToString(), RepoGuid);
return Json(new
+1 -1
View File
@@ -50,7 +50,7 @@ namespace Umbraco.Web.Install
new DatabaseConfigureStep(_umbContext.Application),
new DatabaseInstallStep(_umbContext.Application),
new DatabaseUpgradeStep(_umbContext.Application),
new StarterKitDownloadStep(_umbContext.Application),
new StarterKitDownloadStep(_umbContext.Application, _umbContext.Security),
new StarterKitInstallStep(_umbContext.Application, _umbContext.HttpContext),
new StarterKitCleanupStep(_umbContext.Application),
new SetUmbracoVersionStep(_umbContext.Application, _umbContext.HttpContext),
@@ -4,7 +4,9 @@ using System.Linq;
using System.Web;
using umbraco.cms.businesslogic.packager;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Web.Install.Models;
using Umbraco.Web.Security;
namespace Umbraco.Web.Install.InstallSteps
{
@@ -13,10 +15,12 @@ namespace Umbraco.Web.Install.InstallSteps
internal class StarterKitDownloadStep : InstallSetupStep<Guid?>
{
private readonly ApplicationContext _applicationContext;
private readonly WebSecurity _security;
public StarterKitDownloadStep(ApplicationContext applicationContext)
public StarterKitDownloadStep(ApplicationContext applicationContext, WebSecurity security)
{
_applicationContext = applicationContext;
_security = security;
}
private const string RepoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66";
@@ -50,19 +54,13 @@ namespace Umbraco.Web.Install.InstallSteps
}
private Tuple<string, int> DownloadPackageFiles(Guid kitGuid)
{
var repo = global::umbraco.cms.businesslogic.packager.repositories.Repository.getByGuid(RepoGuid);
if (repo == null)
{
throw new InstallException("No repository found with id " + RepoGuid);
}
if (repo.HasConnection() == false)
{
throw new InstallException("Cannot connect to repository");
}
{
var installer = new Installer();
var tempFile = installer.Import(repo.fetch(kitGuid.ToString()));
//Go get the package file from the package repo
var packageFile = _applicationContext.Services.PackagingService.FetchPackageFile(kitGuid, UmbracoVersion.Current, _security.GetUserId());
var tempFile = installer.Import(packageFile);
installer.LoadConfig(tempFile);
var pId = installer.CreateManifest(tempFile, kitGuid.ToString(), RepoGuid);
@@ -13,10 +13,39 @@ namespace Umbraco.Web.Mvc
{
public abstract class UmbracoVirtualNodeRouteHandler : IRouteHandler
{
/// <summary>
/// Returns the UmbracoContext for this route handler
/// </summary>
/// <remarks>
/// By default this uses the UmbracoContext singleton, this could be overridden to check for null in the case
/// that this handler is used for a request where an UmbracoContext is not created by default see http://issues.umbraco.org/issue/U4-9384
/// <example>
/// <![CDATA[
/// protected override UmbracoContext GetUmbracoContext(RequestContext requestContext)
/// {
/// var ctx = base.GetUmbracoContext(requestContext);
/// //check if context is null, we know it will be null if we are dealing with a request that
/// //has an extension and by default no Umb ctx is created for the request
/// if (ctx == null) {
/// //TODO: Here you can EnsureContext , please note that the requestContext is passed in
/// //therefore your should refrain from using other singletons like HttpContext.Current since
/// //you will already have a reference to it. Also if you need an ApplicationContext you should
/// //pass this in via a ctor instead of using the ApplicationContext.Current singleton.
/// }
/// return ctx;
/// }
/// ]]>
/// </example>
/// </remarks>
protected virtual UmbracoContext GetUmbracoContext(RequestContext requestContext)
{
return UmbracoContext.Current;
}
public IHttpHandler GetHttpHandler(RequestContext requestContext)
{
var umbracoContext = UmbracoContext.Current;
var umbracoContext = GetUmbracoContext(requestContext);
var found = FindContent(requestContext, umbracoContext);
if (found == null) return new NotFoundHandler();
@@ -148,11 +148,6 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
}
}
public override Task RunAsync(CancellationToken token)
{
throw new NotImplementedException();
}
public override bool IsAsync
{
get { return false; }
+23 -17
View File
@@ -540,7 +540,7 @@ namespace Umbraco.Web
var filtered = dynamicDocumentList.Where<DynamicPublishedContent>(predicate);
return filtered.Count() == 1;
}
#endregion
#region AsDynamic
@@ -806,7 +806,7 @@ namespace Umbraco.Web
public static HtmlString IsOdd(this IPublishedContent content, string valueIfTrue, string valueIfFalse)
{
return new HtmlString(content.IsOdd() ? valueIfTrue : valueIfFalse);
}
}
#endregion
@@ -836,7 +836,7 @@ namespace Umbraco.Web
{
return content.IsNotEqual(other, valueIfTrue, string.Empty);
}
public static HtmlString IsNotEqual(this IPublishedContent content, IPublishedContent other, string valueIfTrue, string valueIfFalse)
{
return new HtmlString(content.IsNotEqual(other) ? valueIfTrue : valueIfFalse);
@@ -1125,7 +1125,7 @@ namespace Umbraco.Web
{
return content.Ancestors<T>(maxLevel).FirstOrDefault();
}
/// <summary>
/// Gets the content or its nearest ancestor.
/// </summary>
@@ -1186,7 +1186,7 @@ namespace Umbraco.Web
{
return content.AncestorsOrSelf<T>(maxLevel).FirstOrDefault();
}
internal static IEnumerable<IPublishedContent> AncestorsOrSelf(this IPublishedContent content, bool orSelf, Func<IPublishedContent, bool> func)
{
var ancestorsOrSelf = content.EnumerateAncestors(orSelf);
@@ -1237,7 +1237,7 @@ namespace Umbraco.Web
where T : class, IPublishedContent
{
return parentNodes.SelectMany(x => x.DescendantsOrSelf<T>());
}
}
// as per XPath 1.0 specs §2.2,
@@ -1285,7 +1285,7 @@ namespace Umbraco.Web
{
return content.Descendants(level).OfType<T>();
}
public static IEnumerable<IPublishedContent> DescendantsOrSelf(this IPublishedContent content)
{
return content.DescendantsOrSelf(true, null);
@@ -1366,7 +1366,7 @@ namespace Umbraco.Web
{
return content.DescendantOrSelf(level) as T;
}
internal static IEnumerable<IPublishedContent> DescendantsOrSelf(this IPublishedContent content, bool orSelf, Func<IPublishedContent, bool> func)
{
return content.EnumerateDescendants(orSelf).Where(x => func == null || func(x));
@@ -1390,7 +1390,7 @@ namespace Umbraco.Web
foreach (var child2 in child.EnumerateDescendants())
yield return child2;
}
#endregion
#region Axes: following-sibling, preceding-sibling, following, preceding + pseudo-axes up, down, next, previous
@@ -1413,8 +1413,8 @@ namespace Umbraco.Web
public static IPublishedContent Up(this IPublishedContent content, string contentTypeAlias)
{
return string.IsNullOrEmpty(contentTypeAlias)
? content.Parent
return string.IsNullOrEmpty(contentTypeAlias)
? content.Parent
: content.Ancestor(contentTypeAlias);
}
@@ -1799,13 +1799,19 @@ namespace Umbraco.Web
return content.Children<T>().FirstOrDefault();
}
/// <summary>
/// Gets the children of the content in a DataTable.
/// </summary>
public static IPublishedContent FirstChild<T>(this IPublishedContent content, Func<IPublishedContent, bool> predicate)
where T : class, IPublishedContent
{
return content.Children<T>().FirstOrDefault(predicate);
}
/// <summary>
/// Gets the children of the content in a DataTable.
/// </summary>
/// <param name="content">The content.</param>
/// <param name="contentTypeAliasFilter">An optional content type alias.</param>
/// <returns>The children of the content.</returns>
public static DataTable ChildrenAsTable(this IPublishedContent content, string contentTypeAliasFilter = "")
public static DataTable ChildrenAsTable(this IPublishedContent content, string contentTypeAliasFilter = "")
{
return GenerateDataTable(content, contentTypeAliasFilter);
}
@@ -1824,7 +1830,7 @@ namespace Umbraco.Web
: null
: content.Children.FirstOrDefault(x => x.DocumentTypeAlias == contentTypeAliasFilter);
if (firstNode == null)
return new DataTable(); //no children found
return new DataTable(); //no children found
//use new utility class to create table so that we don't have to maintain code in many places, just one
var dt = Core.DataTableExtensions.GenerateDataTable(
@@ -1964,7 +1970,7 @@ namespace Umbraco.Web
public static CultureInfo GetCulture(this IPublishedContent content, Uri current = null)
{
return Models.ContentExtensions.GetCulture(UmbracoContext.Current,
ApplicationContext.Current.Services.DomainService,
ApplicationContext.Current.Services.DomainService,
ApplicationContext.Current.Services.LocalizationService,
ApplicationContext.Current.Services.ContentService,
content.Id, content.Path,
@@ -8,7 +8,7 @@ namespace Umbraco.Web.Scheduling
/// </summary>
/// <typeparam name="T">The type of the managed tasks.</typeparam>
/// <remarks>The interface is not complete and exists only to have the contravariance on T.</remarks>
internal interface IBackgroundTaskRunner<in T> : IDisposable, IRegisteredObject
public interface IBackgroundTaskRunner<in T> : IDisposable, IRegisteredObject
where T : class, IBackgroundTask
{
bool IsCompleted { get; }
-10
View File
@@ -20,11 +20,6 @@ namespace Umbraco.Web.Scheduling
_appContext = appContext;
}
public override bool PerformRun()
{
throw new NotImplementedException();
}
public override async Task<bool> PerformRunAsync(CancellationToken token)
{
if (_appContext == null) return true; // repeat...
@@ -69,10 +64,5 @@ namespace Umbraco.Web.Scheduling
{
get { return true; }
}
public override bool RunsOnShutdown
{
get { return false; }
}
}
}
@@ -5,7 +5,14 @@ using Umbraco.Core;
namespace Umbraco.Web.Scheduling
{
internal abstract class LatchedBackgroundTaskBase : DisposableObject, ILatchedBackgroundTask
/// <summary>
/// Provides a base class for latched background tasks.
/// </summary>
/// <remarks>Implement by overriding Run or RunAsync and then IsAsync accordingly,
/// depending on whether the task is implemented as a sync or async method, and then
/// optionnally overriding RunsOnShutdown, to indicate whether the latched task should run
/// immediately on shutdown, or just be abandonned (default).</remarks>
public abstract class LatchedBackgroundTaskBase : DisposableObject, ILatchedBackgroundTask
{
private TaskCompletionSource<bool> _latch;
@@ -17,12 +24,18 @@ namespace Umbraco.Web.Scheduling
/// <summary>
/// Implements IBackgroundTask.Run().
/// </summary>
public abstract void Run();
public virtual void Run()
{
throw new NotSupportedException("This task cannot run synchronously.");
}
/// <summary>
/// Implements IBackgroundTask.RunAsync().
/// </summary>
public abstract Task RunAsync(CancellationToken token);
public virtual Task RunAsync(CancellationToken token)
{
throw new NotSupportedException("This task cannot run asynchronously.");
}
/// <summary>
/// Indicates whether the background task can run asynchronously.
@@ -49,7 +62,7 @@ namespace Umbraco.Web.Scheduling
_latch = new TaskCompletionSource<bool>();
}
public abstract bool RunsOnShutdown { get; }
public virtual bool RunsOnShutdown { get { return false; } }
// the task is going to be disposed after execution,
// unless it is latched again, thus indicating it wants to
-10
View File
@@ -89,19 +89,9 @@ namespace Umbraco.Web.Scheduling
return true; // repeat
}
public override Task<bool> PerformRunAsync(CancellationToken token)
{
throw new NotImplementedException();
}
public override bool IsAsync
{
get { return false; }
}
public override bool RunsOnShutdown
{
get { return false; }
}
}
}
@@ -1,3 +1,4 @@
using System;
using System.Threading;
using System.Threading.Tasks;
@@ -6,12 +7,16 @@ namespace Umbraco.Web.Scheduling
/// <summary>
/// Provides a base class for recurring background tasks.
/// </summary>
internal abstract class RecurringTaskBase : LatchedBackgroundTaskBase
/// <remarks>Implement by overriding PerformRun or PerformRunAsync and then IsAsync accordingly,
/// depending on whether the task is implemented as a sync or async method. Run nor RunAsync are
/// sealed here as overriding them would break recurrence. And then optionnally override
/// RunsOnShutdown, in order to indicate whether the latched task should run immediately on
/// shutdown, or just be abandonned (default).</remarks>
public abstract class RecurringTaskBase : LatchedBackgroundTaskBase
{
private readonly IBackgroundTaskRunner<RecurringTaskBase> _runner;
private readonly int _periodMilliseconds;
private readonly Timer _timer;
private bool _disposed;
/// <summary>
/// Initializes a new instance of the <see cref="RecurringTaskBase"/> class.
@@ -37,7 +42,7 @@ namespace Umbraco.Web.Scheduling
/// Implements IBackgroundTask.Run().
/// </summary>
/// <remarks>Classes inheriting from <c>RecurringTaskBase</c> must implement <c>PerformRun</c>.</remarks>
public override void Run()
public sealed override void Run()
{
var shouldRepeat = PerformRun();
if (shouldRepeat) Repeat();
@@ -47,7 +52,7 @@ namespace Umbraco.Web.Scheduling
/// Implements IBackgroundTask.RunAsync().
/// </summary>
/// <remarks>Classes inheriting from <c>RecurringTaskBase</c> must implement <c>PerformRun</c>.</remarks>
public override async Task RunAsync(CancellationToken token)
public sealed override async Task RunAsync(CancellationToken token)
{
var shouldRepeat = await PerformRunAsync(token);
if (shouldRepeat) Repeat();
@@ -74,7 +79,10 @@ namespace Umbraco.Web.Scheduling
/// Runs the background task.
/// </summary>
/// <returns>A value indicating whether to repeat the task.</returns>
public abstract bool PerformRun();
public virtual bool PerformRun()
{
throw new NotSupportedException("This task cannot run synchronously.");
}
/// <summary>
/// Runs the task asynchronously.
@@ -82,7 +90,10 @@ namespace Umbraco.Web.Scheduling
/// <param name="token">A cancellation token.</param>
/// <returns>A <see cref="Task{T}"/> instance representing the execution of the background task,
/// and returning a value indicating whether to repeat the task.</returns>
public abstract Task<bool> PerformRunAsync(CancellationToken token);
public virtual Task<bool> PerformRunAsync(CancellationToken token)
{
throw new NotSupportedException("This task cannot run asynchronously.");
}
protected override void DisposeResources()
{
@@ -23,11 +23,6 @@ namespace Umbraco.Web.Scheduling
_settings = settings;
}
public override bool PerformRun()
{
throw new NotImplementedException();
}
public override async Task<bool> PerformRunAsync(CancellationToken token)
{
if (_appContext == null) return true; // repeat...
@@ -108,10 +103,5 @@ namespace Umbraco.Web.Scheduling
{
get { return true; }
}
public override bool RunsOnShutdown
{
get { return false; }
}
}
}
@@ -81,11 +81,6 @@ namespace Umbraco.Web.Scheduling
}
}
public override bool PerformRun()
{
throw new NotImplementedException();
}
public override async Task<bool> PerformRunAsync(CancellationToken token)
{
if (_appContext == null) return true; // repeat...
@@ -126,10 +121,5 @@ namespace Umbraco.Web.Scheduling
{
get { return true; }
}
public override bool RunsOnShutdown
{
get { return false; }
}
}
}
@@ -124,11 +124,6 @@ namespace Umbraco.Web.Strategies
get { return false; }
}
public override bool RunsOnShutdown
{
get { return false; }
}
/// <summary>
/// Runs the background task.
/// </summary>
@@ -150,11 +145,6 @@ namespace Umbraco.Web.Strategies
return false; // probably stop if we have an error
}
}
public override Task<bool> PerformRunAsync(CancellationToken token)
{
throw new NotImplementedException();
}
}
}
}
+1 -37
View File
@@ -442,6 +442,7 @@
<Compile Include="Security\WebAuthExtensions.cs" />
<Compile Include="umbraco.presentation\SafeXmlReaderWriter.cs" />
<Compile Include="Trees\ScriptTreeController.cs" />
<Compile Include="umbraco.presentation\umbraco\developer\Packages\installer.aspx.cs" />
<Compile Include="UmbracoDefaultOwinStartup.cs" />
<Compile Include="IUmbracoContextAccessor.cs" />
<Compile Include="Models\ContentEditing\Relation.cs" />
@@ -738,9 +739,6 @@
<Compile Include="umbraco.presentation\umbraco\create\xslt.ascx.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\developer\Packages\Installer.aspx.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\dialogs\cruds.aspx.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
@@ -1519,13 +1517,6 @@
<Compile Include="umbraco.presentation\umbraco\developer\autoDoc.aspx.designer.cs">
<DependentUpon>autoDoc.aspx</DependentUpon>
</Compile>
<Compile Include="umbraco.presentation\umbraco\developer\Packages\BrowseRepository.aspx.cs">
<DependentUpon>BrowseRepository.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\developer\Packages\BrowseRepository.aspx.designer.cs">
<DependentUpon>BrowseRepository.aspx</DependentUpon>
</Compile>
<Compile Include="umbraco.presentation\umbraco\developer\Packages\editPackage.aspx.cs">
<DependentUpon>editPackage.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -1533,27 +1524,6 @@
<Compile Include="umbraco.presentation\umbraco\developer\Packages\editPackage.aspx.designer.cs">
<DependentUpon>editPackage.aspx</DependentUpon>
</Compile>
<Compile Include="umbraco.presentation\umbraco\developer\Packages\installedPackage.aspx.cs">
<DependentUpon>installedPackage.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\developer\Packages\installedPackage.aspx.designer.cs">
<DependentUpon>installedPackage.aspx</DependentUpon>
</Compile>
<Compile Include="umbraco.presentation\umbraco\developer\Packages\LoadNitros.ascx.cs">
<DependentUpon>LoadNitros.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\developer\Packages\LoadNitros.ascx.designer.cs">
<DependentUpon>LoadNitros.ascx</DependentUpon>
</Compile>
<Compile Include="umbraco.presentation\umbraco\developer\Packages\SubmitPackage.aspx.cs">
<DependentUpon>SubmitPackage.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\developer\Packages\SubmitPackage.aspx.designer.cs">
<DependentUpon>SubmitPackage.aspx</DependentUpon>
</Compile>
<Compile Include="umbraco.presentation\umbraco\developer\Xslt\getXsltStatus.asmx.cs">
<DependentUpon>getXsltStatus.asmx</DependentUpon>
<SubType>Component</SubType>
@@ -2073,15 +2043,9 @@
<Content Include="umbraco.presentation\umbraco\webservices\TreeClientService.asmx" />
<Content Include="umbraco.presentation\umbraco\members\search.aspx" />
<Content Include="umbraco.presentation\umbraco\translation\details.aspx" />
<Content Include="umbraco.presentation\umbraco\developer\Packages\BrowseRepository.aspx" />
<Content Include="umbraco.presentation\umbraco\developer\Packages\editPackage.aspx">
<SubType>ASPXCodeBehind</SubType>
</Content>
<Content Include="umbraco.presentation\umbraco\developer\Packages\installedPackage.aspx">
<SubType>ASPXCodeBehind</SubType>
</Content>
<Content Include="umbraco.presentation\umbraco\developer\Packages\LoadNitros.ascx" />
<Content Include="umbraco.presentation\umbraco\developer\Packages\SubmitPackage.aspx" />
<Content Include="umbraco.presentation\umbraco\dialogs\about.aspx">
<SubType>ASPXCodeBehind</SubType>
</Content>
@@ -1,20 +0,0 @@
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="../../masterpages/umbracoPage.Master" Title="Browse Repository" CodeBehind="BrowseRepository.aspx.cs" Inherits="umbraco.presentation.developer.packages.BrowseRepository" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<asp:Content ContentPlaceHolderID="body" runat="server">
<cc1:UmbracoPanel id="Panel1" Text="Browse package repository" runat="server" Width="612px" Height="600px" hasMenu="false">
<cc1:Feedback ID="fb" runat="server" />
<asp:Literal runat="server" ID="iframeGen" />
</cc1:UmbracoPanel>
</asp:Content>
<asp:Content ContentPlaceHolderID="footer" runat="server">
<script type="text/javascript">
jQuery(document).ready(function() {
var frame = jQuery("#repoFrame");
var win = jQuery(window);
frame.height(win.height() - frame.offset().top - 40);
frame.width(win.width() - 35);
});
</script>
</asp:Content>
@@ -1,66 +0,0 @@
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml;
using System.Xml.XPath;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
using Umbraco.Web;
namespace umbraco.presentation.developer.packages {
public partial class BrowseRepository : BasePages.UmbracoEnsuredPage {
public BrowseRepository()
{
CurrentApp = BusinessLogic.DefaultApps.developer.ToString();
}
protected void Page_Load(object sender, System.EventArgs e) {
Exception ex = new Exception();
if (!cms.businesslogic.packager.Settings.HasFileAccess(ref ex)) {
fb.Style.Add("margin-top", "7px");
fb.type = global::umbraco.uicontrols.Feedback.feedbacktype.error;
fb.Text = "<strong>" + ui.Text("errors", "filePermissionsError") + ":</strong><br/>" + ex.Message;
}
string category = Request.CleanForXss("category");
string repoGuid = Request.CleanForXss("repoGuid");
var repo = cms.businesslogic.packager.repositories.Repository.getByGuid(repoGuid);
if (repo == null)
{
throw new InvalidOperationException("Could not find repository with id " + repoGuid);
}
string url = repo.RepositoryUrl;
Panel1.Text = "Browse repository: " + repo.Name;
if (!string.IsNullOrEmpty(category))
category = "&category=" + category;
iframeGen.Text =
string.Format(
"<iframe id=\"repoFrame\" frameborder=\"1\" style=\"border: none; display: block\" src=\"{0}?repoGuid={1}{2}&callback={3}:{4}{5}/developer/packages/proxy.htm?/{6}/developer/packages/installer.aspx?repoGuid={7}&version=v45&fullVersion={8}.{9}.{10}&useLegacySchema={11}&dotnetVersion={12}&trustLevel={13}\"></iframe>",
url, repoGuid, category, Request.ServerVariables["SERVER_NAME"],
Request.ServerVariables["SERVER_PORT"], IOHelper.ResolveUrl(SystemDirectories.Umbraco),
IOHelper.ResolveUrl(SystemDirectories.Umbraco).Trim('/'), repoGuid,
UmbracoVersion.Current.Major,
UmbracoVersion.Current.Minor,
UmbracoVersion.Current.Build,
UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema.ToString(), Environment.Version,
Umbraco.Core.SystemUtilities.GetCurrentTrustLevel());
}
}
}
@@ -1,43 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3053
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace umbraco.presentation.developer.packages {
public partial class BrowseRepository {
/// <summary>
/// Panel1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.UmbracoPanel Panel1;
/// <summary>
/// fb control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Feedback fb;
/// <summary>
/// iframeGen control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal iframeGen;
}
}
@@ -1,32 +0,0 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LoadNitros.ascx.cs" Inherits="umbraco.presentation.developer.packages.LoadNitros" %>
<asp:Panel id="loadNitros" runat="server">
<div id="list1a">
<span id="editorCategories">
<a class="accordianOpener">
Editors picks
<small>Recommended by the umbraco core team</small>
</a>
<div style="display: block;" class="accordianContainer">
<asp:PlaceHolder ID="ph_recommendedHolder" runat="server" />
</div>
</span>
<span id="generatedCategories">
<asp:Repeater ID="rep_nitros" runat="server" OnItemDataBound="onCategoryDataBound">
<ItemTemplate>
<a class="accordianOpener generated">
<asp:Literal ID="lit_name" runat="server" />
<small><asp:Literal ID="lit_desc" runat="server"/></small>
</a>
<div class="accordianContainer generated">
<asp:PlaceHolder ID="ph_nitroHolder" runat="server" />
</div>
</ItemTemplate>
</asp:Repeater>
</span>
</div>
<asp:Button runat="server" CssClass="loadNitrosButton" id="bt_install" OnClick="installNitros" OnClientClick="InstallPackages(this,'loadingBar'); return true;" Text="Install selected modules" />
</asp:Panel>
@@ -1,205 +0,0 @@
using System.IO;
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Collections;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using umbraco.BusinessLogic;
namespace umbraco.presentation.developer.packages {
public partial class LoadNitros : System.Web.UI.UserControl {
private List<CheckBox> _nitroList = new List<CheckBox>();
private List<string> _selectedNitros = new List<string>();
protected void Page_Load(object sender, EventArgs e) { }
public void installNitros(object sender, EventArgs e) {
string repoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66"; //Hardcoded official package repo key.
var p = new cms.businesslogic.packager.Installer(Umbraco.Web.UmbracoContext.Current.Security.CurrentUser.Id);
var repo = cms.businesslogic.packager.repositories.Repository.getByGuid(repoGuid);
if (repo == null)
{
throw new InvalidOperationException("Could not find repository with id " + repoGuid);
}
foreach (CheckBox cb in _nitroList) {
if (cb.Checked) {
if (!_selectedNitros.Contains(cb.ID))
_selectedNitros.Add(cb.ID);
}
}
foreach (string guid in _selectedNitros) {
string tempFile = p.Import(repo.fetch(guid));
p.LoadConfig(tempFile);
int pId = p.CreateManifest(tempFile, guid, repoGuid);
//and then copy over the files. This will take some time if it contains .dlls that will reboot the system..
p.InstallFiles(pId, tempFile);
//finally install the businesslogic
p.InstallBusinessLogic(pId, tempFile);
//cleanup..
p.InstallCleanUp(pId, tempFile);
}
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearAllCache();
ApplicationContext.Current.ApplicationCache.IsolatedRuntimeCache.ClearAllCaches();
library.RefreshContent();
loadNitros.Visible = false;
RaiseBubbleEvent(new object(), new EventArgs());
}
protected void onCategoryDataBound(object sender, RepeaterItemEventArgs e) {
if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) {
cms.businesslogic.packager.repositories.Category cat = (cms.businesslogic.packager.repositories.Category)e.Item.DataItem;
Literal _name = (Literal)e.Item.FindControl("lit_name");
Literal _desc = (Literal)e.Item.FindControl("lit_desc");
PlaceHolder _nitros = (PlaceHolder)e.Item.FindControl("ph_nitroHolder");
_name.Text = cat.Text;
_desc.Text = cat.Description;
e.Item.Visible = false;
foreach (cms.businesslogic.packager.repositories.Package nitro in cat.Packages) {
bool installed = cms.businesslogic.packager.InstalledPackage.isPackageInstalled(nitro.RepoGuid.ToString());
int localPackageID = 0;
if (installed)
localPackageID = cms.businesslogic.packager.InstalledPackage.GetByGuid(nitro.RepoGuid.ToString()).Data.Id;
CheckBox cb_nitro = new CheckBox();
cb_nitro.ID = nitro.RepoGuid.ToString();
cb_nitro.Enabled = !installed;
cb_nitro.CssClass = "nitroCB";
cb_nitro.Text = "<div class='nitro'><h3>" + nitro.Text;
if (installed) {
cb_nitro.CssClass = "nitroCB installed";
cb_nitro.Text += "<span><a href='#' onclick=\"openDemoModal('" + nitro.RepoGuid.ToString() + "','" + nitro.Text + "'); return false;\">Already installed</a></span>";
}
cb_nitro.Text += "</h3><small>" + nitro.Description + "<br/>";
if (!string.IsNullOrEmpty(nitro.Demo)) {
cb_nitro.Text += "<a href='#' onclick=\"openDemoModal('" + nitro.RepoGuid.ToString() + "','" + nitro.Text + "'); return false;\">Demonstration</a> &nbsp;";
}
if (!string.IsNullOrEmpty(nitro.Documentation)) {
cb_nitro.Text += "<a href='" + nitro.Documentation + "' target='_blank'>Documentation</a> &nbsp;";
}
cb_nitro.Text += "</small></div><br style='clear: both'/>";
_nitros.Controls.Add(cb_nitro);
_nitroList.Add(cb_nitro);
e.Item.Visible = true;
if (nitro.EditorsPick) {
CheckBox cb_Recnitro = new CheckBox();
cb_Recnitro.ID = nitro.RepoGuid.ToString();
cb_Recnitro.CssClass = "nitroCB";
cb_Recnitro.Enabled = !installed;
cb_Recnitro.Text = "<div class='nitro'><h3>" + nitro.Text;
if (installed) {
cb_Recnitro.CssClass = "nitroCB installed";
cb_Recnitro.Text += "<span><a href='' onclick=\"openDemoModal('" + nitro.RepoGuid.ToString() + "','" + nitro.Text + "'); return false;\">Already installed</a></span>";
}
cb_Recnitro.Text += "</h3><small>" + nitro.Description + "<br/>";
if (!string.IsNullOrEmpty(nitro.Demo)) {
cb_Recnitro.Text += "<a href='#' onclick=\"openDemoModal('" + nitro.RepoGuid.ToString() + "','" + nitro.Text + "'); return false;\">Demonstration</a> &nbsp;";
}
if (!string.IsNullOrEmpty(nitro.Documentation)) {
cb_Recnitro.Text += "<a href='" + nitro.Documentation + "' target='_blank'>Documentation</a> &nbsp;";
}
cb_Recnitro.Text += "</small></div><br style='clear: both'/>";
_nitroList.Add(cb_Recnitro);
ph_recommendedHolder.Controls.Add(cb_Recnitro);
}
}
}
}
protected override void OnInit(EventArgs e) {
base.OnInit(e);
string repoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66";
var repo = cms.businesslogic.packager.repositories.Repository.getByGuid(repoGuid);
if (repo == null)
{
throw new InvalidOperationException("Could not find repository with id " + repoGuid);
}
var fb = new global::umbraco.uicontrols.Feedback();
fb.type = global::umbraco.uicontrols.Feedback.feedbacktype.error;
fb.Text = "<strong>No connection to repository.</strong> Modules could not be fetched from the repository as there was no connection to: '" + repo.RepositoryUrl + "'";
if (repo.HasConnection())
{
try
{
if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema)
rep_nitros.DataSource = repo.Webservice.NitrosCategorizedByVersion(cms.businesslogic.packager.repositories.Version.Version4);
else
rep_nitros.DataSource = repo.Webservice.NitrosCategorizedByVersion(cms.businesslogic.packager.repositories.Version.Version41);
rep_nitros.DataBind();
}
catch (Exception ex)
{
LogHelper.Error<LoadNitros>("An error occurred", ex);
loadNitros.Controls.Clear();
loadNitros.Controls.Add(fb);
//nitroList.Visible = false;
//lt_status.Text = "<div class='error'><p>Nitros could not be fetched from the repository. Please check your internet connection</p><p>You can always install Nitros later in the packages section</p><p>" + ex.ToString() + "</p></div>";
}
}
else
{
loadNitros.Controls.Clear();
loadNitros.Controls.Add(fb);
}
}
}
}
@@ -1,52 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3053
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace umbraco.presentation.developer.packages {
public partial class LoadNitros {
/// <summary>
/// loadNitros control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel loadNitros;
/// <summary>
/// ph_recommendedHolder control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder ph_recommendedHolder;
/// <summary>
/// rep_nitros control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Repeater rep_nitros;
/// <summary>
/// bt_install control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button bt_install;
}
}
@@ -1,113 +0,0 @@
<%@ Page Language="C#" Title="Submit package" MasterPageFile="../../masterpages/umbracoPage.Master" AutoEventWireup="true" CodeBehind="SubmitPackage.aspx.cs" Inherits="umbraco.presentation.developer.packages.SubmitPackage" %>
<%@ Register TagPrefix="cc2" Namespace="umbraco.uicontrols" Assembly="controls" %>
<asp:Content ContentPlaceHolderID="footer" runat="server">
<script type="text/javascript">
var tb_email = document.getElementById('<%= tb_email.ClientID %>');
if (tb_email.value != "") {
onRepoChange();
}
</script>
</asp:Content>
<asp:Content ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">
function onRepoChange() {
var dropdown = document.getElementById('<%= dd_repositories.ClientID %>');
var myindex = dropdown.selectedIndex
var SelValue = dropdown.options[myindex].value
var repoLogin = document.getElementById('<%= pl_repoLogin.ClientID %>');
if (SelValue != "") {
var publicRepoHelp = document.getElementById('<%= publicRepoHelp.ClientID %>');
var privateRepoHelp = document.getElementById('<%= privateRepoHelp.ClientID %>');
publicRepoHelp.style.display = 'none';
privateRepoHelp.style.display = 'none';
if (SelValue == "65194810-1f85-11dd-bd0b-0800200c9a66") {
publicRepoHelp.style.display = 'block';
} else {
privateRepoHelp.style.display = 'block';
}
repoLogin.style.display = 'block';
} else {
repoLogin.style.display = 'none';
}
}
</script>
</asp:Content>
<asp:Content ContentPlaceHolderID="body" runat="server">
<cc2:UmbracoPanel ID="Panel1" Text="Submit package to repository" runat="server" Width="496px" Height="584px">
<br />
<cc2:Feedback ID="fb_feedback" runat="server" />
<asp:PlaceHolder ID="feedbackControls" runat="server" Visible="false">
<br />
<p>
<button onclick="window.location.href = 'editpackage.aspx?id=<%= Request.QueryString["id"] %>'; return false;">Ok</button>
</p>
</asp:PlaceHolder>
<cc2:Pane ID="Pane2" runat="server" Text="Repository">
<asp:Panel ID="pl_repoChoose" runat="server">
<cc2:PropertyPanel runat="server">
<p>Choose the repository you want to submit the package to</p>
</cc2:PropertyPanel>
<cc2:PropertyPanel Text="Repository" runat="server">
<asp:DropDownList ID="dd_repositories" runat="server" />
</cc2:PropertyPanel>
</asp:Panel>
<asp:Panel id="pl_repoLogin" style="display: none;" runat="server">
<cc2:PropertyPanel ID="PropertyPanel1" runat="server">
<h3 style="margin-left: 0px; padding-top: 15px;">Please enter your credentials to authenticate your user.</h3>
<p runat="server" id="publicRepoHelp" style="display: none">If you do not have a user on the umbraco package repository, you can create one <a href="http://packages.umbraco.org/create-user" target="_blank">here</a>.</p>
<p runat="server" id="privateRepoHelp" style="display: none">If you do not have a user on this private repository, contact your repository administrator to gain access</p>
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="PropertyPanel2" runat="server" Text="Email">
<asp:TextBox ID="tb_email" runat="server" /> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="tb_email" runat="server" ErrorMessage="*" />
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="PropertyPanel3" runat="server" Text="Password">
<asp:TextBox TextMode="Password" ID="tb_password" runat="server" /> <asp:RequiredFieldValidator ControlToValidate="tb_password" runat="server" ErrorMessage="*" />
</cc2:PropertyPanel>
</asp:Panel>
</cc2:Pane>
<cc2:Pane ID="Pane1" runat="server" Text="Documentation (.pdf only)">
<cc2:PropertyPanel ID="PropertyPanel4" runat="server">
<p>Upload additional documentation for your package to help new users getting started with your package</p>
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="PropertyPanel5" runat="server" Text="Documentation file">
<asp:FileUpload ID="fu_doc" runat="server" />
<asp:RegularExpressionValidator ID="doc_regex" runat="server" ControlToValidate="fu_doc" ValidationExpression="(.*?)\.(pdf|PDF)$" ErrorMessage="Only .pdf files are accepted" />
</cc2:PropertyPanel>
</cc2:Pane>
<asp:PlaceHolder runat="server" ID="submitControls">
<br />
<div class="notice">
<p>By clicking "submit package" below you understand that your package will be submitted to a package repository and will in some cases be publicly available to download.</p>
<p><strong>Please notice: </strong> only packages with complete read-me, author information and install information gets considered for inclusion.</p>
<p>The package administrators group reservers the right to decline packages based on lack of documentation, poorly written readme and missing author information</p>
</div>
<p>
<asp:Button ID="bt_submit" runat="server" Text="Submit package" OnClick="submitPackage" /> &nbsp;<em><%= umbraco.ui.Text("or") %></em> &nbsp;<a href="editpackage.aspx?id=<%= Request.QueryString["id"] %>"><%= umbraco.ui.Text("cancel") %></a>
</p>
</asp:PlaceHolder>
</cc2:UmbracoPanel>
</asp:Content>
@@ -1,149 +0,0 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace umbraco.presentation.developer.packages {
public partial class SubmitPackage : BasePages.UmbracoEnsuredPage {
public SubmitPackage()
{
CurrentApp = BusinessLogic.DefaultApps.developer.ToString();
}
private cms.businesslogic.packager.PackageInstance pack;
private cms.businesslogic.packager.CreatedPackage createdPackage;
protected void Page_Load(object sender, EventArgs e) {
if(!String.IsNullOrEmpty(helper.Request("id"))){
if (!IsPostBack) {
dd_repositories.Items.Clear();
dd_repositories.Items.Add(new ListItem("Choose a repository...", ""));
List<cms.businesslogic.packager.repositories.Repository> repos = cms.businesslogic.packager.repositories.Repository.getAll();
if (repos.Count == 1) {
ListItem li = new ListItem(repos[0].Name, repos[0].Guid);
li.Selected = true;
dd_repositories.Items.Add(li);
pl_repoChoose.Visible = false;
pl_repoLogin.Style.Clear();
privateRepoHelp.Visible = false;
publicRepoHelp.Style.Clear();
} else if (repos.Count == 0) {
Response.Redirect("editpackage.aspx?id=" + helper.Request("id"));
} else {
foreach (cms.businesslogic.packager.repositories.Repository repo in repos) {
dd_repositories.Items.Add(new ListItem(repo.Name, repo.Guid));
}
dd_repositories.Items[0].Selected = true;
dd_repositories.Attributes.Add("onChange", "onRepoChange()");
}
}
createdPackage = cms.businesslogic.packager.CreatedPackage.GetById(int.Parse(helper.Request("id")));
pack = createdPackage.Data;
if (pack.Url != "") {
Panel1.Text = "Submit '" + pack.Name + "' to a repository";
}
}
}
protected void submitPackage(object sender, EventArgs e) {
Page.Validate();
string feedback = "";
if (Page.IsValid) {
try {
var repo = cms.businesslogic.packager.repositories.Repository.getByGuid(dd_repositories.SelectedValue);
if (repo == null)
{
throw new InvalidOperationException("Could not find repository with id " + dd_repositories.SelectedValue);
}
var memberKey = repo.Webservice.authenticate(tb_email.Text, library.md5(tb_password.Text));
byte[] doc = new byte[0];
if (fu_doc.HasFile)
doc = fu_doc.FileBytes;
if (memberKey != "") {
string result = repo.SubmitPackage(memberKey, pack, doc).ToString().ToLower();
switch (result) {
case "complete":
feedback = "Your package has been submitted successfully. It will be reviewed by the package repository administrator before it's publicly available";
fb_feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.success;
break;
case "error":
feedback = "There was a general error submitting your package to the repository. This can be due to general communitations error or too much traffic. Please try again later";
fb_feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.error;
break;
case "exists":
feedback = "This package has already been submitted to the repository. You cannot submit it again. If you have updates for a package, you should contact the repositor administrator to submit an update";
fb_feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.error;
break;
case "noaccess":
feedback = "Authentication failed, You do not have access to this repository. Contact your package repository administrator";
fb_feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.error;
break;
default:
break;
}
if (result == "complete") {
Pane1.Visible = false;
Pane2.Visible = false;
submitControls.Visible = false;
feedbackControls.Visible = true;
} else {
Pane1.Visible = true;
Pane2.Visible = true;
submitControls.Visible = true;
feedbackControls.Visible = false;
}
} else {
feedback = "Authentication failed, You do not have access to this repository. Contact your package repository administrator";
fb_feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.error;
}
} catch {
feedback = "Authentication failed, or the repository is currently off-line. Contact your package repository administrator";
fb_feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.error;
}
fb_feedback.Text = feedback;
}
}
}
}
@@ -1,214 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3053
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace umbraco.presentation.developer.packages {
public partial class SubmitPackage {
/// <summary>
/// Panel1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.UmbracoPanel Panel1;
/// <summary>
/// fb_feedback control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Feedback fb_feedback;
/// <summary>
/// feedbackControls control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder feedbackControls;
/// <summary>
/// Pane2 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane Pane2;
/// <summary>
/// pl_repoChoose control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel pl_repoChoose;
/// <summary>
/// dd_repositories control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList dd_repositories;
/// <summary>
/// pl_repoLogin control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel pl_repoLogin;
/// <summary>
/// PropertyPanel1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel PropertyPanel1;
/// <summary>
/// publicRepoHelp control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl publicRepoHelp;
/// <summary>
/// privateRepoHelp control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl privateRepoHelp;
/// <summary>
/// PropertyPanel2 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel PropertyPanel2;
/// <summary>
/// tb_email control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox tb_email;
/// <summary>
/// RequiredFieldValidator1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
/// <summary>
/// PropertyPanel3 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel PropertyPanel3;
/// <summary>
/// tb_password control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox tb_password;
/// <summary>
/// Pane1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane Pane1;
/// <summary>
/// PropertyPanel4 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel PropertyPanel4;
/// <summary>
/// PropertyPanel5 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel PropertyPanel5;
/// <summary>
/// fu_doc control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.FileUpload fu_doc;
/// <summary>
/// doc_regex control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.RegularExpressionValidator doc_regex;
/// <summary>
/// submitControls control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder submitControls;
/// <summary>
/// bt_submit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button bt_submit;
}
}
@@ -36,7 +36,6 @@
ControlToValidate="packageVersion">*</asp:RequiredFieldValidator>
</cc2:PropertyPanel>
<cc2:PropertyPanel runat="server" ID="pp_file" Text="Package file (.zip):">
<asp:Button ID="bt_submitButton" runat="server" Text="Submit to repository" Visible="false" />
<asp:Literal ID="packageUmbFile" runat="server" />
</cc2:PropertyPanel>
</cc2:Pane>
@@ -48,16 +48,10 @@ namespace umbraco.presentation.developer.packages
cp = new ContentPicker();
content.Controls.Add(cp);
bt_submitButton.Attributes.Add("onClick", "window.location = 'submitpackage.aspx?id=" + pack.Id.ToString() + "'; return false;");
if (string.IsNullOrEmpty(pack.PackagePath) == false)
{
packageUmbFile.Text = " &nbsp; <a href='" + Page.ResolveClientUrl(pack.PackagePath) + "'>Download</a>";
if (cms.businesslogic.packager.repositories.Repository.getAll().Count > 0)
bt_submitButton.Visible = true;
packageUmbFile.Text = " &nbsp; <a href='" + Page.ResolveClientUrl(pack.PackagePath) + "'>Download</a>";
}
else
{
@@ -47,6 +47,7 @@ namespace umbraco.presentation.developer.packages {
protected global::System.Web.UI.WebControls.RegularExpressionValidator VersionValidator;
protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator7;
/// <summary>
/// packageName control.
/// </summary>
@@ -128,15 +129,6 @@ namespace umbraco.presentation.developer.packages {
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_file;
/// <summary>
/// bt_submitButton control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button bt_submitButton;
/// <summary>
/// packageUmbFile control.
/// </summary>
@@ -1,180 +0,0 @@
<%@ Page Language="C#" MasterPageFile="../../masterpages/umbracoPage.Master" AutoEventWireup="true" CodeBehind="installedPackage.aspx.cs" Inherits="umbraco.presentation.developer.packages.installedPackage" %>
<%@ Register TagPrefix="cc2" Namespace="umbraco.uicontrols" Assembly="controls" %>
<asp:Content ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">
function toggleDiv(id, gotoDiv) {
var div = document.getElementById(id);
if (div.style.display == "none")
div.style.display = "block";
else
div.style.display = "none";
}
function openDemo(link, id) {
UmbClientMgr.openModalWindow("http://packages.umbraco.org/viewPackageData.aspx?id=" + id, link.innerHTML, true, 750, 550)
}
</script>
<style type="text/css">
.propertyItemheader {
width: 250px;
}
</style>
</asp:Content>
<asp:Content ContentPlaceHolderID="body" runat="server">
<cc2:Tabview ID="Panel1" Text="Installed package" runat="server" Width="496px" Height="584px">
<cc2:Pane ID="pane_meta" runat="server" Text="Package meta data">
<cc2:PropertyPanel ID="pp_name" runat="server">
<asp:Literal ID="lt_packagename" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="pp_version" runat="server">
<asp:Literal ID="lt_packageVersion" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="pp_author" runat="server">
<asp:Literal ID="lt_packageAuthor" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="pp_documentation" Visible="false" runat="server">
<asp:HyperLink id="hl_docLink" Target="_blank" runat="server" />
<asp:LinkButton id="lb_demoLink" OnClientClick="" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="pp_repository" Visible="false" runat="server">
<asp:HyperLink id="hl_packageRepo" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="pp_readme" runat="server">
<div style="position: relative; background: #fff; padding: 3px; border: 1px solid #ccc; width: 400px; white-space: normal !Important; overflow: auto;">
<asp:Literal ID="lt_readme" runat="server" /></div>
</cc2:PropertyPanel>
</cc2:Pane>
<cc2:Pane ID="pane_versions" runat="server" Text="Package version history" Visible="false">
<cc2:PropertyPanel ID="pp_versions" runat="server">
<asp:Repeater ID="rptr_versions" runat="server">
<headertemplate><ul></headertemplate>
<itemtemplate><li><a href="#"><%# ((umbraco.cms.businesslogic.packager.InstalledPackage)Container.DataItem).Data.Name %></a></li></itemtemplate>
<footertemplate></ul></footertemplate>
</asp:Repeater>
</cc2:PropertyPanel>
</cc2:Pane>
<cc2:Pane ID="pane_upgrade" runat="server" Text="Upgrade package" Visible="false">
<cc2:PropertyPanel runat="server">
<p>
<%= umbraco.ui.Text("packager", "packageUpgradeText") %>
</p>
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="pp_upgradeInstruction" Text="Upgrade instructions" runat="server">
<p>
<asp:Literal ID="lt_upgradeReadme" runat="server" />
</p>
<p>
<asp:Button ID="bt_gotoUpgrade" Text="Download update from the repository" runat="server" UseSubmitBehavior="false" />
</p>
</cc2:PropertyPanel>
</cc2:Pane>
<cc2:Pane ID="pane_noItems" Visible="false" runat="server" Text="Uninstaller doesn't contain any items">
<div class="guiDialogNormal" style="margin: 10px">
<%= umbraco.ui.Text("packager", "packageNoItemsText") %>
<p>
<asp:Button ID="bt_deletePackage" OnClick="delPack" runat="server" Text="Remove uninstaller" />
</p>
</div>
</cc2:Pane>
<cc2:Pane ID="pane_uninstall" runat="server" Text="Uninstall items installed by this package">
<p>
<%= umbraco.ui.Text("packager", "packageUninstallText") %>
</p>
<cc2:PropertyPanel runat="server" Text="Document Types" ID="pp_docTypes">
<asp:CheckBoxList ID="documentTypes" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel runat="server" Text="Templates" ID="pp_templates">
<asp:CheckBoxList ID="templates" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel runat="server" Text="Stylesheets" ID="pp_css">
<asp:CheckBoxList ID="stylesheets" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel runat="server" Text="Macros" ID="pp_macros">
<asp:CheckBoxList ID="macros" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="pp_files" runat="server" Text="Files">
<asp:CheckBoxList ID="files" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="pp_di" runat="server" Text="Dictionary Items">
<asp:CheckBoxList ID="dictionaryItems" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="pp_dt" runat="server" Text="Data types">
<asp:CheckBoxList ID="dataTypes" runat="server" />
</cc2:PropertyPanel>
<cc2:PropertyPanel ID="pp_confirm" runat="server" Text="&nbsp;">
<p>
<asp:Button ID="bt_confirmUninstall" OnClick="confirmUnInstall" Text="Confirm uninstall" CssClass="btn btn-primary" runat="server" />
<cc2:ProgressBar ID="progbar" runat="server" Title="Please wait..." />
</p>
</cc2:PropertyPanel>
</cc2:Pane>
<cc2:Pane id="pane_uninstalled" runat="server" Visible="false">
<div class="alert alert-block">
Please wait while the browser is reloaded...
</div>
<script type="text/javascript">
//This is all a bit zany with double encoding because we have a URL in a hash (#) url part
// but it works and maintains query strings
var umbPath = "<%=GlobalSettings.Path%>";
setTimeout(function () {
var mainWindow = UmbClientMgr.mainWindow();
//kill the tree and template cache
if (mainWindow.UmbClientMgr) {
mainWindow.UmbClientMgr._packageInstalled();
}
var baseUrl = mainWindow.location.href.substr(0, mainWindow.location.href.indexOf("#/developer/framed/"));
var framedUrl = baseUrl + "#/developer/framed/";
var refreshUrl = framedUrl + encodeURIComponent(encodeURIComponent(umbPath + "/developer/packages/installer.aspx?installing=uninstalled"));
var redirectUrl = umbPath + "/ClientRedirect.aspx?redirectUrl=" + refreshUrl;
mainWindow.location.href = redirectUrl;
}, 2000);
</script>
</cc2:Pane>
</cc2:Pane>
</cc2:Tabview>
</asp:Content>
@@ -1,632 +0,0 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.Security;
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.cms.presentation.Trees;
using BizLogicAction = umbraco.BusinessLogic.Actions.Action;
using Macro = umbraco.cms.businesslogic.macro.Macro;
using Template = umbraco.cms.businesslogic.template.Template;
namespace umbraco.presentation.developer.packages
{
public partial class installedPackage : BasePages.UmbracoEnsuredPage
{
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"]));
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;");
if (!Page.IsPostBack)
{
//temp list to contain failing items...
var tempList = new List<string>();
foreach (var str in _pack.Data.Documenttypes)
{
var tId = 0;
if (int.TryParse(str, out tId))
{
try
{
var dc = new DocumentType(tId);
var li = new ListItem(dc.Text, dc.Id.ToString());
li.Selected = true;
documentTypes.Items.Add(li);
}
catch
{
tempList.Add(str);
}
}
}
//removing failing documentTypes items from the uninstall manifest
SyncLists(_pack.Data.Documenttypes, tempList);
foreach (var str in _pack.Data.Templates)
{
var tId = 0;
if (int.TryParse(str, out tId))
{
try
{
var t = new Template(tId);
var li = new ListItem(t.Text, t.Id.ToString());
li.Selected = true;
templates.Items.Add(li);
}
catch
{
tempList.Add(str);
}
}
}
//removing failing template items from the uninstall manifest
SyncLists(_pack.Data.Templates, tempList);
foreach (string str in _pack.Data.Stylesheets)
{
int tId = 0;
if (int.TryParse(str, out tId))
{
try
{
var s = new StyleSheet(tId);
ListItem li = new ListItem(s.Text, s.Id.ToString());
li.Selected = true;
stylesheets.Items.Add(li);
}
catch
{
tempList.Add(str);
}
}
}
//removing failing stylesheet items from the uninstall manifest
SyncLists(_pack.Data.Stylesheets, tempList);
foreach (var str in _pack.Data.Macros)
{
var tId = 0;
if (int.TryParse(str, out tId))
{
try
{
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);
}
else
{
tempList.Add(str);
}
}
catch
{
tempList.Add(str);
}
}
}
//removing failing macros items from the uninstall manifest
SyncLists(_pack.Data.Macros, tempList);
foreach (var str in _pack.Data.Files)
{
try
{
if (!string.IsNullOrEmpty(str) && System.IO.File.Exists(IOHelper.MapPath(str) ))
{
var li = new ListItem(str, str);
li.Selected = true;
files.Items.Add(li);
}
else
{
tempList.Add(str);
}
}
catch
{
tempList.Add(str);
}
}
//removing failing files from the uninstall manifest
SyncLists(_pack.Data.Files, tempList);
foreach (string str in _pack.Data.DictionaryItems)
{
var tId = 0;
if (int.TryParse(str, out tId))
{
try
{
var di = new cms.businesslogic.Dictionary.DictionaryItem(tId);
var li = new ListItem(di.key, di.id.ToString());
li.Selected = true;
dictionaryItems.Items.Add(li);
}
catch
{
tempList.Add(str);
}
}
}
//removing failing files from the uninstall manifest
SyncLists(_pack.Data.DictionaryItems, tempList);
foreach (var str in _pack.Data.DataTypes)
{
var tId = 0;
if (int.TryParse(str, out tId))
{
try
{
var dtd = new cms.businesslogic.datatype.DataTypeDefinition(tId);
if (dtd != null)
{
var li = new ListItem(dtd.Text, dtd.Id.ToString());
li.Selected = true;
dataTypes.Items.Add(li);
}
else
{
tempList.Add(str);
}
}
catch
{
tempList.Add(str);
}
}
}
//removing failing files from the uninstall manifest
SyncLists(_pack.Data.DataTypes, tempList);
//save the install manifest, so even tho the user doesn't uninstall, it stays uptodate.
_pack.Save();
//Look for updates on packages.
if (!string.IsNullOrEmpty(_pack.Data.RepositoryGuid) && !string.IsNullOrEmpty(_pack.Data.PackageGuid))
{
try
{
_repo = cms.businesslogic.packager.repositories.Repository.getByGuid(_pack.Data.RepositoryGuid);
if (_repo != null)
{
hl_packageRepo.Text = _repo.Name;
hl_packageRepo.NavigateUrl = "BrowseRepository.aspx?repoGuid=" + _repo.Guid;
pp_repository.Visible = true;
}
var repoPackage = _repo.Webservice.PackageByGuid(_pack.Data.PackageGuid);
if (repoPackage != null)
{
if (repoPackage.HasUpgrade && repoPackage.UpgradeVersion != _pack.Data.Version)
{
pane_upgrade.Visible = true;
lt_upgradeReadme.Text = repoPackage.UpgradeReadMe;
bt_gotoUpgrade.OnClientClick = "window.location.href = 'browseRepository.aspx?url=" + repoPackage.Url + "'; return true;";
}
if (!string.IsNullOrEmpty(repoPackage.Demo))
{
lb_demoLink.OnClientClick = "openDemo(this, '" + _pack.Data.PackageGuid + "'); return false;";
pp_documentation.Visible = true;
}
if (!string.IsNullOrEmpty(repoPackage.Documentation))
{
hl_docLink.NavigateUrl = repoPackage.Documentation;
hl_docLink.Target = "_blank";
pp_documentation.Visible = true;
}
}
}
catch
{
pane_upgrade.Visible = false;
}
}
var deletePackage = true;
//sync the UI to match what is in the package
if (macros.Items.Count == 0)
pp_macros.Visible = false;
else
deletePackage = false;
if (documentTypes.Items.Count == 0)
pp_docTypes.Visible = false;
else
deletePackage = false;
if (files.Items.Count == 0)
pp_files.Visible = false;
else
deletePackage = false;
if (templates.Items.Count == 0)
pp_templates.Visible = false;
else
deletePackage = false;
if (stylesheets.Items.Count == 0)
pp_css.Visible = false;
else
deletePackage = false;
if (dictionaryItems.Items.Count == 0)
pp_di.Visible = false;
else
deletePackage = false;
if (dataTypes.Items.Count == 0)
pp_dt.Visible = false;
else
deletePackage = false;
if (deletePackage)
{
pane_noItems.Visible = true;
pane_uninstall.Visible = false;
}
// List the package version history [LK 2013-067-10]
Version v;
var packageVersionHistory = cms.businesslogic.packager.InstalledPackage.GetAllInstalledPackages()
.Where(x => x.Data.Id != _pack.Data.Id && string.Equals(x.Data.Name, _pack.Data.Name, StringComparison.OrdinalIgnoreCase))
.OrderBy(x => Version.TryParse(x.Data.Version, out v) ? v : new Version());
if (packageVersionHistory != null && packageVersionHistory.Count() > 0)
{
rptr_versions.DataSource = packageVersionHistory;
rptr_versions.DataBind();
pane_versions.Visible = true;
}
}
}
}
private static void SyncLists(List<string> list, List<string> removed)
{
foreach (var str in removed)
{
list.Remove(str);
}
for (var i = 0; i < list.Count; i++)
{
if (String.IsNullOrEmpty(list[i].Trim()))
list.RemoveAt(i);
}
removed.Clear();
}
protected void delPack(object sender, EventArgs e)
{
_pack.Delete(UmbracoUser.Id);
pane_uninstalled.Visible = true;
pane_uninstall.Visible = false;
}
protected void confirmUnInstall(object sender, EventArgs e)
{
var refreshCache = false;
//Uninstall Stylesheets
foreach (ListItem li in stylesheets.Items)
{
if (li.Selected)
{
int nId;
if (int.TryParse(li.Value, out nId))
{
var s = new StyleSheet(nId);
s.delete();
_pack.Data.Stylesheets.Remove(nId.ToString());
}
}
}
//Uninstall templates
foreach (ListItem li in templates.Items)
{
if (li.Selected)
{
int nId;
if (int.TryParse(li.Value, out nId))
{
var found = ApplicationContext.Services.FileService.GetTemplate(nId);
if (found != null)
{
ApplicationContext.Services.FileService.DeleteTemplate(found.Alias, UmbracoUser.Id);
}
_pack.Data.Templates.Remove(nId.ToString());
}
}
}
//Uninstall macros
foreach (ListItem li in macros.Items)
{
if (li.Selected)
{
int nId;
if (int.TryParse(li.Value, out nId))
{
var s = new Macro(nId);
if (!string.IsNullOrEmpty(s.Name))
{
s.Delete();
}
_pack.Data.Macros.Remove(nId.ToString());
}
}
}
//Remove Document Types
var contentTypes = new List<IContentType>();
var contentTypeService = ApplicationContext.Current.Services.ContentTypeService;
foreach (ListItem li in documentTypes.Items)
{
if (li.Selected)
{
int nId;
if (int.TryParse(li.Value, out nId))
{
var contentType = contentTypeService.GetContentType(nId);
if (contentType != null)
{
contentTypes.Add(contentType);
_pack.Data.Documenttypes.Remove(nId.ToString(CultureInfo.InvariantCulture));
// refresh content cache when document types are removed
refreshCache = true;
}
}
}
}
//Order the DocumentTypes before removing them
if (contentTypes.Any())
{
//TODO: I don't think this ordering is necessary
var orderedTypes = (from contentType in contentTypes
orderby contentType.ParentId descending, contentType.Id descending
select contentType);
contentTypeService.Delete(orderedTypes);
}
//Remove Dictionary items
foreach (ListItem li in dictionaryItems.Items)
{
if (li.Selected)
{
int nId;
if (int.TryParse(li.Value, out nId))
{
var di = new cms.businesslogic.Dictionary.DictionaryItem(nId);
di.delete();
_pack.Data.DictionaryItems.Remove(nId.ToString());
}
}
}
//Remove Data types
foreach (ListItem li in dataTypes.Items)
{
if (li.Selected)
{
int nId;
if (int.TryParse(li.Value, out nId))
{
var dtd = new cms.businesslogic.datatype.DataTypeDefinition(nId);
dtd.delete();
_pack.Data.DataTypes.Remove(nId.ToString());
}
}
}
_pack.Save();
if (!IsManifestEmpty())
{
Response.Redirect(Request.RawUrl);
}
else
{
// uninstall actions
try
{
var actionsXml = new XmlDocument();
actionsXml.LoadXml("<Actions>" + _pack.Data.Actions + "</Actions>");
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 running undo actions", 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
//Remove files
foreach (ListItem li in files.Items)
{
if (li.Selected)
{
//here we need to try to find the file in question as most packages does not support the tilde char
var file = IOHelper.FindFile(li.Value);
var filePath = IOHelper.MapPath(file);
if (System.IO.File.Exists(filePath))
{
System.IO.File.Delete(filePath);
_pack.Data.Files.Remove(li.Value);
}
}
}
_pack.Save();
_pack.Delete(UmbracoUser.Id);
pane_uninstalled.Visible = true;
pane_uninstall.Visible = false;
}
// refresh cache
if (refreshCache)
{
library.RefreshContent();
}
//ensure that all tree's are refreshed after uninstall
ClientTools.ClearClientTreeCache()
.RefreshTree();
TreeDefinitionCollection.Instance.ReRegisterTrees();
BizLogicAction.ReRegisterActionsAndHandlers();
}
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();
var lists = new List<List<string>>
{
_pack.Data.Documenttypes,
_pack.Data.Macros,
_pack.Data.Stylesheets,
_pack.Data.Templates,
_pack.Data.DictionaryItems,
_pack.Data.DataTypes
};
//Not including files, since there might be assemblies that contain package actions
//lists.Add(pack.Data.Files);
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");
pane_versions.Text = ui.Text("packager", "packageVersionHistory");
pane_noItems.Text = ui.Text("packager", "packageNoItemsHeader");
pane_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");
var general = Panel1.NewTabPage(ui.Text("packager", "packageName"));
general.Controls.Add(pane_meta);
general.Controls.Add(pane_versions);
var uninstall = Panel1.NewTabPage(ui.Text("packager", "packageUninstallHeader"));
uninstall.Controls.Add(pane_noItems);
uninstall.Controls.Add(pane_uninstall);
uninstall.Controls.Add(pane_uninstalled);
}
}
}
@@ -1,402 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace umbraco.presentation.developer.packages {
public partial class installedPackage {
/// <summary>
/// Panel1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.TabView Panel1;
/// <summary>
/// pane_meta control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane pane_meta;
/// <summary>
/// pp_name control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_name;
/// <summary>
/// lt_packagename control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal lt_packagename;
/// <summary>
/// pp_version control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_version;
/// <summary>
/// lt_packageVersion control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal lt_packageVersion;
/// <summary>
/// pp_author control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_author;
/// <summary>
/// lt_packageAuthor control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal lt_packageAuthor;
/// <summary>
/// pp_documentation control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_documentation;
/// <summary>
/// hl_docLink control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HyperLink hl_docLink;
/// <summary>
/// lb_demoLink control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lb_demoLink;
/// <summary>
/// pp_repository control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_repository;
/// <summary>
/// hl_packageRepo control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HyperLink hl_packageRepo;
/// <summary>
/// pp_readme control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_readme;
/// <summary>
/// lt_readme control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal lt_readme;
/// <summary>
/// pane_versions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane pane_versions;
/// <summary>
/// pp_versions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_versions;
/// <summary>
/// rptr_versions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Repeater rptr_versions;
/// <summary>
/// pane_upgrade control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane pane_upgrade;
/// <summary>
/// pp_upgradeInstruction control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_upgradeInstruction;
/// <summary>
/// lt_upgradeReadme control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal lt_upgradeReadme;
/// <summary>
/// bt_gotoUpgrade control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button bt_gotoUpgrade;
/// <summary>
/// pane_noItems control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane pane_noItems;
/// <summary>
/// bt_deletePackage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button bt_deletePackage;
/// <summary>
/// pane_uninstall control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane pane_uninstall;
/// <summary>
/// pp_docTypes control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_docTypes;
/// <summary>
/// documentTypes control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBoxList documentTypes;
/// <summary>
/// pp_templates control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_templates;
/// <summary>
/// templates control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBoxList templates;
/// <summary>
/// pp_css control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_css;
/// <summary>
/// stylesheets control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBoxList stylesheets;
/// <summary>
/// pp_macros control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_macros;
/// <summary>
/// macros control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBoxList macros;
/// <summary>
/// pp_files control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_files;
/// <summary>
/// files control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBoxList files;
/// <summary>
/// pp_di control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_di;
/// <summary>
/// dictionaryItems control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBoxList dictionaryItems;
/// <summary>
/// pp_dt control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_dt;
/// <summary>
/// dataTypes control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBoxList dataTypes;
/// <summary>
/// pp_confirm control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_confirm;
/// <summary>
/// bt_confirmUninstall control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button bt_confirmUninstall;
/// <summary>
/// progbar control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.ProgressBar progbar;
/// <summary>
/// pane_uninstalled control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane pane_uninstalled;
}
}
@@ -12,7 +12,8 @@ using Umbraco.Core.Logging;
using Umbraco.Core.IO;
namespace umbraco.cms.businesslogic.packager.repositories
{
{
[Obsolete("This should not be used and will be removed in future Umbraco versions")]
public class Repository : DisposableObject
{
public string Guid { get; private set; }
@@ -141,12 +142,12 @@ namespace umbraco.cms.businesslogic.packager.repositories
return repository;
}
//shortcut method to download pack from repo and place it on the server...
public string fetch(string packageGuid)
{
return fetch(packageGuid, string.Empty);
}
public string fetch(string packageGuid, int userId)
@@ -158,6 +159,40 @@ namespace umbraco.cms.businesslogic.packager.repositories
return fetch(packageGuid);
}
/// <summary>
/// Used to get the correct package file from the repo for the current umbraco version
/// </summary>
/// <param name="packageGuid"></param>
/// <param name="userId"></param>
/// <param name="currentUmbracoVersion"></param>
/// <returns></returns>
public string GetPackageFile(string packageGuid, int userId, System.Version currentUmbracoVersion)
{
// log
Audit.Add(AuditTypes.PackagerInstall,
string.Format("Package {0} fetched from {1}", packageGuid, this.Guid),
userId, -1);
var fileByteArray = Webservice.GetPackageFile(packageGuid, currentUmbracoVersion.ToString(3));
//successfull
if (fileByteArray.Length > 0)
{
// Check for package directory
if (Directory.Exists(IOHelper.MapPath(Settings.PackagerRoot)) == false)
Directory.CreateDirectory(IOHelper.MapPath(Settings.PackagerRoot));
using (var fs1 = new FileStream(IOHelper.MapPath(Settings.PackagerRoot + Path.DirectorySeparatorChar + packageGuid + ".umb"), FileMode.Create))
{
fs1.Write(fileByteArray, 0, fileByteArray.Length);
fs1.Close();
return "packages\\" + packageGuid + ".umb";
}
}
return "";
}
public bool HasConnection()
{
@@ -199,22 +234,37 @@ namespace umbraco.cms.businesslogic.packager.repositories
}
}
/// <summary>
/// This goes and fetches the Byte array for the package from OUR, but it's pretty strange
/// </summary>
/// <param name="packageGuid">
/// The package ID for the package file to be returned
/// </param>
/// <param name="key">
/// This is a strange Umbraco version parameter - but it's not really an umbraco version, it's a special/odd version format like Version41
/// but it's actually not used for the 7.5+ package installs so it's obsolete/unused.
/// </param>
/// <returns></returns>
public string fetch(string packageGuid, string key)
{
byte[] fileByteArray = new byte[0];
if (key == string.Empty)
{
{
//SD: this is odd, not sure why it returns a different package depending on the legacy xml schema but I'll leave it for now
if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema)
fileByteArray = this.Webservice.fetchPackage(packageGuid);
fileByteArray = Webservice.fetchPackage(packageGuid);
else
fileByteArray = this.Webservice.fetchPackageByVersion(packageGuid, Version.Version41);
{
fileByteArray = Webservice.fetchPackageByVersion(packageGuid, Version.Version41);
}
}
else
{
fileByteArray = this.Webservice.fetchProtectedPackage(packageGuid, key);
fileByteArray = Webservice.fetchProtectedPackage(packageGuid, key);
}
//successfull
@@ -36,6 +36,8 @@ namespace umbraco.cms.businesslogic.packager.repositories
private System.Threading.SendOrPostCallback authenticateOperationCompleted;
private System.Threading.SendOrPostCallback GetPackageFileOperationCompleted;
private System.Threading.SendOrPostCallback fetchPackageByVersionOperationCompleted;
private System.Threading.SendOrPostCallback fetchPackageOperationCompleted;
@@ -83,6 +85,9 @@ namespace umbraco.cms.businesslogic.packager.repositories
/// <remarks/>
public event authenticateCompletedEventHandler authenticateCompleted;
/// <remarks/>
public event GetPackageFileCompletedEventHandler GetPackageFileCompleted;
/// <remarks/>
public event fetchPackageByVersionCompletedEventHandler fetchPackageByVersionCompleted;
@@ -533,6 +538,76 @@ namespace umbraco.cms.businesslogic.packager.repositories
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/GetPackageFile", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute(DataType = "base64Binary")]
public byte[] GetPackageFile(string packageGuid, string umbracoVersion)
{
object[] results = this.Invoke("GetPackageFile", new object[] {
packageGuid,
umbracoVersion});
return ((byte[])(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginfetchPackageByVersion(string packageGuid, string umbracoVersion, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("GetPackageFile", new object[] {
packageGuid,
umbracoVersion}, callback, asyncState);
}
/// <remarks/>
public byte[] EndGetPackageFile(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((byte[])(results[0]));
}
/// <remarks/>
public void GetPackageFileAsync(string packageGuid, string umbracoVersion)
{
this.GetPackageFileAsync(packageGuid, umbracoVersion, null);
}
/// <remarks/>
public void GetPackageFileAsync(string packageGuid, string umbracoVersion, object userState)
{
if ((this.GetPackageFileOperationCompleted == null))
{
this.GetPackageFileOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetPackageFileOperationCompleted);
}
this.InvokeAsync("GetPackageFile", new object[] {
packageGuid,
umbracoVersion}, this.GetPackageFileOperationCompleted, userState);
}
private void OnGetPackageFileOperationCompleted(object arg)
{
if ((this.GetPackageFileCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetPackageFileCompleted(this, new GetPackageFileCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/fetchPackageByVersion", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute(DataType = "base64Binary")]
@@ -1382,7 +1457,9 @@ namespace umbraco.cms.businesslogic.packager.repositories
/// <remarks/>
Version4,
/// <remarks/>
/// <summary>
/// This is apparently the version number we pass in for all installs
/// </summary>
Version41,
/// <remarks/>
@@ -1682,9 +1759,40 @@ namespace umbraco.cms.businesslogic.packager.repositories
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
public delegate void fetchPackageByVersionCompletedEventHandler(object sender, fetchPackageByVersionCompletedEventArgs e);
public delegate void GetPackageFileCompletedEventHandler(object sender, GetPackageFileCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetPackageFileCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal GetPackageFileCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public byte[] Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((byte[])(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
public delegate void fetchPackageByVersionCompletedEventHandler(object sender, fetchPackageByVersionCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]