Completes: U4-2917 Remove canvas/live editing support, U4-2916 Remove skinning support

This commit is contained in:
Shannon
2013-09-25 17:57:44 +10:00
parent a1f87c7232
commit a939c14de9
99 changed files with 49 additions and 4942 deletions

View File

@@ -597,21 +597,11 @@ namespace Umbraco.Core.Configuration
return context.Request.Path.ToLower().IndexOf(IOHelper.ResolveUrl(SystemDirectories.Umbraco).ToLower()) > -1;
}
public static bool RequestIsLiveEditRedirector(HttpContext context)
{
return context.Request.Path.ToLower().IndexOf(SystemDirectories.Umbraco.ToLower() + "/liveediting.aspx") > -1;
}
public static bool RequestIsInUmbracoApplication(HttpContextBase context)
{
return context.Request.Path.ToLower().IndexOf(IOHelper.ResolveUrl(SystemDirectories.Umbraco).ToLower()) > -1;
}
public static bool RequestIsLiveEditRedirector(HttpContextBase context)
{
return context.Request.Path.ToLower().IndexOf(SystemDirectories.Umbraco.ToLower() + "/liveediting.aspx") > -1;
}
/// <summary>
/// Gets a value indicating whether umbraco should force a secure (https) connection to the backoffice.
/// </summary>

View File

@@ -51,14 +51,6 @@ namespace Umbraco.Core.IO
return SystemDirectories.Config + "/dashboard.config";
}
}
public static string SkinningXml
{
get
{
return SystemDirectories.Data + "/skinning.config";
}
}
public static string NotFoundhandlersConfig
{

View File

@@ -497,9 +497,7 @@ namespace Umbraco.Core
/// <returns></returns>
internal IEnumerable<Type> ResolveDataTypes()
{
//ensure we ignore types that should not be loaded
return ResolveTypes<IDataType>()
.Except(new[] {Type.GetType("umbraco.presentation.LiveEditing.Modules.ItemEditing.PageElementEditor,umbraco")});
return ResolveTypes<IDataType>();
}
/// <summary>

View File

@@ -352,9 +352,6 @@
<Compile Include="Install\Steps\RenderingEngine.ascx.designer.cs">
<DependentUpon>RenderingEngine.ascx</DependentUpon>
</Compile>
<Compile Include="Install\Steps\Skinning\loadStarterKitDesigns.ascx.designer.cs">
<DependentUpon>loadStarterKitDesigns.ascx</DependentUpon>
</Compile>
<Compile Include="Install\Steps\Skinning\LoadStarterKits.ascx.cs">
<DependentUpon>loadStarterKits.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -369,10 +366,6 @@
<Compile Include="Install\Steps\StarterKits.ascx.designer.cs">
<DependentUpon>StarterKits.ascx</DependentUpon>
</Compile>
<Compile Include="Install\Steps\Skinning\loadStarterKitDesigns.ascx.cs">
<DependentUpon>loadStarterKitDesigns.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Install\Steps\StepUserControl.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
@@ -735,8 +728,6 @@
<Content Include="Umbraco\Images\thumbs_med.png" />
<Content Include="Umbraco\Images\thumbs_smll.png" />
<Content Include="Umbraco\Images\Umbraco\settingView.gif" />
<Content Include="Umbraco\LiveEditing\Modules\ItemEditing\ItemEditing.js" />
<Content Include="Umbraco\LiveEditing\Modules\ItemEditing\ItemEditingInvoke.js" />
<Content Include="Umbraco\Plugins\UGoLive\cog.png" />
<Content Include="Umbraco\Plugins\UGoLive\cross.png" />
<Content Include="Umbraco\Plugins\UGoLive\Dashboard.ascx" />
@@ -1725,7 +1716,6 @@
<Content Include="Install\Steps\database.ascx" />
<Content Include="Install\Steps\renaming.ascx" />
<Content Include="Install\Steps\StarterKits.ascx" />
<Content Include="Install\Steps\Skinning\loadStarterKitDesigns.ascx" />
<Content Include="Install\Steps\Skinning\loadStarterKits.ascx" />
<Content Include="Install\Title.ascx" />
<Content Include="Install\InstallerRestService.aspx" />
@@ -1750,7 +1740,6 @@
<Content Include="Umbraco\Dashboard\StartupDashboardKits.ascx" />
<Content Include="Umbraco\Dashboard\StartupDashboardVideos.ascx" />
<Content Include="Umbraco\Developer\Packages\StarterKits.aspx" />
<Content Include="Umbraco\Dialogs\TemplateSkinning.aspx" />
<Content Include="Umbraco\helpRedirect.aspx" />
<Content Include="Umbraco\Images\aboutNew.png" />
<Content Include="Umbraco\Images\Editor\skin.gif" />
@@ -1760,20 +1749,6 @@
<Content Include="Umbraco\Images\SpeechBubble\speechbubble_top.png" />
<Content Include="Umbraco\Images\umbracoSplash.png" />
<Content Include="Umbraco\Images\Umbraco\settingSkin.gif" />
<Content Include="Umbraco\LiveEditing\Modules\SkinModule\CssParser.aspx" />
<Content Include="Umbraco\LiveEditing\Modules\SkinModule\Images\loader.gif" />
<Content Include="Umbraco\LiveEditing\Modules\SkinModule\ImageUploader.aspx" />
<Content Include="Umbraco\LiveEditing\Modules\SkinModule\Images\module.gif" />
<Content Include="Umbraco\LiveEditing\Modules\SkinModule\Js\disableInstallButtonsOnClick.js" />
<Content Include="Umbraco\LiveEditing\Modules\SkinModule\Js\initslider.js" />
<Content Include="Umbraco\LiveEditing\Modules\SkinModule\Js\ModuleInjection.js" />
<Content Include="Umbraco\LiveEditing\Modules\SkinModule\Js\SkinModuleShowOnStartup.js" />
<Content Include="Umbraco\LiveEditing\Modules\SkinModule\ModuleInjectionMacroRenderer.aspx" />
<Content Include="Umbraco\LiveEditing\Modules\SkinModule\ModuleInjector.aspx" />
<Content Include="Umbraco\LiveEditing\Modules\SkinModule\ModuleInstaller.aspx" />
<Content Include="Umbraco\LiveEditing\Modules\SkinModule\ModuleSelector.ascx" />
<Content Include="Umbraco\LiveEditing\Modules\SkinModule\Images\skin.gif" />
<Content Include="Umbraco\LiveEditing\Modules\SkinModule\SkinCustomizer.ascx" />
<Content Include="Umbraco\Members\MemberSearch.ascx" />
<Content Include="Umbraco_Client\Application\JQuery\jquery.idle-timer.js" />
<Content Include="Umbraco_Client\Colorpicker\Css\colorpicker.css" />
@@ -1804,7 +1779,6 @@
<Content Include="Umbraco_Client\Colorpicker\Images\select2.png" />
<Content Include="Umbraco_Client\Colorpicker\Images\slider.png" />
<Content Include="Umbraco_Client\Colorpicker\Js\colorpicker.js" />
<Content Include="Umbraco\LiveEditing\Modules\SkinModule\Js\initcolorpicker.js" />
<Content Include="Umbraco_Client\MacroContainer\macroContainer.css" />
<Content Include="Umbraco_Client\Mousewheel\jquery.mousewheel.js" />
<Content Include="Umbraco_Client\Ui\base2.js" />
@@ -1947,7 +1921,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\Css\umbLiveEditing.css" />
<Content Include="Umbraco\Developer\Packages\proxy.htm" />
<Content Include="Umbraco\Developer\Xslt\xsltVisualize.aspx" />
<Content Include="Umbraco\Dialogs\empty.htm" />
@@ -2120,18 +2093,6 @@
<Content Include="Umbraco\Js\UmbracoSpeechBubble.js" />
<Content Include="Umbraco\Js\UmbracoSpeechBubbleBackEnd.js" />
<Content Include="Umbraco\Js\umbracoUpgradeChecker.js" />
<Content Include="Umbraco\LiveEditing\Controls\Communicator.js" />
<Content Include="Umbraco\LiveEditing\Controls\LiveEditingToolbar.js" />
<Content Include="Umbraco\LiveEditing\Css\LiveEditing.css" />
<Content Include="Umbraco\LiveEditing\Images\dialog_background.png" />
<Content Include="Umbraco\LiveEditing\Images\canvas.gif" />
<Content Include="Umbraco\LiveEditing\Modules\CreateModule\create.png" />
<Content Include="Umbraco\LiveEditing\Modules\CreateModule\CreateModule.js" />
<Content Include="Umbraco\LiveEditing\Modules\DeleteModule\delete.png" />
<Content Include="Umbraco\LiveEditing\Modules\DeleteModule\DeleteModule.js" />
<Content Include="Umbraco\LiveEditing\Modules\MacroModule\MacroModule.js" />
<Content Include="Umbraco\LiveEditing\Modules\UnpublishModule\unpublish.png" />
<Content Include="Umbraco\LiveEditing\Modules\UnpublishModule\UnpublishModule.js" />
<Content Include="Umbraco\Members\ViewMembers.aspx" />
<Content Include="Umbraco\Plugins\Tinymce3\insertImage.aspx" />
<Content Include="Umbraco\Plugins\Tinymce3\insertLink.aspx" />
@@ -2205,7 +2166,6 @@
<SubType>Designer</SubType>
</None>
<Content Include="Umbraco\Dashboard\Air\DesktopMediaUploader.air" />
<None Include="Umbraco\LiveEditing\LiveEditing.cd" />
<Content Include="Umbraco\Masterpages\umbracoPage.Master" />
<Content Include="Umbraco\Masterpages\umbracoDialog.Master" />
<Content Include="Umbraco\Search\QuickSearchHandler.ashx" />
@@ -2234,7 +2194,6 @@
<Content Include="Umbraco\Images\Umbraco\settingsScript.gif" />
<Content Include="Umbraco\Settings\DictionaryItemList.aspx" />
<Content Include="Umbraco\Settings\Scripts\editScript.aspx" />
<Content Include="Umbraco\canvas.aspx" />
<Content Include="Umbraco\Translation\default.aspx" />
<Content Include="Umbraco\Translation\preview.aspx" />
<Content Include="Umbraco\Translation\xml.aspx" />

View File

@@ -1,69 +0,0 @@
<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="LoadStarterKitDesigns.ascx.cs" Inherits="Umbraco.Web.UI.Install.Steps.Skinning.LoadStarterKitDesigns" %>
<%@ Import Namespace="umbraco.cms.businesslogic.packager.repositories" %>
<asp:PlaceHolder ID="pl_loadStarterKitDesigns" runat="server">
<asp:Panel id="pl_CustomizeSkin" runat="server" Visible="false">
<h3>Starter kit and skin have been installed</h3>
<p id="customizelink"><a target="_blank" href="<%= umbraco.GlobalSettings.Path %>/canvas.aspx?redir=<%= this.ResolveUrl("~/") %>&umbSkinning=true&umbSkinningConfigurator=true" target="_blank">Browse and customize your new site</a></p>
</asp:Panel>
<div id="skinselector">
<asp:Repeater ID="rep_starterKitDesigns" runat="server">
<HeaderTemplate>
<!-- gallery -->
<div class="gallery">
<a href="#" class="btn-prev"><span>prev</span></a>
<a href="#" class="btn-next"><span>next</span></a>
<div class="hold">
<div class="gal-box">
<div class="box zoom-list2">
<ul>
</HeaderTemplate>
<ItemTemplate>
<li>
<div class="image-hold">
<img class="faik-mask" src="<%=umbraco.GlobalSettings.ClientPath + "/installer/images/bg-img.png" %>" alt="image description" width="152" height="129">
<img class="faik-mask-ie6" src="<%=umbraco.GlobalSettings.ClientPath + "/installer/images/bg-img-ie.png" %>" alt="image description" width="201" height="178">
<div class="image">
<img class="zoom-img" src="<%# ((Skin)Container.DataItem).Thumbnail %>" alt="<%# ((Skin)Container.DataItem).Text %>" width="134" height="103">
<div class="gal-drop">
<a href="#lightbox" class="btn-preview" title="<%# ((Skin)Container.DataItem).Text %>"><span>Preview</span></a>
<asp:LinkButton CssClass="single-tab btn-install-gal" ID="bt_selectKit" runat="server" onclick="SelectStarterKitDesign" CommandArgument="<%# ((Skin)Container.DataItem).RepoGuid %>" ToolTip="<%# ((Skin)Container.DataItem).Text %>"><span>Install</span></asp:LinkButton>
<div class="gal-desc" style="display: none"><%# ((Skin)Container.DataItem).Description %></div>
<div class="gal-owner" style="display: none">Created by: <a href="<%# ((Skin)Container.DataItem).AuthorUrl %>" target="_blank"><%# ((Skin)Container.DataItem).Author %></a></div>
</div>
</div>
</div>
</li>
</ItemTemplate>
<FooterTemplate>
</ul>
</div>
<!-- paging -->
<div class="paging">
<div class="w1">
<div class="w2">
<span>Pages:</span>
<ul class="swicher">
<li class="active"><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
</ul>
</div>
</div>
</div>
</div></div></div>
</FooterTemplate>
</asp:Repeater>
</div>
</asp:PlaceHolder>

View File

@@ -1,162 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Web.Install;
using umbraco;
using GlobalSettings = global::Umbraco.Core.Configuration.GlobalSettings;
namespace Umbraco.Web.UI.Install.Steps.Skinning
{
public delegate void StarterKitDesignInstalledEventHandler();
public partial class LoadStarterKitDesigns : StepUserControl
{
public event StarterKitDesignInstalledEventHandler StarterKitDesignInstalled;
protected virtual void OnStarterKitDesignInstalled()
{
if (StarterKitDesignInstalled != null)
StarterKitDesignInstalled();
}
public Guid StarterKitGuid { get; set; }
private readonly global::umbraco.cms.businesslogic.packager.repositories.Repository _repo;
private const string RepoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66";
public LoadStarterKitDesigns()
{
_repo = global::umbraco.cms.businesslogic.packager.repositories.Repository.getByGuid(RepoGuid);
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
if (_repo == null)
{
throw new InvalidOperationException("Could not find repository with id " + RepoGuid);
}
if (_repo.HasConnection())
{
try
{
//clear progress bar cache
InstallHelper.ClearProgress();
var skinsCollection = _repo.Webservice.Skins(StarterKitGuid.ToString());
var numberOfSkins = skinsCollection.Length;
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "skinCounter", "var numberOfSkins = " + numberOfSkins, true);
rep_starterKitDesigns.DataSource = skinsCollection;
rep_starterKitDesigns.DataBind();
}
catch (Exception ex)
{
LogHelper.Error<LoadStarterKitDesigns>("An error occurred initializing", ex);
ShowConnectionError();
}
}
else
{
ShowConnectionError();
}
}
private void ShowConnectionError()
{
var fb = new global::umbraco.uicontrols.Feedback
{
type = global::umbraco.uicontrols.Feedback.feedbacktype.error,
Text = "<strong>No connection to repository.</strong> Starter Kits Designs could not be fetched from the repository as there was no connection to: '" + _repo.RepositoryUrl + "'"
};
pl_loadStarterKitDesigns.Controls.Clear();
pl_loadStarterKitDesigns.Controls.Add(fb);
}
protected void SelectStarterKitDesign(object sender, EventArgs e)
{
InstallHelper.ClearProgress();
var kitGuid = new Guid(((LinkButton)sender).CommandArgument);
if (!global::umbraco.cms.businesslogic.skinning.Skinning.IsSkinInstalled(kitGuid))
{
InstallHelper.SetProgress(5, "Fetching starting kit from the repository", "");
var installer = new global::umbraco.cms.businesslogic.packager.Installer();
if (_repo.HasConnection())
{
var p = new global::umbraco.cms.businesslogic.packager.Installer();
InstallHelper.SetProgress(15, "Connected to repository", "");
string tempFile = p.Import(_repo.fetch(kitGuid.ToString()));
p.LoadConfig(tempFile);
int pID = p.CreateManifest(tempFile, kitGuid.ToString(), RepoGuid);
InstallHelper.SetProgress(30, "Installing skin files", "");
p.InstallFiles(pID, tempFile);
InstallHelper.SetProgress(50, "Installing skin system objects", "");
p.InstallBusinessLogic(pID, tempFile);
InstallHelper.SetProgress(60, "Finishing skin installation", "");
p.InstallCleanUp(pID, tempFile);
library.RefreshContent();
InstallHelper.SetProgress(80, "Activating skin", "");
if (global::umbraco.cms.businesslogic.skinning.Skinning.GetAllSkins().Count > 0)
{
global::umbraco.cms.businesslogic.skinning.Skinning.ActivateAsCurrentSkin(
global::umbraco.cms.businesslogic.skinning.Skinning.GetAllSkins()[0]);
}
InstallHelper.SetProgress(100, "Skin installation has been completed", "");
try
{
if (string.IsNullOrEmpty(GlobalSettings.ConfigurationStatus))
{
GlobalSettings.ConfigurationStatus = UmbracoVersion.Current.ToString(3);
}
}
catch
{
}
try
{
InstallHelper.RedirectToNextStep(Page, GetCurrentStep());
}
catch
{
OnStarterKitDesignInstalled();
}
}
else
{
ShowConnectionError();
}
}
}
}
}

View File

@@ -1,42 +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 LoadStarterKitDesigns {
/// <summary>
/// pl_loadStarterKitDesigns 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_loadStarterKitDesigns;
/// <summary>
/// pl_CustomizeSkin 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_CustomizeSkin;
/// <summary>
/// rep_starterKitDesigns 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_starterKitDesigns;
}
}

View File

@@ -10,10 +10,7 @@ namespace Umbraco.Web.UI.Install.Steps
protected void Page_Load(object sender, EventArgs e)
{
if (!global::umbraco.cms.businesslogic.skinning.Skinning.IsStarterKitInstalled())
ShowStarterKits();
else
ShowStarterKitDesigns((Guid)global::umbraco.cms.businesslogic.skinning.Skinning.StarterKitGuid());
ShowStarterKits();
}
@@ -26,19 +23,6 @@ namespace Umbraco.Web.UI.Install.Steps
}
private void ShowStarterKitDesigns(Guid starterKitGuid)
{
var ctrl = (LoadStarterKitDesigns)LoadControl(SystemDirectories.Install + "/steps/Skinning/loadStarterKitDesigns.ascx");
ctrl.ID = "StarterKitDesigns";
ctrl.StarterKitGuid = starterKitGuid;
ph_starterKitDesigns.Controls.Add(ctrl);
pl_starterKit.Visible = false;
pl_starterKitDesign.Visible = true;
}
}
}

View File

@@ -20,10 +20,7 @@ namespace Umbraco.Web.UI.Install.Steps
// Update ClientDependency version
var clientDependencyConfig = new ClientDependencyConfiguration();
var clientDependencyUpdated = clientDependencyConfig.IncreaseVersionNumber();
if (!global::umbraco.cms.businesslogic.skinning.Skinning.IsStarterKitInstalled())
customizeSite.Visible = false;
}
}

View File

@@ -11,14 +11,5 @@ namespace Umbraco.Web.UI.Install.Steps {
public partial class TheEnd {
/// <summary>
/// customizeSite 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 customizeSite;
}
}

View File

@@ -31,8 +31,7 @@ jQuery(document).ready(function () {
source .NET CMS.
<br />
If you installed a starter kit you can start by configuring your new site, just click &quot;Preview your new website&quot; and follow the instructions. Or to start adding content right away click &quot;Set up your new website&quot; </p>
<ul class="btn-web">
<li class="btn-preview-web" id="customizeSite" runat="server"><a href="<%= IOHelper.ResolveUrl(SystemDirectories.Umbraco) %>/canvas.aspx?redir=<%= this.ResolveUrl("~/") %>&umbSkinning=true&umbSkinningConfigurator=true" target="_blank"><span>Set up your new website</span></a></li>
<ul class="btn-web">
<li class="btn-set"><a href="<%= IOHelper.ResolveUrl(SystemDirectories.Umbraco) %>/"><span>Launch umbraco</span></a></li>
</ul>
</div>

View File

@@ -1,33 +0,0 @@
// Umbraco Live Editing: Communicator
/********************* Communicator Constructor *********************/
function UmbracoCommunicator() { }
/********************* Communicator Methods *********************/
// Sends a message to the client using the communicator.
UmbracoCommunicator.prototype.SendClientMessage = function(type, message) {
// find the communicator
var divs = document.getElementsByTagName("div");
var communicator = null;
for (var i = 0; i < divs.length && communicator == null; i++)
if (divs[i].className == "communicator")
communicator = divs[i];
Sys.Debug.assert(communicator != null, "LiveEditing: Communicator not found.");
// send the message
var typeBox = communicator.childNodes[0].childNodes[0];
var messageBox = communicator.childNodes[0].childNodes[1];
var submit = communicator.childNodes[0].childNodes[2];
typeBox.value = type;
messageBox.value = message;
submit.click();
}
/********************* Communicator Instance *********************/
var UmbracoCommunicator = new UmbracoCommunicator();

View File

@@ -1,99 +0,0 @@
Type.registerNamespace("umbraco.presentation.LiveEditing.Controls");
/************************************ Toolbar class ***********************************/
// Constructor.
umbraco.presentation.LiveEditing.Controls.LiveEditingToolbar = function() {
umbraco.presentation.LiveEditing.Controls.LiveEditingToolbar.initializeBase(this);
this._inited = false;
// init toolbar on application load
var liveEditingToolbar = this;
Sys.Application.add_load(function() { liveEditingToolbar._init(); });
}
umbraco.presentation.LiveEditing.Controls.LiveEditingToolbar.prototype = {
// Initialize the toolbar.
_init: function() {
if (!this._inited) {
var liveEditingToolbar = this;
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function(sender, args) { liveEditingToolbar._handleError(sender, args); });
this._inited = true;
}
},
// Fires the Save event.
_save: function() {
var handler = this.get_events().getHandler("save");
var args = new Sys.EventArgs();
args.cancel = false;
if (handler)
handler(this, args);
if (!args.cancel) {
this.setDirty(false);
UmbSpeechBubble.ShowMessage("Info", "Saving", "Save in progress...");
}
return !args.cancel;
},
// Adds a listener for the Save event.
add_save: function(handler) {
this.get_events().addHandler("save", handler);
},
// Removes a listener for the Save event.
remove_save: function(handler) {
this.get_events().removeHandler("save", handler);
},
// Fires the Save and Publish event.
_saveAndPublish: function() {
var handler = this.get_events().getHandler("saveAndPublish");
var args = new Sys.EventArgs();
args.cancel = false;
if (handler)
handler(this, args);
if (!args.cancel) {
this.setDirty(false);
UmbSpeechBubble.ShowMessage("Info", "Publishing", "Save and publish in progress...");
}
return !args.cancel;
},
// Adds a listener for the Save and Publish event.
add_saveAndPublish: function(handler) {
this.get_events().addHandler("saveAndPublish", handler);
},
// Removes a listener for the Save and Publish event.
remove_saveAndPublish: function(handler) {
this.get_events().removeHandler("saveAndPublish", handler);
},
// Sets whether the pages has unsaved changes.
setDirty: function(isDirty) {
window.onbeforeunload = isDirty ? function() { return "You have unsaved changes."; } : null;
},
// Global error handler. Displays a tooltip with the error message.
_handleError: function(sender, args) {
if (args.get_error() != undefined) {
var errorMessage;
if (args.get_response().get_statusCode() == '200') {
errorMessage = args.get_error().message;
}
else {
errorMessage = "An unspecified error occurred.";
}
args.set_errorHandled(true);
UmbSpeechBubble.ShowMessage("info", "Error", errorMessage);
}
}
}
// Register the class and create a global instance.
umbraco.presentation.LiveEditing.Controls.LiveEditingToolbar.registerClass("umbraco.presentation.LiveEditing.Controls.LiveEditingToolbar", Sys.Component);
var LiveEditingToolbar = new umbraco.presentation.LiveEditing.Controls.LiveEditingToolbar();

View File

@@ -1,370 +0,0 @@
/*****************************************************************
Live Editing placeholders
/****************************************************************/
umbraco\:iteminfo {
cursor: pointer;
border: 1px dashed #bbb;
padding: 5px;
}
.liveEditingForceBlockMode {
display: block;
}
umbraco\:iteminfo:hover
{
border: 2px dashed #f36f21;
padding: 5px;
}
/*****************************************************************
General Toolbar CSS
/****************************************************************/
html {
margin-top: 30px !important;
}
#LiveEditingToolbar
{
font-family:"Trebuchet MS",verdana,arial;
background: url(../../../umbraco_client/tabView/images/background.gif) !important;
position: fixed !important;
width: 100% !important;
height: 34px !important;
top: 0 !important;
left: 0 !important;
text-align: left !important;
border-bottom: 1px solid #B0B0B0 !important;
}
#LiveEditingToolbar div {
padding: 4px !important;
}
#LiveEditingToolbar div div {
padding: inherit !important;
}
#LiveEditingToolbar div.ExtraMenuItems {
display: inline !important;
}
#LiveEditingToolbar div {
/*background: url(/umbraco/LiveEditing/Images/Canvas.gif) no-repeat right 4px; */
width: 100%;
}
#LiveEditingToolbar * div {
background: none;
width: auto;
}
#LiveEditingToolbar input.button {
cursor: hand !important;
width: 22px !important;
height: 23px !important;
background: none !important;
border: none !important;
}
#LiveEditingToolbar input.button:hover, #LiveEditingClientToolbar a.mceButtonEnabled:hover {
background-image: url(../../../umbraco_client/menuicon/images/buttonbg.gif) !important;
border: none !important;
}
#LiveEditingToolbar input.close {
position: absolute !important;
right: 7px !important;
top: 6px !important;
/*border: none !Important;
background: none !Important; */
color: #000;
width: 150px;
}
#LiveEditingToolbar input.close:hover {
opacity: 1 !important;
}
#LiveEditingToolbar img.about {
margin: 0 5px 5px 5px !important;
}
#LiveEditingClientToolbar, #LiveEditingClientToolbar div {
display: inline !important;
}
#LiveEditingToolbar span.separator {
padding-right: 7px !important;
}
#LiveEditingToolbar span.separator span {
border-left: 1px solid #999999 !important;
border-right: 1px solid #EEEEEE !important;
position: absolute !important;
top: 7px !important;
width: 0px !important;
overflow: hidden !important;
}
#LiveEditingToolbar .umbLabelButton
{
cursor: hand !important;
float: left;
margin: 1px 5px 1px 1px;
padding: 0 !important;
}
#LiveEditingToolbar .umbLabelButton:hover
{
background: #EAEAEA;
border: 1px solid #CAC9C9 !Important;
margin: 0px 4px 0px 0px;
}
#LiveEditingToolbar .umbLabelButton a
{
text-decoration: none;
font-size: 80%;
margin-right: 3px;
padding: 5px 0;
}
#LiveEditingToolbar .umbLabelButton input.button {
width: 22px !important;
height: 23px !important;
margin-right: 3px;
background: none !important;
border: none !important;
vertical-align: middle;
}
#LiveEditingToolbar .umbLabelButton input.button:hover {
background-image: none !important;
border: none !important;
}
/*****************************************************************
TinyMCE extra CSS
/****************************************************************/
/* hide the temporary TinyMCE container */
.tinymceContainer {
position: absolute !important;
left: -1000px !important;
}
#LiveEditingClientToolbar .mceToolbarExternal table {
display: inline !important;
background: none !important;
margin: 0 !important;
}
#LiveEditingClientToolbar .mceToolbarExternal {
position: absolute !important;
top: 0 !important;
}
#LiveEditingClientToolbar a.mceButtonEnabled {
width: 22px !important;
height: 23px !important;
}
/*****************************************************************
Datatypes extra CSS
/****************************************************************/
.relatedlinksdatatype
{
background-color: #fff !important;
border: 1px solid #999 !important;
}
/*****************************************************************
Modal dialogs
/****************************************************************/
.umbModalBox h1
{
font-size: larger !important;
}
.umbModalBox h2
{
font-size: medium !important;
}
.umbModalBox label
{
padding-bottom: 2px !Important;
display: block !Important;
color: #666 !Important;
font-family:Trebuchet MS,Lucida Grande,verdana,arial ! important;
}
.umbModalBox p
{
font-size: 12px !important;
font-family:Trebuchet MS,Lucida Grande,verdana,arial ! important;
color:Black ! important;
margin-bottom:5px;
}
.umbModalBox p select
{
margin-bottom:10px ! important;
}
.umbModalBox p{font-size: 11px !Important}
#skins ul{list-style: none; padding: 0px; display: block; clear: both; height: 200px;}
#skins ul li{margin-right: 12px; float: left; border: 1px solid #efefef; padding: 5px; width: 120px; text-align: center; font-weight: normal;}
/*****************************************************************
Umbraco UI Components
/****************************************************************/
.propertypane {
position: relative;
display: block;
line-height: 1.1;
background: #fff url('/umbraco_client/propertypane/images/propertyBackground.gif') top repeat-x !Important;
background-image:url(/umbraco_client/propertypane/images/propertyBackground.gif) !Important;
padding: 5px;
margin:7px 0px 0px 0px;
border: 1px solid #d9d7d7;
text-align:left;
clear: both;
float: none;
color: black;
font-size: 11px !Important;
}
.propertypane th
{
vertical-align: top;
text-align:left;
font-weight:bold;
font-family: Trebuchet MS, Lucida Grande, verdana, arial;
font-size:12px;
width: 16%;
}
.propertypane,.propertypane td
{
font-family: Trebuchet MS, Lucida Grande, verdana, arial;
font-size:12px;
}
.propertypane small
{
font-weight: normal;
color: #666;
}
.propertypane div.propertyItem{
padding-bottom: 5px;
clear: both;
font-family: Trebuchet MS, Lucida Grande, verdana, arial;
font-size:12px;
}
.propertypane div.propertyItem .propertyItemheader{
width: 16%;
padding-right: 1%;
padding-bottom: 10px;
float: left;
clear: left;
font-weight:bold;
}
.propertypane div.propertyItem .propertyItemContent{
float: left;
padding-bottom: 5px;
clear: right;
}
h2.propertypaneTitel{font-size: 14px; color: #999;margin: 7px 0px 0px 0px; padding-bottom: 0px; line-height: 14px;}
div.propertyPaneFooter{clear: both; height: 1px; overflow: hidden; color: #fff;}
#LiveEditingToolbar .ModuleSelector
{
background-color:#FFF !important;
position:absolute;
top:36px;
left:270px;
color:#000;
border-left:5px solid #A3A3A3;
border-right:5px solid #A3A3A3;
border-bottom:5px solid #A3A3A3;
z-index:100;
}
#LiveEditingToolbar #moduleSelectorContainer
{
padding:10px;
}
.umbModuleContainerSelector
{
cursor:pointer;
}
p#installingModule img
{
float:none;
margin:0;
padding:0;
}
#LiveEditingToolbar #modules ul
{
list-style-type:none;
margin-left:0px;
margin-right:0px;
}
#LiveEditingToolbar #modules ul li
{
display:block;
padding-bottom:5px;
padding-top:5px;
border-bottom:1px solid #c3c3c3;
}
#LiveEditingToolbar .umbLabelButton a, #LiveEditingToolbar .umbLabelButton a:hover
{
color:Black !important;
}
.umbModalBox a, .umbModalBox a:hover
{
color:#888 !important;
}
/* skin customize dialog */
#costumizeSkin #dependencies .propertypane
{
height:205px;
overflow:scroll;
overflow-x: hidden;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1009 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -1,65 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram MajorVersion="1" MinorVersion="1">
<Class Name="umbraco.presentation.UmbracoContext">
<Position X="0.5" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAACAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAgACAA=</HashCode>
<FileName>UmbracoContext.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Property Name="LiveEditingContext" />
</ShowAsAssociation>
</Class>
<Class Name="umbraco.presentation.LiveEditing.Controls.LiveEditingManager">
<Position X="3.5" Y="2.25" Width="1.75" />
<TypeIdentifier>
<HashCode>AAABAAAAQAAEIhAAEAEAAAAQAAAAAEQAAAAAFAgAEAA=</HashCode>
<FileName>umbraco\LiveEditing\Controls\LiveEditingManager.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="m_Toolbar" />
<Field Name="m_Communicator" />
<Field Name="m_Context" />
</ShowAsAssociation>
</Class>
<Class Name="umbraco.presentation.LiveEditing.Controls.LiveEditingToolbar" Collapsed="true">
<Position X="6.75" Y="2.25" Width="1.5" />
<TypeIdentifier>
<HashCode>BAAAAAAAAAIAKBAAAGCAIAAQAAAAAAQAAFgAAAABAAA=</HashCode>
<FileName>umbraco\LiveEditing\Controls\LiveEditingToolbar.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="umbraco.presentation.LiveEditing.Controls.Communicator" Collapsed="true">
<Position X="6.75" Y="3" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAQAAAABAQAECAAAAgAAAAAAQAABBAAAAQAAA=</HashCode>
<FileName>umbraco\LiveEditing\Controls\Communicator.cs</FileName>
</TypeIdentifier>
</Class>
<Interface Name="umbraco.presentation.LiveEditing.ILiveEditingContext">
<Position X="3.5" Y="0.5" Width="1.75" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAIAAAAAAAAAAAAAIAAAAAAAAAgAAAAA=</HashCode>
<FileName>umbraco\LiveEditing\ILiveEditingContext.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Property Name="Menu" />
<Property Name="Updates" />
</ShowAsAssociation>
</Interface>
<Interface Name="umbraco.presentation.LiveEditing.Menu.ILiveEditingMenu" Collapsed="true">
<Position X="6.75" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>umbraco\LiveEditing\Menu\ILiveEditingMenu.cs</FileName>
</TypeIdentifier>
</Interface>
<Interface Name="umbraco.presentation.LiveEditing.Updates.IUpdateList" Collapsed="true">
<Position X="6.75" Y="1.25" Width="1.5" />
<TypeIdentifier>
<HashCode>AAIAAAAAAAAAAAABAAAAAGAAAAAAAAAAAgAAAAAAIAA=</HashCode>
<FileName>umbraco\LiveEditing\Updates\IUpdateList.cs</FileName>
</TypeIdentifier>
</Interface>
<Font Name="Tahoma" Size="8.25" />
</ClassDiagram>

View File

@@ -1,5 +0,0 @@
/********************* Live Editing CreateModule functions *********************/
function CreateModuleOk()
{
UmbracoCommunicator.SendClientMessage('createcontent', '');
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -1,5 +0,0 @@
/********************* Live Editing DeleteModule functions *********************/
function DeleteModuleOk()
{
UmbracoCommunicator.SendClientMessage('deletecontent', '');
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -1,341 +0,0 @@
// Umbraco Live Editing - ItemEditing: Item Editing
var ItemEditing = null;
Type.registerNamespace("umbraco.presentation.LiveEditing");
/************************ ItemEditing class ************************/
// Creates a new instance of the ItemEditing class.
umbraco.presentation.LiveEditing.ItemEditing = function() {
umbraco.presentation.LiveEditing.ItemEditing.initializeBase(this);
this._inited = false;
this._items = new Array();
this._activeItem = null;
this._editControl = null;
this._submitControl = null;
var _this = this;
Sys.Debug.trace("Constructor, before init load");
if (!this._inited) {
_this.init();
}
Sys.Application.add_load(function() {
_this.init();
});
Sys.Debug.trace("Constructor, after init load");
}
umbraco.presentation.LiveEditing.ItemEditing.prototype = {
// Initializes this instance.
init: function() {
Sys.Debug.trace("In init...");
if (!this._inited) {
this._inited = true;
Sys.Debug.trace("Live Editing - ItemEditing: Initialization.");
Sys.Debug.assert(typeof (jQuery) == 'function', "jQuery is not loaded.");
this.itemsEnable();
var _this = this;
LiveEditingToolbar.add_save(function(sender, args) { _this.delaySaveWhenEditing(args, "save"); });
LiveEditingToolbar.add_saveAndPublish(function(sender, args) { _this.delaySaveWhenEditing(args, "saveAndPublish"); });
this._inited = true;
Sys.Debug.trace("Live Editing - ItemEditing: Ready.");
}
else {
this.updateItems();
this.updateControls();
}
},
// Starts Live Editing the specified item.
// This method is triggered by the server.
startEdit: function(itemId) {
Sys.Debug.trace("Live Editing - ItemEditing: Start editing of Item " + itemId + ".");
this._activeItem = this._items[itemId];
Sys.Debug.assert(this._activeItem != null, "Live Editing - ItemEditing: Could not find item with ID " + itemId + ".");
this._editControl = this.getElementsByTagName("umbraco:control");
Sys.Debug.assert(this._editControl.length > 0, "Live Editing - ItemEditing: Could not find the editor control.");
//this._activeItem.jItem.fadeIn();
this.moveChildControls(this._editControl, this._activeItem.jItem);
// Only elements that are currently present, can cause item editing to stop.
// This enables transparent use of dynamically created elements (such as context/dropdown menus)
// as clicks on those elements will not trigger the stop edit signal.
jQuery("*").each(function () { jQuery(this).data("canStopEditing", true); });
// raise event
var handler = this.get_events().getHandler("startEdit");
if (handler)
handler(this, Sys.EventArgs.Empty);
this.ignoreChildClicks(this._activeItem.jItem);
LiveEditingToolbar.setDirty(true);
},
// Stops the editing of a specified item, and raises the stopEdit event.
stopEdit: function() {
if (this._activeItem != null) {
Sys.Debug.trace("Live Editing - ItemEditing: Stop editing of " + this._activeItem.toString() + ".");
// raise event
var handler = this.get_events().getHandler("stopEdit");
if (handler)
handler(this, Sys.EventArgs.Empty);
// submit changes
Sys.Debug.assert(this._submitControl != null, "Live Editing - ItemEditing: Submit button not set.");
this._submitControl.click();
// hide control
//this._activeItem.jItem.fadeOut();
this._activeItem = null;
this._submitControl = null;
this._editControl = null;
}
},
// Adds an event handler to the startEdit event.
add_startEdit: function(handler) {
this.get_events().addHandler("startEdit", handler);
},
// Removes an event handler from the startEdit event.
remove_startEdit: function(handler) {
this.get_events().removeHandler("startEdit", handler);
},
// Adds an event handler to the stopEdit event.
add_stopEdit: function(handler) {
this.get_events().addHandler("stopEdit", handler);
},
// Removes an event handler from the stopEdit event.
remove_stopEdit: function(handler) {
this.get_events().removeHandler("stopEdit", handler);
},
// Cancels the save method when an item is active, and postpones it to the next postback.
delaySaveWhenEditing: function(args, type) {
if (this._activeItem != null) {
this.stopEdit();
args.cancel = true;
(function() {
var f = function() {
Sys.Application.remove_load(f);
setTimeout(function() {
Sys.Debug.trace("Live Editing - Delayed Saving Changes to server");
UmbracoCommunicator.SendClientMessage(type, "");
}, 100);
}
Sys.Application.add_load(f);
})();
}
else {
Sys.Debug.trace("Live Editing - Saving Changes to server");
if (!Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()) {
UmbracoCommunicator.SendClientMessage(type, "");
}
else {
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function() {
UmbracoCommunicator.SendClientMessage(type, "");
});
}
}
},
// Enables Live Editing of items.
itemsEnable: function() {
var items = this.getElementsByTagName("umbraco:iteminfo");
Sys.Debug.trace(" Found " + items.length + " editable Umbraco item(s).");
// enhance items with edit functionality
var _this = this;
var i = 0;
items.each(function() {
var item = new umbraco.presentation.LiveEditing.activeItem(jQuery(this));
_this._items[item.itemId] = item;
Sys.Debug.trace(" " + (++i) + ". " + item.toString() + " is Live Editing enabled.");
});
// disable hyperlinks to make them clickable for Live Editing
this.disableHyperlinks();
// add "stop editing" handler when clicking outside the item
var _this = this;
jQuery(document).mousedown(function(event) {
Sys.Debug.trace("DOCUMENT CLICKED");
// the canStopEditing property is set in startEdit
if (_this._activeItem != null && jQuery(event.target).data("canStopEditing")) {
if (!_this._activeItem.clicked)
_this.stopEdit();
else
_this._activeItem.clicked = false;
}
});
jQuery("#LiveEditingToolbar").mousedown(function() {
Sys.Debug.trace("TOOLBAR CLICKED");
if (_this._activeItem != null)
_this._activeItem.clicked = true;
});
},
// Update items that have changed.
updateItems: function() {
var itemUpdates = this.getElementsByTagName("umbraco:itemupdate");
Sys.Debug.trace("Live Editing - ItemEditing: " + itemUpdates.length + " item update(s).");
var _this = this;
itemUpdates.each(function() {
var itemUpdate = jQuery(this);
var itemId = itemUpdate.attr("itemId");
var item = _this._items[itemId];
if (item != null) {
Sys.Debug.trace(" Updating " + item.toString() + ".");
// remove old children and add updates ones
_this.moveChildControls(itemUpdate, item.jItem);
//item.jItem.fadeIn();
// disable hyperlinks to make them clickable for Live Editing
_this.disableHyperlinks();
}
else {
itemUpdate.html("");
}
});
},
// Update controls that have changed.
updateControls: function() {
Sys.Debug.trace("Live Editing - ItemEditing: In updatecontrols");
var controlUpdates = this.getElementsByTagName("umbraco:control");
Sys.Debug.trace("Live Editing - ItemEditing: " + controlUpdates.length + " control update(s).");
if (controlUpdates.length == 1) {
if (this._activeItem != null && controlUpdates.children().length > 0) {
Sys.Debug.trace("Live Editing - ItemEditing: updating edit control.");
this.moveChildControls(controlUpdates, this._activeItem.jItem);
this.ignoreChildClicks();
}
this._submitControl = controlUpdates.next();
Sys.Debug.assert(this._submitControl.length > 0, "Live Editing - ItemEditing: Submit button not found.");
}
},
// ignores clicks on child elements of the control
ignoreChildClicks: function() {
var _this = this;
this._activeItem.jItem.children().mousedown(function(e) {
_this._activeItem.clicked = true;
});
},
// Moves the child controls from source into destination, overwriting existing elements.
moveChildControls: function(source, dest) {
Sys.Debug.trace("Live Editing - Moving Child Controls");
//remove contents in the destination
dest.html("");
//add the source to the destination
dest.append(source.html());
//remove teh contents from the source
source.html("");
},
// Gets a list of elements with the specified tagname including namespaced ones
getElementsByTagName: function(tagname) {
var found = jQuery("body").find("*").filter(function(index) {
if (this.nodeType != 3) {
var nn = this.nodeName.toLowerCase();
var ftn = tagname.toLowerCase();
var ln = (ftn.indexOf(":") > 0 ? ftn.substr(ftn.indexOf(":") + 1) : ftn);
return (nn == ftn
|| (typeof this.scopeName != "undefined" && nn == ln && this.scopeName.toLowerCase() == ftn.substr(0, ftn.indexOf(":"))));
}
return false;
});
Sys.Debug.trace("found " + found.length + " elements with selector: " + tagname);
return found;
},
// Disables hyperlinks inside the specified element.
disableHyperlinks: function() {
jQuery("a").click(function() {
return false;
});
}
}
umbraco.presentation.LiveEditing.ItemEditing.registerClass("umbraco.presentation.LiveEditing.ItemEditing", Sys.Component);
//an object to store the information for the active item
umbraco.presentation.LiveEditing.activeItem = function(item) {
//error checking
if (item != null && item.length != 1) {
return null;
}
//create the object with values, wire up events and return it
var obj = {
jItem: item,
nodeId: item.attr("nodeId"),
fieldName: item.attr("name"),
itemId: item.attr("itemId"),
clicked: false,
toString: function() {
return "Item " + this.itemId + " (node " + this.nodeId + ": " + this.fieldName + ")";
},
// Activates an item for editing.
activate: function() {
ItemEditing._items[this.itemId] = this;
if (this != ItemEditing._activeItem) {
Sys.Debug.trace("Live Editing - ItemEditing: " + this.toString() + " was activated.");
if (!Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()) {
UmbracoCommunicator.SendClientMessage("edititem", this.itemId);
}
else {
var itemId = this.itemId;
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function() {
if (itemId != 0) {
UmbracoCommunicator.SendClientMessage("edititem", itemId);
itemId = 0;
}
});
}
//this.jItem.fadeOut();
}
},
// Item click handler.
onClick: function(e) {
if (ItemEditing._activeItem != null && ItemEditing._activeItem.itemId == this.itemId) {
Sys.Debug.trace("Live Editing - ItemEditing: " + this.toString() + " click ignored because it is already active.");
}
else {
Sys.Debug.trace("Live Editing - ItemEditing: " + this.toString() + " was clicked.");
e.stopPropagation(); // disable click event propagation to parent elements
this.activate();
}
}
}
//keep the scope on the click event method call
obj.jItem.click(function(e) {
obj.onClick.call(obj, e);
});
return obj;
}
// global instance of the ItemEditing class
function initializeGlobalItemEditing() {
ItemEditing = new umbraco.presentation.LiveEditing.ItemEditing();
}

View File

@@ -1,3 +0,0 @@
//this is simply used for live editing in order to invoke a method from a previously lazy loaded script;
//alert("ItemEditingInvoke: " + initializeGlobalItemEditing);
initializeGlobalItemEditing();

View File

@@ -1,21 +0,0 @@
/********************* Live Editing MacroModule functions *********************/
function MacroOnDrop( sender, e )
{
var container = e.get_container();
var item = e.get_droppedItem();
var position = e.get_position();
//alert( String.format( "Container: {0}, Item: {1}, Position: {2}", container.id, item.id, position ) );
var instanceId = parseInt(item.getAttribute("InstanceId"));
var columnNo = parseInt(container.getAttribute("columnNo"));
var row = position;
}
function okAddMacro(sender, e)
{
$find('ModalMacro').hide();
/*__doPostBack('AddMacro', e); */
}

View File

@@ -1 +0,0 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CssParser.aspx.cs" Inherits="umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule.CssParser" %>

View File

@@ -1,193 +0,0 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ImageUploader.aspx.cs" Inherits="umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule.ImageUploader" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<!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 runat="server">
<title></title>
<style type="text/css">
<!--
#cropper {
cursor:move;
overflow:hidden;
width:<%= Request["w"] %>px;
height:<%= Request["h"] %>px;
clear:both;
border:1px solid #ccc;
background:#ccc;
margin: 5px 0px 15px 5px;
}
-->
</style>
<cc1:UmbracoClientDependencyLoader runat="server" id="ClientLoader" />
<umb:CssInclude ID="CssInclude1" runat="server" FilePath="ui/ui-lightness/jquery-ui.custom.css" PathNameAlias="UmbracoClient" />
<umb:CssInclude ID="CssInclude2" runat="server" FilePath="ui/default.css" PathNameAlias="UmbracoClient" />
<umb:JsInclude ID="JsInclude1" runat="server" FilePath="ui/jquery.js" PathNameAlias="UmbracoClient"
Priority="0" />
<umb:JsInclude ID="JsInclude2" runat="server" FilePath="ui/jqueryui.js" PathNameAlias="UmbracoClient"
Priority="1" />
<umb:JsInclude ID="JsInclude3" runat="server" FilePath="mousewheel/jquery.mousewheel.js" PathNameAlias="UmbracoClient"
Priority="2" />
<script type="text/javascript">
function setImage() {
var val = $('#<%= Image.ClientID %>').val();
top.jQuery('#<%= Request["ctrl"] %>').val(val);
top.jQuery('#<%= Request["ctrl"] %>').trigger('change');
closeModal();
}
function closeModal() {
top.jQuery('.umbModalBoxIframe').closest(".umbModalBox").ModalWindowAPI().close();
return false;
}
</script>
<script type="text/javascript">
var sliderChange = function (e, ui) {
if (origwidht == 0) {
origwidht = $('#<%= Image1.ClientID %>').width();
}
if (origheight == 0) {
origheight = $('#<%= Image1.ClientID %>').height();
}
$('#cropper img').each(function (index, item) {
var _new = $('#slider').slider("value");
$('#<%= Scale.ClientID %>').val(_new);
$(this).width(origwidht * (_new / 100));
$(this).height(origheight * (_new / 100));
});
}
var origheight = 0;
var origwidht = 0;
$(function () {
if(<%= Request["w"] %> > <%= MaxWidth %> || <%= Request["h"] %> > <%= MaxHeight %>)
{
$("#cropper").css('width', <%= Request["w"] %> / 2);
$("#cropper").css('height', <%= Request["h"] %> / 2);
}
$("#<%= Image1.ClientID %>").draggable({
stop: function () {
$('#<%= X.ClientID %>').val($("#<%= Image1.ClientID %>").css('left').replace('px', ''));
$('#<%= Y.ClientID %>').val($("#<%= Image1.ClientID %>").css('top').replace('px', ''));
}
});
$('#slider').slider({ change: sliderChange, slide: sliderChange, min: 5, max: 200, value: 100 });
$('#cropper').mousewheel(function (event, delta, deltaX, deltaY) {
var speed = 5;
var mySlider = $("#slider");
var sliderVal = mySlider.slider("option", "value");
sliderVal += (delta * speed);
if (sliderVal > mySlider.slider("option", "max")) sliderVal = mySlider.slider("option", "max");
else if (sliderVal < mySlider.slider("option", "min")) sliderVal = mySlider.slider("option", "min");
$("#slider").slider("value", sliderVal);
return false;
});
});
function ResetToDefault() {
$("#slider").slider("value", 100);
$('#cropper img').css('left','0px')
$('#cropper img').css('top','0px');
$('#<%= X.ClientID %>').val(0);
$('#<%= Y.ClientID %>').val(0);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:HiddenField ID="Image" runat="server" />
<asp:HiddenField ID="FileName" runat="server" />
<asp:HiddenField ID="X" runat="server" Value="0"/>
<asp:HiddenField ID="Y" runat="server" Value="0"/>
<asp:HiddenField ID="Scale" runat="server" Value="100"/>
<cc1:Feedback ID="fb_feedback1" runat="server" />
<asp:PlaceHolder ID="pnl_upload" runat="server">
<cc1:Pane Text="Upload image file" runat="server">
<cc1:PropertyPanel runat="server" Text="Select a image file <br/><small>jpg, gif and png files can be used</small>">
<asp:FileUpload ID="FileUpload1" runat="server" />
</cc1:PropertyPanel>
</cc1:Pane>
<p style="margin-top: 20px;">
<asp:Button ID="bt_upload" runat="server" Text="Upload" onclick="bt_upload_Click" /> <em> or </em> <a href="#" onclick="closeModal();">Cancel</a>
</p>
</asp:PlaceHolder>
<asp:PlaceHolder ID="pnl_crop" runat="server" Visible="false">
<cc1:Pane runat="server" Text="Crop and scale image">
<cc1:PropertyPanel runat="server" Text="Crop <br /><small>Drag image with mouse to selct crop area</small>">
<div id="cropper">
<asp:Image ID="Image1" runat="server" />
</div>
</cc1:PropertyPanel>
<cc1:PropertyPanel runat="server" Text="Scale <br /><small>Drag slider to choose size</small>" >
<div id="slidercontainer" style="width: <%= scaleWidth %>">
<div id="slider"></div>
</div>
</cc1:PropertyPanel>
</div>
</cc1:Pane>
<p style="margin-top: 20px;">
<asp:Button ID="bt_crop" runat="server" Text="OK" onclick="bt_crop_Click" /> <em> or </em> <a href="#" onclick="closeModal();">Cancel</a>
</p>
</asp:PlaceHolder>
</form>
</body>
</html>

View File

@@ -1 +0,0 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ModuleInjectionMacroRenderer.aspx.cs" Inherits="umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule.ModuleInjectionMacroRenderer" %>

View File

@@ -1,141 +0,0 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ModuleInjector.aspx.cs" Inherits="umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule.ModuleInjector" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<%@ Import Namespace="Umbraco.Core.Configuration" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<!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 runat="server">
<title></title>
<cc1:UmbracoClientDependencyLoader runat="server" id="ClientLoader" />
<umb:JsInclude ID="JsInclude1" runat="server" FilePath="ui/jquery.js" PathNameAlias="UmbracoClient"
Priority="0" />
<umb:CssInclude ID="CssInclude1" runat="server" FilePath="ui/default.css" PathNameAlias="UmbracoClient" />
<umb:CssInclude ID="CssInclude2" runat="server" FilePath="modal/style.css" PathNameAlias="UmbracoClient" />
<umb:CssInclude ID="CssInclude3" runat="server" FilePath="propertypane/style.css" PathNameAlias="UmbracoClient" />
<style type="text/css">
.propertyItemheader
{
width: 170px !important;
}
.guiInputTextStandard
{
width: 220px;
}
</style>
<script type="text/javascript">
var macroAliases = new Array();
var macroAlias = '<%= _macroAlias %>';
<%if (UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages) { %>
var macroElement = "umbraco:Macro";
<%}else{ %>
var macroElement = "?UMBRACO_MACRO";
<%}%>
function registerAlias(alias, pAlias) {
var macro = new Array();
macro[0] = alias;
macro[1] = pAlias;
macroAliases[macroAliases.length] = macro;
}
function updateMacro() {
var macroString = '<' + macroElement + ' ';
for (i=0; i<macroAliases.length; i++) {
var controlId = macroAliases[i][0];
var propertyName = macroAliases[i][1];
var control = jQuery("#" + controlId);
if (control == null || (!control.is('input') && !control.is('select'))) {
// hack for tree based macro parameter types
var picker = Umbraco.Controls.TreePicker.GetPickerById(controlId);
if (picker != undefined) {
macroString += propertyName + "=\"" + picker.GetValue() + "\" ";
}
} else {
if (control.is(':checkbox')) {
if (control.is(':checked'))
macroString += propertyName + "=\"1\" ";
else
macroString += propertyName + "=\"0\" ";
} else if (control[0].tagName.toLowerCase() == 'select') {
var tempValue = '';
control.find(':selected').each(function(i, selected) {
tempValue += jQuery(this).attr('value') + ', ';
});
/*
for (var j=0; j<document.forms[0][controlId].length;j++) {
if (document.forms[0][controlId][j].selected)
tempValue += document.forms[0][controlId][j].value + ', ';
}
*/
if (tempValue.length > 2)
tempValue = tempValue.substring(0, tempValue.length-2)
macroString += propertyName + "=\"" + tempValue + "\" ";
}else {
macroString += propertyName + "=\"" + pseudoHtmlEncode(document.forms[0][controlId].value) + "\" ";
}
}
}
if (macroString.length > 1)
macroString = macroString.substr(0, macroString.length-1);
<%if (!UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages){ %>
macroString += " macroAlias=\"" + macroAlias + "\"";
<%} %>
<%if (UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages){ %>
macroString += " Alias=\"" + macroAlias + "\" runat=\"server\"></" + macroElement + ">";
<%} else { %>
macroString += "></" + macroElement + ">";
<%} %>
top.jQuery('.umbModalBoxIframe').closest(".umbModalBox").ModalWindowAPI().close();
top.umbInsertModule('<%=umbraco.helper.Request("target")%>',macroString,'<%=umbraco.helper.Request("type")%>');
}
function pseudoHtmlEncode(text) {
return text.replace(/\"/gi,"&amp;quot;").replace(/\</gi,"&amp;lt;").replace(/\>/gi,"&amp;gt;");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div style="" class="propertypane">
<div>
<div style="height: 420px; overflow: auto;">
<asp:PlaceHolder ID="macroProperties" runat="server" />
</div>
<div class="propertyPaneFooter">-</div>
</div>
</div>
<p>
<input type="button" value="<%=umbraco.ui.Text("general", "ok", this.getUser())%>"
onclick="updateMacro()" />
</p>
</form>
</body>
</html>

View File

@@ -1 +0,0 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ModuleInstaller.aspx.cs" Inherits="umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule.ModuleInstaller" %>

View File

@@ -1,55 +0,0 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ModuleSelector.ascx.cs" Inherits="umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule.ModuleSelector" %>
<%@ Import Namespace="umbraco.cms.businesslogic.packager.repositories" %>
<script type="text/javascript">
var umbCurrentPageId = <%= umbraco.presentation.nodeFactory.Node.GetCurrent().Id %>;
var umbCurrentUmbracoDir = '<%= this.ResolveUrl(umbraco.GlobalSettings.Path) %>';
</script>
<div id="moduleSelectorContainer">
<asp:Repeater ID="rep_modules" runat="server"
onitemdatabound="rep_modules_ItemDataBound">
<HeaderTemplate>
<div id="modules">
<p>Please select the module you wish to insert.</p>
<ul>
</HeaderTemplate>
<ItemTemplate>
<li>
<asp:HyperLink ID="ModuleSelectLink" runat="server" NavigateUrl="javascript:void(0);">
<img width="25px" src="<%# GetThumbNail(((Package)Container.DataItem).Thumbnail) %>" alt="<%# ((Package)Container.DataItem).Text %>" />
<span><%# ((Package)Container.DataItem).Text %></span>
</asp:HyperLink>
</li>
</ItemTemplate>
<FooterTemplate>
</ul>
</div>
</FooterTemplate>
</asp:Repeater>
<p id="noConnectionToRepo" runat="server" visible="false">
Unable to fetch module, please try again later.
</p>
<p id="installingModule" style="display:none;">
<span class="selectedModule"></span><br />
<img src="<%= this.ResolveUrl(umbraco.GlobalSettings.Path) %>/LiveEditing/Modules/SkinModule/images/loader.gif" /> Installing module...
</p>
<p id="moduleSelect" style="display:none;">
<span class="selectedModule"></span><br />
Select where to place the module
</p>
<a href="javascript:void(0);" onclick="jQuery('.ModuleSelector').hide();umbRemoveModuleContainerSelectors();">Cancel</a>
</div>

View File

@@ -1,125 +0,0 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SkinCustomizer.ascx.cs" Inherits="umbraco.presentation.LiveEditing.Modules.SkinModule.SkinCustomizer" %>
<%@ Import Namespace="umbraco.cms.businesslogic.packager.repositories" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<style type="text/css">
.skinningslider
{
width:250px !important;
height:1px !important;
}
#costumizeSkin input.text, #costumizeSkin input.title, #costumizeSkin textarea, #costumizeSkin select
{
margin:0;
}
</style>
<script type="text/javascript">
function closeCustomizeSkinModal() {
closeSkinModal();
UmbSpeechBubble.ShowMessage("Info", "Skin", "Skin updated...");
}
function closeSkinModal() {
jQuery('#closeSkinInstall').trigger('click');
}
function cancelSkinCustomization() {
jQuery('#cancelSkinCustomization').trigger('click');
}
jQuery('body div').css('z-index', 'auto');
</script>
<asp:Panel ID="pnl_connectionerror" runat="server" Visible="false">
<p>Connection to repository failed...</p>
</asp:Panel>
<!-- Needs to change -->
<input type="submit" class="modalbuton" id="closeSkinInstall" value="" style="display:none;"/>
<input type="submit" class="modalbuton" id="cancelSkinCustomization" value="" style="display:none;"/>
<!-- Using some hidden controls -->
<div id="costumizeSkin" <asp:Literal ID="ltCustomizeSkinStyle" runat="server" Text=""></asp:Literal>>
<p>
Personalize your skin, by defining colors, images and texts
</p>
<div id="dependencies">
<cc1:Pane ID="ph_dependencies" runat="server" />
</div>
<p style="margin-top: 20px;">
<asp:Button ID="btnOk" runat="server" Text=" Ok " CssClass="modalButton" onclick="btnOk_Click" OnClientClick="closeCustomizeSkinModal();"/>
<em> or </em> <a href="#" onclick="cancelSkinCustomization();">Cancel</a>
</p>
<p runat="server" id="pChangeSkin" style="margin-top: 25px; border-top: 1px solid #efefef; padding: 7px">You could also change to another skin: <a href="#" onclick="jQuery('#costumizeSkin').hide();jQuery('#changeSkin').show();">Browse available skins</a></p>
</div>
<div id="changeSkin" <asp:Literal ID="ltChangeSkinStyle" runat="server" Text="style='display:none;'"></asp:Literal>>
<p>
Choose a skin from your local collection, or download one from the umbraco package repository
</p>
<div id="skinupdateinprogress" style="display:none;">
<p>Skin is being updated...</p>
</div>
<div id="skins">
<asp:Repeater ID="rep_starterKitDesigns" runat="server" onitemdatabound="rep_starterKitDesigns_ItemDataBound">
<HeaderTemplate>
<ul id="starterKitDesigns">
</HeaderTemplate>
<ItemTemplate>
<li>
<img src="<%# ((Skin)Container.DataItem).Thumbnail %>" alt="<%# ((Skin)Container.DataItem).Text %>" />
<span><%# ((Skin)Container.DataItem).Text %></span>
<br />
<asp:Button ID="Button1" CssClass="selectskin" runat="server" Text="Install" CommandArgument="<%# ((Skin)Container.DataItem).RepoGuid %>" OnClick="SelectStarterKitDesign" CommandName="<%# ((Skin)Container.DataItem).Text %>"/>
</li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
</div>
<div id="localSkinsContainer" runat="server">
<p>Looks like there are also some local skins</p>
<asp:Repeater ID="rep_starterKitDesignsLocal" runat="server" onitemdatabound="rep_starterKitDesignsLocal_ItemDataBound">
<HeaderTemplate>
<ul id="starterKitDesignsLocal">
</HeaderTemplate>
<ItemTemplate>
<li>
<%# ((string)Container.DataItem).ToString() %>
<asp:Button ID="btnApply" CssClass="selectskin" runat="server" Text="Apply" CommandArgument="<%# ((string)Container.DataItem).ToString() %>" OnClick="SelectLocalStarterKitDesign" CommandName="apply"/>
</li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
</div>
<p runat="server" id="pCustomizeSkin" style="clear: both; margin-top: 25px; border-top: 1px solid #efefef; padding: 7px" >
<a onclick="jQuery('#changeSkin').hide(); jQuery('#costumizeSkin').show();">Go back to your current skin</a>
</p>
</div>

View File

@@ -1 +0,0 @@
/********************* Live Editing SkinModule functions *********************/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -1,130 +0,0 @@
var umbModuleToInsertAlias;
function umbMakeModulesSortable() {
if (jQuery('.umbModuleContainer').length > 0) {
jQuery('.umbModuleContainer').sortable({
connectWith: '.umbModuleContainer',
items: '.umbModule',
stop: function (event, ui) {
UmbracoCommunicator.SendClientMessage("movemodule", ui.item.attr('id') + ";" + ui.item.parent().attr('id') + ";" + jQuery('.umbModule', ui.item.parent()).index(ui.item));
}
});
}
}
function umbSelectModule(alias,sender) {
jQuery('#modules').hide();
jQuery('#moduleSelect').show();
umbShowModuleContainerSelectors(jQuery('span', sender).html());
umbModuleToInsertAlias = alias;
jQuery('.selectedModule').html(jQuery('span',sender).html());
}
function umbInstallModuleAndGetAlias(guid,name,sender) {
jQuery('#modules').hide();
jQuery('.selectedModule').html(name);
jQuery("#installingModule").show();
jQuery.post(umbCurrentUmbracoDir + "/LiveEditing/Modules/SkinModule/ModuleInstaller.aspx?guid=" + guid + "&name=" + name,
function (data) {
if (data == "error") {
}
else {
jQuery("#installingModule").hide();
jQuery('#moduleSelect').show();
umbShowModuleContainerSelectors(jQuery('span', sender).html());
umbModuleToInsertAlias = data;
jQuery(sender).attr("onclick", "");
jQuery(sender).click(function () {
umbSelectModule(data, this);
return false;
});
}
});
}
function umbShowModuleSelection() {
umbRemoveModuleContainerSelectors();
jQuery("#moduleSelect").hide();
jQuery("#modules").show();
jQuery(".ModuleSelector").show();
}
function umbShowModuleContainerSelectors(moduleName) {
jQuery(".umbModuleContainer").each(function () {
if (jQuery(this).children().size() > 0) {
jQuery(this).prepend("<div class='umbModuleContainerSelector' rel='prepend'>Insert module here</div>");
}
jQuery(this).append("<div class='umbModuleContainerSelector' rel='append'>Insert module here</div>");
});
jQuery(".umbModuleContainerSelector").click(function () {
jQuery(".ModuleSelector").hide();
Umbraco.Controls.ModalWindow().open(umbCurrentUmbracoDir + '/LiveEditing/Modules/SkinModule/ModuleInjector.aspx?macroAlias=' + umbModuleToInsertAlias + '&target=' + jQuery(this).parent().attr('id') + "&type=" + jQuery(this).attr('rel'), 'Insert ' + moduleName + ' module', true, 550, 550, 50, 0, ['.modalbuton'], null);
});
}
function umbRemoveModuleContainerSelectors() {
jQuery(".umbModuleContainerSelector").remove();
}
function umbInsertModule(container,macro,type) {
umbRemoveModuleContainerSelectors();
var working = "<div class='umbModuleContainerPlaceHolder'><img src='" + umbCurrentUmbracoDir + "/LiveEditing/Modules/SkinModule/images/loader.gif' />Inserting module...</div>";
if (type == "append") {
jQuery("#" + container).append(working);
} else {
jQuery("#" + container).prepend(working);
}
var moduleguid = guid();
UmbracoCommunicator.SendClientMessage("injectmodule", container + ";" + "<div id='"+ moduleguid +"' class='umbModule'>" + macro + "</div>;" + type);
//need to lose these replace calls
jQuery.post(umbCurrentUmbracoDir + "/LiveEditing/Modules/SkinModule/ModuleInjectionMacroRenderer.aspx?tag=" + macro.replace('>', '').replace('<', '').replace('</umbraco:Macro>', '') + "&umbPageID=" + umbCurrentPageId,
function (data) {
jQuery(".umbModuleContainerPlaceHolder").html("<div id='" + moduleguid + "' class='umbModule'>" + data + "</div>;");
UmbSpeechBubble.ShowMessage("Info", "Module", "Module inserted");
});
}
function S4() {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
}
function guid() {
return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
}
//startup stuff
umbMakeModulesSortable();

View File

@@ -1,8 +0,0 @@
jQuery('.selectskin').click(function () {
jQuery('#skinupdateinprogress').show();
jQuery('#skins').hide();
jQuery('#localSkinsContainer').hide();
});

View File

@@ -1,22 +0,0 @@
var activecolorpicker;
jQuery('input.skinningcolorpicker').ColorPicker({
onSubmit: function (hsb, hex, rgb, el) {
jQuery(el).val('#' + hex);
jQuery(el).ColorPickerHide();
jQuery(el).trigger('change');
},
onBeforeShow: function () {
activecolorpicker = this;
jQuery(this).ColorPickerSetColor(this.value);
},
onChange: function (hsb, hex, rgb) {
jQuery(activecolorpicker).val('#' + hex);
jQuery(activecolorpicker).trigger('change');
}
})
.bind('keyup', function () {
jQuery(this).ColorPickerSetColor(this.value);
});

View File

@@ -1,19 +0,0 @@
jQuery(".skinningslider").each(function () {
var vals = jQuery(this).attr("rel").split(",");
var minimum = vals[0];
var maximum = vals[1];
var initial = vals[2];
var ratio = vals[3]
var target = vals[4];
jQuery(this).slider({
change: function (event, ui) { if (ratio != "") { jQuery("#" + target).val(ui.value / ratio); } else { jQuery("#" + target).val(ui.value); } jQuery("#" + target).trigger("change"); },
slide: function (event, ui) { if (ratio != "") { jQuery("#" + target).val(ui.value / ratio); } else { jQuery("#" + target).val(ui.value); } jQuery("#" + target).trigger("change"); },
min: minimum,
max: maximum,
value: initial
});
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -1,5 +0,0 @@
/********************* Live Editing UnpublishModule functions *********************/
function UnpublishModuleOk()
{
UmbracoCommunicator.SendClientMessage('unpublishcontent', '');
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -1,16 +0,0 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="canvas.aspx.cs" Inherits="umbraco.presentation.LiveEditingEnabler" %>
<!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 runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>

View File

@@ -1,14 +0,0 @@
.umbEditItem:hover {
border: 1px dotted orange;
padding: 5px;
}
.umbLiveEditingToggleButton
{
display: none;
}
.umbLiveEditingCancelButton
{
margin-left: 10px;
}

View File

@@ -13,10 +13,7 @@ namespace Umbraco.Web.UI.Umbraco.Developer.Packages
protected void Page_Load(object sender, EventArgs e)
{
if (!global::umbraco.cms.businesslogic.skinning.Skinning.IsStarterKitInstalled())
ShowStarterKits();
else
ShowSkins((Guid)global::umbraco.cms.businesslogic.skinning.Skinning.StarterKitGuid());
ShowStarterKits();
}
private void ShowStarterKits()
@@ -40,22 +37,7 @@ namespace Umbraco.Web.UI.Umbraco.Developer.Packages
StarterKitInstalled.Visible = false;
}
public void ShowSkins(Guid starterKitGuid)
{
var ctrl = (LoadStarterKitDesigns)LoadControl(SystemDirectories.Install + "/steps/Skinning/loadStarterKitDesigns.ascx");
ctrl.ID = "StarterKitDesigns";
ctrl.StarterKitGuid = starterKitGuid;
ctrl.StarterKitDesignInstalled += CtrlStarterKitDesignInstalled;
ph_skins.Controls.Add(ctrl);
StarterKitNotInstalled.Visible = false;
StarterKitInstalled.Visible = true;
}
void StarterkitsctrlStarterKitInstalled()
{
StarterKitNotInstalled.Visible = false;
@@ -65,13 +47,5 @@ namespace Umbraco.Web.UI.Umbraco.Developer.Packages
}
void CtrlStarterKitDesignInstalled()
{
StarterKitNotInstalled.Visible = false;
StarterKitInstalled.Visible = false;
installationCompleted.Visible = true;
}
}
}

View File

@@ -1,57 +0,0 @@
<%@ Page Language="C#" MasterPageFile="../masterpages/umbracoDialog.Master" AutoEventWireup="true" CodeBehind="TemplateSkinning.aspx.cs" Inherits="umbraco.presentation.umbraco.dialogs.TemplateSkinning" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<%@ Import Namespace="umbraco.cms.businesslogic.packager.repositories" %>
<asp:Content ID="Content1" ContentPlaceHolderID="body" runat="server">
<cc1:Pane ID="p_apply" runat="server" Visible="false">
<cc1:PropertyPanel ID="PropertyPanel1" runat="server" Text="Select a skin">
<asp:DropDownList ID="dd_skins" runat="server" /> <asp:LinkButton OnClick="openRepo" runat="server" ID="bt_repo">Download more skins</asp:LinkButton>
</cc1:PropertyPanel>
<cc1:PropertyPanel ID="PropertyPanel2" runat="server" Text=" ">
<br />
<asp:Button ID="Button1" runat="server" Text="Apply" OnClick="apply" />
<asp:PlaceHolder ID="ph_rollback" runat="server" Visible="false">
<em>or</em> <asp:LinkButton ID="lb_rollback" OnClick="rollback" runat="server">Rollback current skin</asp:LinkButton>
</asp:PlaceHolder>
</cc1:PropertyPanel>
</cc1:Pane>
<cc1:Pane ID="p_download" runat="server" Visible="false">
<div id="skins">
<asp:Repeater ID="rep_starterKitDesigns" runat="server"
onitemdatabound="rep_starterKitDesigns_ItemDataBound" >
<HeaderTemplate>
<ul id="starterKitDesigns">
</HeaderTemplate>
<ItemTemplate>
<li>
<img src="<%# ((Skin)Container.DataItem).Thumbnail %>" alt="<%# ((Skin)Container.DataItem).Text %>" />
<span><%# ((Skin)Container.DataItem).Text %></span>
<br />
<asp:Button ID="Button1" runat="server" Text="Download and apply" CommandArgument="<%# ((Skin)Container.DataItem).RepoGuid %>" OnClick="SelectStarterKitDesign" CommandName="<%# ((Skin)Container.DataItem).Text %>"/>
</li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
</div>
</cc1:Pane>
</asp:Content>

View File

@@ -270,12 +270,6 @@ Umbraco.Application.Actions = function () {
}
},
actionLiveEdit: function () {
/// <summary></summary>
window.open("canvas.aspx?redir=/" + UmbClientMgr.mainTree().getActionNode().nodeId + ".aspx", "liveediting");
},
actionNew: function () {
/// <summary>Show the create new modal overlay</summary>
var actionNode = UmbClientMgr.mainTree().getActionNode();

View File

@@ -843,24 +843,11 @@
});
*/
if (jQuery("#LiveEditingToolbar")) {
// NH: Live editing hack for empty div in IE
if (jQuery.browser.msie) {
var emptyDiv = jQuery("#" + ed.getParam("umbraco_toolbar_id", "*")).prev();
if (emptyDiv.get(0).tagName == "DIV" && emptyDiv.html() == "") {
emptyDiv.hide();
}
}
t._addToolbars(etb, o);
DOM.show(DOM.get(ed.id + '_external'));
} else {
jQuery(document).ready(function () {
t._addToolbars(etb, o);
DOM.show(DOM.get(ed.id + '_external'));
});
}
jQuery(document).ready(function () {
t._addToolbars(etb, o);
DOM.show(DOM.get(ed.id + '_external'));
});
ed.onMouseUp.add(function () {
jQuery(".tinymceMenuBar").hide();
jQuery("#" + ed.id + "_external").parent().show();

View File

@@ -306,7 +306,7 @@ namespace Umbraco.Web.Security
var user = CurrentUser;
// Check for console access
if (user.IsLockedOut || (user.NoConsole && GlobalSettings.RequestIsInUmbracoApplication(_httpContext) && GlobalSettings.RequestIsLiveEditRedirector(_httpContext) == false))
if (user.IsLockedOut || (user.NoConsole && GlobalSettings.RequestIsInUmbracoApplication(_httpContext)))
{
if (throwExceptions) throw new ArgumentException("You have no priviledges to the umbraco console. Please contact your administrator");
return ValidateRequestAttempt.FailedNoPrivileges;

View File

@@ -272,13 +272,7 @@ namespace Umbraco.Web.Trees
return Attempt.Succeed(
new LegacyUrlAction(
"dialogs/assignDomain2.aspx?id=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
ui.GetText("actions", "assignDomain")));
case "UmbClientMgr.appActions().actionLiveEdit()":
return Attempt.Succeed(
new LegacyUrlAction(
"canvas.aspx?redir=/" + nodeId + ".aspx",
"",
ActionUrlMethod.BlankWindow));
ui.GetText("actions", "assignDomain")));
case "UmbClientMgr.appActions().actionSendToTranslate()":
return Attempt.Succeed(
new LegacyUrlAction(

View File

@@ -1066,13 +1066,6 @@
<Compile Include="umbraco.presentation\umbraco\dashboard\SettingsDashboardVideos.ascx.designer.cs">
<DependentUpon>SettingsDashboardVideos.ascx</DependentUpon>
</Compile>
<Compile Include="umbraco.presentation\umbraco\dashboard\Settings\Applyskin.ascx.cs">
<DependentUpon>Applyskin.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\dashboard\Settings\Applyskin.ascx.designer.cs">
<DependentUpon>Applyskin.ascx</DependentUpon>
</Compile>
<Compile Include="umbraco.presentation\umbraco\dashboard\StartupDashboardIntro.ascx.designer.cs">
<DependentUpon>StartupDashboardIntro.ascx</DependentUpon>
</Compile>
@@ -1110,13 +1103,6 @@
<Compile Include="umbraco.presentation\umbraco\dialogs\Preview.aspx.designer.cs">
<DependentUpon>Preview.aspx</DependentUpon>
</Compile>
<Compile Include="umbraco.presentation\umbraco\dialogs\TemplateSkinning.aspx.cs">
<DependentUpon>TemplateSkinning.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\dialogs\TemplateSkinning.aspx.designer.cs">
<DependentUpon>TemplateSkinning.aspx</DependentUpon>
</Compile>
<Compile Include="umbraco.presentation\umbraco\members\MemberSearch.ascx.cs">
<DependentUpon>MemberSearch.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -1864,14 +1850,12 @@
</Content>
<Content Include="umbraco.presentation\umbraco\dashboard\SettingsDashboardIntro.ascx" />
<Content Include="umbraco.presentation\umbraco\dashboard\SettingsDashboardVideos.ascx" />
<Content Include="umbraco.presentation\umbraco\dashboard\Settings\Applyskin.ascx" />
<Content Include="umbraco.presentation\umbraco\dashboard\StartupDashboardIntro.ascx" />
<Content Include="umbraco.presentation\umbraco\dashboard\StartupDashboardKits.ascx" />
<Content Include="umbraco.presentation\umbraco\dashboard\StartupDashboardVideos.ascx" />
<Content Include="umbraco.presentation\umbraco\dialogs\AssignDomain2.aspx">
<SubType>ASPXCodeBehind</SubType>
</Content>
<Content Include="umbraco.presentation\umbraco\dialogs\TemplateSkinning.aspx" />
<Content Include="umbraco.presentation\umbraco\members\MemberSearch.ascx">
<SubType>ASPXCodeBehind</SubType>
</Content>

View File

@@ -174,9 +174,6 @@ namespace umbraco
treeElement.SetAttribute("text", ui.Text("treeHeaders", "installStarterKit"));
if (cms.businesslogic.skinning.Skinning.IsStarterKitInstalled())
treeElement.SetAttribute("text", ui.Text("treeHeaders", "installSkin"));
break;
default:

View File

@@ -27,7 +27,7 @@ using umbraco.cms.businesslogic.template;
using umbraco.BusinessLogic.Utils;
using umbraco.cms.presentation.Trees;
using umbraco.BusinessLogic.Actions;
using umbraco.cms.businesslogic.skinning;
namespace umbraco
{

View File

@@ -1,9 +0,0 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Applyskin.ascx.cs" Inherits="umbraco.presentation.umbraco.dashboard.Settings.Applyskin" %>
<asp:DropDownList ID="skinpicker" runat="server" />
<asp:Button ID="bt_apply" runat="server" Text="Apply" OnClick="apply" />
<asp:Button ID="bt_rollback" runat="server" Text="Rollback skin" OnClick="rollback" />

View File

@@ -1,41 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using umbraco.cms.businesslogic.skinning;
using umbraco.cms.businesslogic.template;
namespace umbraco.presentation.umbraco.dashboard.Settings
{
public partial class Applyskin : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
skinpicker.Items.Add("Choose...");
foreach (Skin s in Skinning.GetAllSkins())
{
skinpicker.Items.Add( new ListItem(s.Name, s.Alias));
}
}
protected void apply(object sender, EventArgs e)
{
if (skinpicker.SelectedIndex > 0)
{
Skin s = Skin.CreateFromAlias(skinpicker.SelectedValue);
Skinning.ActivateAsCurrentSkin(s);
}
}
protected void rollback(object sender, EventArgs e)
{
Template t = Template.GetByAlias("RunwayHomepage");
Skinning.RollbackSkin(t.Id);
}
}
}

View File

@@ -1,42 +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.umbraco.dashboard.Settings {
public partial class Applyskin {
/// <summary>
/// skinpicker 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 skinpicker;
/// <summary>
/// bt_apply 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_apply;
/// <summary>
/// bt_rollback 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_rollback;
}
}

View File

@@ -1,57 +0,0 @@
<%@ Page Language="C#" MasterPageFile="../masterpages/umbracoDialog.Master" AutoEventWireup="true" CodeBehind="TemplateSkinning.aspx.cs" Inherits="umbraco.presentation.umbraco.dialogs.TemplateSkinning" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<%@ Import Namespace="umbraco.cms.businesslogic.packager.repositories" %>
<asp:Content ID="Content1" ContentPlaceHolderID="body" runat="server">
<cc1:Pane ID="p_apply" runat="server" Visible="false">
<cc1:PropertyPanel ID="PropertyPanel1" runat="server" Text="Select a skin">
<asp:DropDownList ID="dd_skins" runat="server" /> <asp:LinkButton OnClick="openRepo" runat="server" ID="bt_repo">Download more skins</asp:LinkButton>
</cc1:PropertyPanel>
<cc1:PropertyPanel ID="PropertyPanel2" runat="server" Text=" ">
<br />
<asp:Button ID="Button1" runat="server" Text="Apply" OnClick="apply" />
<asp:PlaceHolder ID="ph_rollback" runat="server" Visible="false">
<em>or</em> <asp:LinkButton ID="lb_rollback" OnClick="rollback" runat="server">Rollback current skin</asp:LinkButton>
</asp:PlaceHolder>
</cc1:PropertyPanel>
</cc1:Pane>
<cc1:Pane ID="p_download" runat="server" Visible="false">
<div id="skins">
<asp:Repeater ID="rep_starterKitDesigns" runat="server"
onitemdatabound="rep_starterKitDesigns_ItemDataBound" >
<HeaderTemplate>
<ul id="starterKitDesigns">
</HeaderTemplate>
<ItemTemplate>
<li>
<img src="<%# ((Skin)Container.DataItem).Thumbnail %>" alt="<%# ((Skin)Container.DataItem).Text %>" />
<span><%# ((Skin)Container.DataItem).Text %></span>
<br />
<asp:Button ID="Button1" runat="server" Text="Download and apply" CommandArgument="<%# ((Skin)Container.DataItem).RepoGuid %>" OnClick="SelectStarterKitDesign" CommandName="<%# ((Skin)Container.DataItem).Text %>"/>
</li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
</div>
</cc1:Pane>
</asp:Content>

View File

@@ -1,190 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Umbraco.Core.Logging;
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic.skinning;
using umbraco.cms.businesslogic.template;
using umbraco.cms.businesslogic;
namespace umbraco.presentation.umbraco.dialogs
{
public partial class TemplateSkinning : BasePages.UmbracoEnsuredPage
{
private int _templateId = 0;
private readonly cms.businesslogic.packager.repositories.Repository _repo;
private const string RepoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66";
public TemplateSkinning()
{
CurrentApp = DefaultApps.settings.ToString();
_repo = cms.businesslogic.packager.repositories.Repository.getByGuid(RepoGuid);
if (_repo == null)
{
throw new InvalidOperationException("Could not find repository with id " + RepoGuid);
}
}
protected void Page_Load(object sender, EventArgs e)
{
_templateId = int.Parse(Request["id"]);
var t = new Template(_templateId);
if (Skinning.StarterKitGuid(_templateId).HasValue)
{
p_apply.Visible = true;
var currentSkin = Skinning.GetCurrentSkinAlias(_templateId);
var templateRoot = FindTemplateRoot(t);
dd_skins.Items.Add("Choose...");
foreach (var kvp in Skinning.AllowedSkins(templateRoot))
{
var li = new ListItem(kvp.Value, kvp.Key);
if (kvp.Key == currentSkin)
li.Selected = true;
dd_skins.Items.Add(li);
}
if (!string.IsNullOrEmpty(Skinning.GetCurrentSkinAlias(_templateId)))
{
ph_rollback.Visible = true;
}
}
}
private int FindTemplateRoot(CMSNode t)
{
if (t.ParentId < 0)
return t.Id;
return FindTemplateRoot(t.Parent);
}
protected void openRepo(object sender, EventArgs e) {
var g = Skinning.StarterKitGuid(_templateId);
if (g == null || !Skinning.HasAvailableSkins(_templateId))
{
bt_repo.Visible = false;
}
else
{
if (_repo.HasConnection())
{
try
{
rep_starterKitDesigns.DataSource = _repo.Webservice.Skins(g.ToString());
rep_starterKitDesigns.DataBind();
}
catch (Exception ex)
{
LogHelper.Error<TemplateSkinning>("An error occurred", ex);
//ShowConnectionError();
}
}
}
p_apply.Visible = false;
p_download.Visible = true;
}
protected void SelectStarterKitDesign(object sender, EventArgs e)
{
if (((Button)sender).CommandName == "apply")
{
var s = Skin.CreateFromName(((Button)sender).CommandArgument);
Skinning.ActivateAsCurrentSkin(s);
Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())));
}
else if (((Button)sender).CommandName == "remove")
{
var n = NodeFactory.Node.GetCurrent();
var t = new Template(n.template);
Skinning.RollbackSkin(t.Id);
Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())));
}
else
{
var kitGuid = new Guid(((Button)sender).CommandArgument);
if (_repo.HasConnection())
{
var p = new cms.businesslogic.packager.Installer();
var tempFile = p.Import(_repo.fetch(kitGuid.ToString()));
p.LoadConfig(tempFile);
var pId = p.CreateManifest(tempFile, kitGuid.ToString(), RepoGuid);
p.InstallFiles(pId, tempFile);
p.InstallBusinessLogic(pId, tempFile);
p.InstallCleanUp(pId, tempFile);
//NOTE: This seems excessive to have to re-load all content from the database here!?
library.RefreshContent();
if (Skinning.GetAllSkins().Count > 0)
{
Skinning.ActivateAsCurrentSkin(Skinning.GetAllSkins()[0]);
}
Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())));
}
}
}
protected void apply(object sender, EventArgs e) {
if (dd_skins.SelectedIndex > 0)
{
var s = Skin.CreateFromAlias(dd_skins.SelectedValue);
Skinning.ActivateAsCurrentSkin(s);
}
}
protected void rollback(object sender, EventArgs e) {
Skinning.RollbackSkin(_templateId);
}
protected void rep_starterKitDesigns_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.DataItem != null)
{
var s = (cms.businesslogic.packager.repositories.Skin)e.Item.DataItem;
if (Skinning.IsSkinInstalled(s.RepoGuid))
{
var inst = (Button)e.Item.FindControl("Button1");
inst.Text = "Apply (already downloaded)";
inst.CommandName = "apply";
inst.CommandArgument = s.Text;
}
if (Skin.CreateFromAlias(Skinning.GetCurrentSkinAlias(_templateId)).Name == s.Text)
{
var inst = (Button)e.Item.FindControl("Button1");
inst.Text = "Rollback (active skin)";
inst.CommandName = "remove";
inst.CommandArgument = s.Text;
}
}
}
}
}

View File

@@ -1,105 +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.umbraco.dialogs {
public partial class TemplateSkinning {
/// <summary>
/// p_apply control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane p_apply;
/// <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>
/// dd_skins 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_skins;
/// <summary>
/// bt_repo 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 bt_repo;
/// <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>
/// Button1 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 Button1;
/// <summary>
/// ph_rollback 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_rollback;
/// <summary>
/// lb_rollback 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_rollback;
/// <summary>
/// p_download control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane p_download;
/// <summary>
/// rep_starterKitDesigns 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_starterKitDesigns;
}
}

View File

@@ -8,7 +8,7 @@ using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
using umbraco.BasePages;
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic.skinning;
using umbraco.cms.businesslogic.template;
using umbraco.cms.presentation.Trees;
using umbraco.DataLayer;

View File

@@ -120,20 +120,6 @@ namespace umbraco.presentation.templateControls
set { ViewState["DebugMode"] = value; }
}
/// <summary>
/// Gets or sets a value indicating whether Live Editing is disabled for this field.
/// </summary>
/// <value><c>true</c> if you manually wish to disable Live Editing for this field; otherwise, <c>false</c> (default is false).</value>
[Bindable(true)]
[Category("Umbraco")]
[DefaultValue("")]
[Localizable(true)]
public bool LiveEditingDisabled
{
get { return ((ViewState["LiveEditingDisabled"] == null) ? false : (bool)ViewState["LiveEditingDisabled"]); }
set { ViewState["LiveEditingDisabled"] = value; }
}
public ItemRenderer Renderer { get; set; }
#endregion
@@ -148,24 +134,7 @@ namespace umbraco.presentation.templateControls
{
get { return m_ItemId; }
}
/// <summary>
/// Gets a value indicating whether this control can be used in Live Editing mode.
/// Checks whether live editing has not been disabled,
/// the control is inside a form tag,
/// the field is editable
/// and the user has sufficient permissions.
/// </summary>
/// <value><c>true</c> if live editing is useLiveEditing; otherwise, <c>false</c>.</value>
public bool CanUseLiveEditing
{
get
{
return !LiveEditingDisabled && IsInsideFormTag()
&& FieldSupportsLiveEditing() && FieldEditableWithUserPermissions();
}
}
/// <summary>
/// Gets the Umbraco page elements.
/// </summary>
@@ -186,12 +155,7 @@ namespace umbraco.presentation.templateControls
/// Initializes a new instance of the <see cref="Item"/> class.
/// </summary>
public Item()
{
// create page unique ID for this item
object lastItemId = HttpContext.Current.Items["LiveEditing_LastItemId"];
m_ItemId = (lastItemId != null ? (int)lastItemId + 1 : 1);
HttpContext.Current.Items["LiveEditing_LastItemId"] = m_ItemId;
{
Renderer = ItemRenderer.Instance;
}
@@ -302,23 +266,7 @@ namespace umbraco.presentation.templateControls
#endregion
#region Field Information Functions
// 27/08/2008 Ruben Verborgh: This functionality should really be inside some kind of super Field class,
// which could be anything from a property to a dictionary item.
// However, I don't think we should do this in the current Umbraco generation.
/// <summary>
/// Gets a value indicating whether Live Editing is useLiveEditing on this field.
/// Certain functionalities of the item field makes it hard to
/// support Live Editing, like dictionary items and recursive values.
/// </summary>
/// <value>
/// <c>true</c> if Live Editing is useLiveEditing; otherwise, <c>false</c>.
/// </value>
protected virtual bool FieldSupportsLiveEditing()
{
return !(FieldIsRercursive() || FieldIsDictionaryItem());
}
/// <summary>
/// Determines whether the field is a dictionary item.
/// </summary>

View File

@@ -146,7 +146,7 @@ namespace umbraco.BasePages
_user = BusinessLogic.User.GetUser(GetUserId(""));
// Check for console access
if (_user.Disabled || (_user.NoConsole && GlobalSettings.RequestIsInUmbracoApplication(Context) && GlobalSettings.RequestIsLiveEditRedirector(Context) == false))
if (_user.Disabled || (_user.NoConsole && GlobalSettings.RequestIsInUmbracoApplication(Context)))
{
throw new ArgumentException("You have no priviledges to the umbraco console. Please contact your administrator");
}

View File

@@ -329,12 +329,7 @@ namespace umbraco
{
return Umbraco.Core.Configuration.GlobalSettings.RequestIsInUmbracoApplication(context);
}
public static bool RequestIsLiveEditRedirector(HttpContext context)
{
return Umbraco.Core.Configuration.GlobalSettings.RequestIsLiveEditRedirector(context);
}
/// <summary>
/// Gets a value indicating whether umbraco should force a secure (https) connection to the backoffice.
/// </summary>

View File

@@ -38,10 +38,6 @@ namespace umbraco.IO
get { return Umbraco.Core.IO.SystemFiles.DashboardConfig; }
}
public static string SkinningXml
{
get { return Umbraco.Core.IO.SystemFiles.SkinningXml; }
}
public static string NotFoundhandlersConfig
{

View File

@@ -1,102 +0,0 @@
using System;
using ClientDependency.Core.Controls;
namespace umbraco.cms.businesslogic.datatype
{
/// <summary>
/// This attribute is used for data types that uses client assets like Javascript and CSS for liveediting.
/// The Live Editing feature in umbraco will look for this attribute and preload all dependencies to the page
/// to ensure that all client events and assets gets loaded
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
[Obsolete("Use the new ClientDependency framework. Priority and InvokeJavascriptMethodOnLoad are ignored. Documentation here: http://clientdependency.codeplex.com/documentation")]
public class ClientDependencyAttribute : Attribute
{
/// <summary>
/// Gets or sets the priority.
/// </summary>
/// <value>The priority.</value>
[Obsolete("This property is ignored")]
public int Priority { get; set; }
/// <summary>
/// Gets or sets the file path.
/// </summary>
/// <value>The file path.</value>
public string FilePath { get; set; }
/// <summary>
/// Gets or sets the type of the dependency.
/// </summary>
/// <value>The type of the dependency.</value>
public ClientDependencyType DependencyType { get; set; }
/// <summary>
/// Gets or sets the name of an optional javascript method that should be called on load.
/// </summary>
/// <value>The name of the method.</value>
[Obsolete("This property is ignored")]
public string InvokeJavascriptMethodOnLoad { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ClientDependencyAttribute"/> class.
/// </summary>
/// <param name="priority">The priority.</param>
/// <param name="dependencyType">Type of the dependency.</param>
/// <param name="filePath">The file path to the dependency.</param>
public ClientDependencyAttribute(int priority, ClientDependencyType dependencyType, string filePath)
: this(priority, dependencyType, filePath, false, string.Empty)
{ }
/// <summary>
/// Initializes a new instance of the <see cref="ClientDependencyAttribute"/> class.
/// </summary>
/// <param name="priority">The priority.</param>
/// <param name="dependencyType">Type of the dependency.</param>
/// <param name="filePath">The file path to the dependency.</param>
/// <param name="invokeJavascriptMethodOnLoad">The name of the Javascript method to invoke when the dependency is loaded.</param>
public ClientDependencyAttribute(int priority, ClientDependencyType dependencyType, string filePath, string invokeJavascriptMethodOnLoad)
: this(priority, dependencyType, filePath, false, invokeJavascriptMethodOnLoad)
{ }
/// <summary>
/// Initializes a new instance of the <see cref="ClientDependencyAttribute"/> class.
/// </summary>
/// <param name="priority">The priority.</param>
/// <param name="dependencyType">Type of the dependency.</param>
/// <param name="filePath">The file path to the dependency.</param>
/// <param name="appendUmbracoPath">if set to <c>true</c> the current umbraco path will be prefixed to the filePath.</param>
public ClientDependencyAttribute(int priority, ClientDependencyType dependencyType, string filePath, bool appendUmbracoPath)
: this(priority, dependencyType, filePath, appendUmbracoPath, String.Empty)
{ }
/// <summary>
/// Initializes a new instance of the <see cref="ClientDependencyAttribute"/> class.
/// </summary>
/// <param name="priority">The priority.</param>
/// <param name="dependencyType">Type of the dependency.</param>
/// <param name="filePath">The file path to the dependency.</param>
/// <param name="appendUmbracoPath">if set to <c>true</c> the current umbraco path will be prefixed to the filePath.</param>
/// <param name="invokeJavascriptMethodOnLoad">The name of the Javascript method to invoke when the dependency is loaded.</param>
public ClientDependencyAttribute(int priority, ClientDependencyType dependencyType, string filePath, bool appendUmbracoPath, string invokeJavascriptMethodOnLoad)
{
if (String.IsNullOrEmpty(filePath))
throw new ArgumentException("filePath");
Priority = priority;
FilePath = appendUmbracoPath ? GlobalSettings.Path + "/" + filePath : filePath;
DependencyType = dependencyType;
InvokeJavascriptMethodOnLoad = invokeJavascriptMethodOnLoad ?? String.Empty;
ClientDependencyLoader.Instance.RegisterDependency(FilePath, DependencyType == ClientDependencyType.Css ? ClientDependency.Core.ClientDependencyType.Css : ClientDependency.Core.ClientDependencyType.Javascript);
}
}
/// <summary>
/// The type of client file
/// </summary>
public enum ClientDependencyType
{
Javascript, Css
}
}

View File

@@ -1,29 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
namespace umbraco.cms.businesslogic.skinning
{
public class CssVariable
{
public string Name { get; set; }
public string DefaultValue { get; set; }
public List<CssVariableProperty> Properties { get; set; }
public static CssVariable CreateFromXmlNode(XmlNode node)
{
CssVariable var = new CssVariable();
if (node.Attributes["name"] != null)
var.Name = node.Attributes["name"].Value;
var.DefaultValue = node.InnerText;
return var;
}
}
}

View File

@@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace umbraco.cms.businesslogic.skinning
{
public class CssVariableProperty
{
public string Name { get; set; }
public List<string> Selectors { get; set; }
public CssVariableProperty(string name)
{
this.Name = name;
Selectors = new List<string>();
}
}
}

View File

@@ -1,136 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Web;
using System.Reflection;
using Umbraco.Core.Logging;
namespace umbraco.cms.businesslogic.skinning
{
public class Dependency
{
public Dependency()
{
Tasks = new List<Task>();
Properties = new Dictionary<string, string>();
}
public static Dependency CreateFromXmlNode(XmlNode node)
{
Dependency d = new Dependency();
if (node.SelectSingleNode("Properties") != null)
{
foreach (XmlNode prop in node.SelectSingleNode("Properties").ChildNodes)
{
if(prop.Name != "Output" && prop.Name != "#comment")
d.Properties.Add(prop.Name, prop.InnerText);
}
}
if(node.Attributes["label"] != null)
d.Label = node.Attributes["label"].Value;
if (node.Attributes["type"] != null)
{
if (node.Attributes["assembly"] != null)
{
//custom dependency type
//string assemblyFile =
// HttpContext.Current.Server.MapPath(
// String.Format("{0}/../bin/{1}.dll",
// GlobalSettings.Path,
// node.Attributes["assembly"].Value));
//Assembly customAssembly = Assembly.LoadFrom(assemblyFile);
Assembly customAssembly = Assembly.Load(node.Attributes["assembly"].Value);
d.DependencyType = (DependencyType)Activator.CreateInstance(
customAssembly.GetType(node.Attributes["type"].Value),d);
foreach (var prop in d.Properties)
{
d.DependencyType.GetType().InvokeMember(prop.Key, System.Reflection.BindingFlags.SetProperty, null, d.DependencyType, new object[] { prop.Value });
}
//d.DependencyType.Properties = d.Properties;
}
else
{
//internal dependency type
//string assemblyFile =
// HttpContext.Current.Server.MapPath(
// String.Format("{0}/../bin/{1}.dll",
// GlobalSettings.Path,
// "cms"));
//Assembly defaultAssembly = Assembly.LoadFrom(assemblyFile);
Assembly defaultAssembly = Assembly.Load("cms");
d.DependencyType = (DependencyType)Activator.CreateInstance(
defaultAssembly.GetType(
string.Format(
"umbraco.cms.businesslogic.skinning.dependencies.{0}",
node.Attributes["type"].Value)));
foreach (var prop in d.Properties)
{
d.DependencyType.GetType().InvokeMember(prop.Key, System.Reflection.BindingFlags.SetProperty, null, d.DependencyType, new object[] { prop.Value });
}
//d.DependencyType.Properties = d.Properties;
}
XmlNode outputNode = node.SelectSingleNode("Properties/Output");
if (outputNode != null)
{
d.DependencyType.Values.Add(outputNode.InnerText);
}
if (node.Attributes["variable"] != null)
d.Variable = node.Attributes["variable"].Value;
}
foreach (XmlNode taskNode in node.SelectNodes("Tasks/Task"))
{
try
{
d.Tasks.Add(Task.CreateFromXmlNode(taskNode));
}
catch (Exception ex)
{
LogHelper.Error<Dependency>("Failed to load task type " + (taskNode.Attributes["type"] != null ? taskNode.Attributes["type"].Value : string.Empty), ex);
}
}
return d;
}
public DependencyType DependencyType { get; set; }
public string Label { get; set; }
public Dictionary<string,string> Properties {get; set;}
public List<Task> Tasks { get; set; }
public string Variable { get; set; }
}
}

View File

@@ -1,53 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using umbraco.interfaces.skinning;
namespace umbraco.cms.businesslogic.skinning
{
public abstract class DependencyType : ProviderBase, IDependencyType
{
public virtual WebControl Editor { get; set; }
public virtual List<Object> Values { get; set; }
public virtual string CssVariablePreviewClientScript(string ControlClientId, string VariableClientId)
{
return string.Format(
@"jQuery('#{0}').bind('{2}', function() {{
{3} = {1};
PreviewCssVariables();
}});
//cancel support (not implemented yet)
jQuery('#cancelSkinCustomization').click(function () {{
}});
",
ControlClientId,
this.ClientSideGetValueScript(),
this.ClientSideCssVariablePreviewEventType(),
VariableClientId);
}
public virtual string ClientSideGetValueScript()
{
return string.Format(
"jQuery('#{0}').val()"
,Editor.ClientID);
}
public virtual string ClientSidePreviewEventType()
{
return "change";
}
public virtual string ClientSideCssVariablePreviewEventType()
{
//should be something that doesn't execute at every change
return "change";
}
}
}

View File

@@ -1,44 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
namespace umbraco.cms.businesslogic.skinning
{
public class EmbeddedCss
{
public string TargetFile { get; set; }
public List<CssVariable> Variables { get; set; }
public string Content { get; set; }
public EmbeddedCss()
{
Variables = new List<CssVariable>();
}
public static EmbeddedCss CreateFromXmlNode(XmlNode node)
{
EmbeddedCss css = new EmbeddedCss();
if (node.Attributes["targetfile"] != null)
css.TargetFile = node.Attributes["targetfile"].Value;
if (node.SelectSingleNode("Content") != null)
css.Content = node.SelectSingleNode("Content").InnerText;
foreach (XmlNode variableNode in node.SelectNodes("Variables/Variable"))
{
css.Variables.Add(CssVariable.CreateFromXmlNode(variableNode));
}
return css;
}
}
}

View File

@@ -1,344 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.IO;
using System.Xml.XPath;
using Umbraco.Core.Logging;
using umbraco.interfaces.skinning;
namespace umbraco.cms.businesslogic.skinning
{
public class Skin
{
public Skin()
{
Dependencies = new List<Dependency>();
}
public static Skin CreateFromFile(string filename)
{
XmlDocument manifest = new XmlDocument();
FileInfo f = new FileInfo(filename);
if (f.Exists)
{
manifest.Load(filename);
Skin s = Skin.CreateFromXmlNode(manifest.SelectSingleNode("//Skin"));
s.FullFileName = filename;
s.Alias = f.Directory.Name;
return s;
}
else
return null;
}
public static string GetSkinNameFromFile(string filename)
{
XmlDocument manifest = new XmlDocument();
FileInfo f = new FileInfo(filename);
if (f.Exists)
{
manifest.Load(filename);
return manifest.SelectSingleNode("//Skin/Name").InnerText;
}
else
return null;
}
public static Skin CreateFromXmlNode(XmlNode node)
{
Skin s = new Skin();
if(node.SelectSingleNode("/Skin/Name") != null)
s.Name = node.SelectSingleNode("/Skin/Name").InnerText;
if(node.SelectSingleNode("/Skin/Author") != null)
s.Author = node.SelectSingleNode("/Skin/Author").InnerText;
if(node.SelectSingleNode("/Skin/Version") != null)
s.Version = node.SelectSingleNode("/Skin/Version").InnerText;
if(node.SelectSingleNode("/Skin/Description") != null)
s.Description = node.SelectSingleNode("/Skin/Description").InnerText;
if (node.SelectSingleNode("/Skin/AllowedRootTemplate") != null)
s.AllowedRootTemplate = node.SelectSingleNode("/Skin/AllowedRootTemplate").InnerText;
foreach (XmlNode depNode in node.SelectNodes("/Skin//Dependency"))
{
try
{
s.Dependencies.Add(Dependency.CreateFromXmlNode(depNode));
}
catch (Exception ex)
{
LogHelper.Error<Skin>("Failed to load dependency type " + (depNode.Attributes["type"] != null ? depNode.Attributes["type"].Value : string.Empty), ex);
}
}
if (node.SelectSingleNode("/Skin/CSS") != null)
s.Css = EmbeddedCss.CreateFromXmlNode(node.SelectSingleNode("/Skin/CSS"));
return s;
}
public static Skin CreateFromAlias(string alias)
{
string manifest = Path.Combine(IO.IOHelper.MapPath( IO.SystemDirectories.Masterpages + "/" + alias), "skin.xml");
return CreateFromFile(manifest);
}
public static Skin CreateFromName(string name)
{
foreach (Skin s in Skinning.GetAllSkins())
{
if (s.Name == name)
return s;
}
return null;
}
public bool OverridesTemplates()
{
return (System.IO.Directory.GetFiles(IO.IOHelper.MapPath(SkinFolder), "*.master").Count() > 0);
}
public bool HasBackupFiles()
{
return System.IO.Directory.Exists( IO.IOHelper.MapPath(SkinBackupFolder) );
}
public void SaveOutput()
{
XmlDocument manifest = new XmlDocument();
manifest.Load(FullFileName);
int i = 1;
foreach (Dependency d in Dependencies)
{
if (d.DependencyType.Values.Count > 0)
{
XmlNode pNode = manifest.SelectSingleNode(
string.Format("/Skin/Dependencies/Dependency[{0}]/Properties", i.ToString()));
XmlNode outputNode = pNode.SelectSingleNode("./Output");
if (outputNode == null)
{
outputNode = manifest.CreateElement("Output");
outputNode.InnerText = d.DependencyType.Values[0].ToString();
pNode.AppendChild(outputNode);
}
else
{
outputNode.InnerText = d.DependencyType.Values[0].ToString();
}
}
i++;
}
manifest.Save(FullFileName);
}
public string FullFileName { get; set; }
public string Name { get; set; }
public string Author { get; set; }
public string Version { get; set; }
public string Description { get; set; }
public string Alias { get; set; }
public string AllowedRootTemplate { get; set; }
public List<Dependency> Dependencies { get; set; }
public EmbeddedCss Css { get; set; }
public void RollbackDependencies()
{
XmlDocument manifest = new XmlDocument();
manifest.Load(FullFileName);
//emtpy output tags
foreach(XmlNode oNode in manifest.SelectNodes("/Skin/Dependencies/Dependency/Properties/Output"))
{
oNode.RemoveAll();
}
//execute rollback tasks
XmlNode hNode = manifest.SelectSingleNode("/Skin/History");
if (!(hNode == null || hNode.SelectNodes("Task").Count == 0))
{
XPathNavigator navigator = manifest.CreateNavigator();
XPathExpression expression = navigator.Compile("/Skin/History/Task");
expression.AddSort("@executed", XmlSortOrder.Descending, XmlCaseOrder.UpperFirst,
string.Empty, XmlDataType.Text);
XPathNodeIterator iterator = navigator.Select(expression);
foreach (XPathNavigator item in iterator)
{
Task t = Task.CreateFromXmlNode(((System.Xml.IHasXmlNode)item).GetNode());
t.TaskType.RollBack(((System.Xml.IHasXmlNode)item).GetNode().SelectSingleNode("OriginalValue").InnerText);
}
hNode.RemoveAll();
}
manifest.Save(FullFileName);
}
public void DeployTemplateFiles()
{
DeployTemplateFiles(IO.SystemDirectories.Masterpages);
}
public void DeployTemplateFiles(string folder)
{
string[] masterFiles = System.IO.Directory.GetFiles(IO.IOHelper.MapPath(SkinFolder), "*.master");
if (masterFiles.Count() > 0)
{
if (!System.IO.Directory.Exists(IO.IOHelper.MapPath(SkinBackupFolder)))
System.IO.Directory.CreateDirectory(IO.IOHelper.MapPath(SkinBackupFolder));
foreach (string master in masterFiles)
{
FileInfo fi = new FileInfo(master);
string original = Path.Combine(IO.IOHelper.MapPath(IO.SystemDirectories.Masterpages), fi.Name);
string backup = Path.Combine(IO.IOHelper.MapPath(SkinBackupFolder), fi.Name);
if (System.IO.File.Exists(original))
System.IO.File.Copy(original, backup, true);
System.IO.File.Copy(master, original, true);
}
}
}
public void RollbackTemplateFiles(){
RollbackTemplateFiles(IO.SystemDirectories.Masterpages);
}
public void RollbackTemplateFiles(string folder)
{
string[] masterFiles = System.IO.Directory.GetFiles(IO.IOHelper.MapPath(SkinFolder), "*.master");
//1. take the skin files back into skin folder to store the changes made
if (masterFiles.Count() > 0)
{
foreach (string master in masterFiles)
{
FileInfo fi = new FileInfo(master);
string inUse = Path.Combine(IO.IOHelper.MapPath(IO.SystemDirectories.Masterpages), fi.Name);
if (System.IO.File.Exists(inUse))
System.IO.File.Copy(inUse, master, true);
}
}
//2. copy the /backup files back to the masterpages to restore the templates to the way they were before the skin was applied
string[] backedUpmasterFiles = System.IO.Directory.GetFiles(IO.IOHelper.MapPath(SkinBackupFolder), "*.master");
foreach (string backup in backedUpmasterFiles)
{
FileInfo fi = new FileInfo(backup);
string inUse = Path.Combine(IO.IOHelper.MapPath(IO.SystemDirectories.Masterpages), fi.Name);
System.IO.File.Copy(backup, inUse, true);
System.IO.File.Delete(backup);
}
//3. put on some clothes
}
public void ExecuteInstallTasks()
{
XmlDocument manifest = new XmlDocument();
manifest.Load(FullFileName);
foreach (XmlNode tNode in manifest.SelectNodes("/Skin/Install/Task"))
{
Task t = Task.CreateFromXmlNode(tNode);
TaskExecutionDetails details = t.TaskType.Execute(t.Value);
if (details.TaskExecutionStatus == TaskExecutionStatus.Completed)
{
AddTaskHistoryNode(
t.TaskType.ToXml(details.OriginalValue, details.NewValue));
}
}
}
public void AddTaskHistoryNode(XmlNode taskNode)
{
XmlDocument manifest = new XmlDocument();
manifest.Load(FullFileName);
XmlNode hNode = manifest.SelectSingleNode("/Skin/History");
if (hNode == null)
{
hNode = manifest.CreateElement("History");
manifest.SelectSingleNode("/Skin").AppendChild(hNode);
}
hNode.AppendChild(manifest.ImportNode(taskNode, true));
manifest.Save(FullFileName);
}
public string SkinFolder
{
get
{
return IO.SystemDirectories.Masterpages + "/" + Alias;
}
}
public string SkinBackupFolder
{
get
{
return SkinFolder + "/backup";
}
}
}
}

View File

@@ -1,374 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.IO;
using System.Collections;
using System.Web;
using System.Web.Caching;
using Umbraco.Core;
using Umbraco.Core.IO;
using umbraco.cms.businesslogic.web;
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic.template;
namespace umbraco.cms.businesslogic.skinning
{
//TODO: Convert the caching to use ApplicationContext.Current.ApplicationCache
public class Skinning
{
static private readonly Hashtable CheckedPages = new Hashtable();
static private XmlDocument _skinningXmlContent;
static private string _skinningXmlSource = IOHelper.MapPath(SystemFiles.SkinningXml, false);
private const string Cachekey = "SkinnableTemplates";
private static void ClearCheckPages()
{
CheckedPages.Clear();
}
public static void RollbackSkin(int template)
{
string currentSkin = GetCurrentSkinAlias(template);
Skin skin = Skin.CreateFromAlias(currentSkin);
if (skin != null)
{
skin.RollbackDependencies();
if (skin.OverridesTemplates())
skin.RollbackTemplateFiles();
//else
// skin.RollbackDependencies();
}
RemoveSkin(template);
Save();
}
public static void ActivateAsCurrentSkin(Skin skin)
{
Template t = Template.GetByAlias(skin.AllowedRootTemplate);
ActivateAsCurrentSkin(t.Id, skin.Alias);
}
public static void ActivateAsCurrentSkin(int template, string skinAlias)
{
//lookup template in skinning.config
string currentSkin = GetCurrentSkinAlias(template);
//if different from current, and the template is skinned
if (currentSkin != skinAlias)
{
//this will restore the files to the standard runway, as they looked before the skin was applied
if (currentSkin != string.Empty)
{
RollbackSkin(template);
}
Skin newSkin = Skin.CreateFromAlias(skinAlias);
if (newSkin.OverridesTemplates())
newSkin.DeployTemplateFiles();
SetSkin(template, skinAlias);
newSkin.ExecuteInstallTasks();
Save();
}
}
private static void Save()
{
var f = File.Open(_skinningXmlSource, FileMode.Create);
SkinXml.Save(f);
f.Close();
}
public static string GetCurrentSkinAlias(int templateID)
{
var x = (XmlElement)GetTemplate(templateID);
if (x != null && x.HasAttribute("alias") && !string.IsNullOrEmpty(x.Attributes["alias"].Value))
return x.Attributes["alias"].Value;
return string.Empty;
}
private static void SetSkin(int templateId, string skinAlias)
{
var x = (XmlElement)GetTemplate(templateId);
if (x == null)
{
x = (XmlElement)_skinningXmlContent.CreateNode(XmlNodeType.Element, "skin", "");
SkinXml.DocumentElement.AppendChild(x);
}
x.SetAttribute("template", templateId.ToString());
x.SetAttribute("alias", skinAlias);
Save();
ClearCheckPages();
}
private static void RemoveSkin(int templateId)
{
var x = (XmlElement)GetTemplate(templateId);
if (x != null)
{
x.ParentNode.RemoveChild(x);
Save();
ClearCheckPages();
}
}
private static XmlNode GetTemplate(int templateId)
{
var x = SkinXml.SelectSingleNode("/skinning/skin [@template=" + templateId.ToString() + "]");
return x;
}
public static List<Skin> GetAllSkins()
{
var skins = new List<Skin>();
foreach (var dir in Directory.GetDirectories(IOHelper.MapPath(SystemDirectories.Masterpages)))
{
if (File.Exists(Path.Combine(dir, "skin.xml")))
{
var s = Skin.CreateFromFile((Path.Combine(dir, "skin.xml")));
s.Alias = new DirectoryInfo(dir).Name;
skins.Add(s);
}
}
return skins;
}
private static XmlDocument SkinXml
{
get
{
if (_skinningXmlContent == null)
{
if (_skinningXmlSource == null)
{
//if we pop it here it'll make for better stack traces ;)
_skinningXmlSource = IOHelper.MapPath(SystemFiles.SkinningXml, false);
}
_skinningXmlContent = new XmlDocument();
if (!File.Exists(_skinningXmlSource))
{
var f = File.Open(_skinningXmlSource, FileMode.Create);
var sw = new StreamWriter(f);
sw.WriteLine("<skinning/>");
sw.Close();
f.Close();
}
_skinningXmlContent.Load(_skinningXmlSource);
}
return _skinningXmlContent;
}
}
public static Dictionary<string, Dictionary<string, string>> SkinnableTemplates()
{
var dts = (Dictionary<string, Dictionary<string, string>>)HttpRuntime.Cache[Cachekey];
if (dts == null)
dts = RegisterSkinnableTemplates();
return dts;
}
//this is an pretty expensive operation, so we will cache the result...
private static Dictionary<string, Dictionary<string, string>> RegisterSkinnableTemplates()
{
HttpRuntime.Cache.Remove(Cachekey);
var allowedTemplates = new Dictionary<string, Dictionary<string, string>>();
foreach (string dir in Directory.GetDirectories(IOHelper.MapPath(SystemDirectories.Masterpages)))
{
if (File.Exists(Path.Combine(dir, "skin.xml")))
{
var manifest = new XmlDocument();
manifest.Load(Path.Combine(dir, "skin.xml"));
var name = XmlHelper.GetNodeValue(manifest.SelectSingleNode("/Skin/Name"));
var types = XmlHelper.GetNodeValue(manifest.SelectSingleNode("/Skin/AllowedRootTemplate")).Split(',');
var alias = new DirectoryInfo(dir).Name;
//foreach allowed type, test if it is already there...
foreach (var t in types)
{
if (!allowedTemplates.ContainsKey(t))
allowedTemplates.Add(t, new Dictionary<string, string>());
if (!allowedTemplates[t].ContainsKey(alias))
allowedTemplates[t].Add(alias, name);
}
}
}
HttpRuntime.Cache.Insert(Cachekey, allowedTemplates, new CacheDependency(IOHelper.MapPath(SystemDirectories.Masterpages)));
return allowedTemplates;
}
//Helpers for detecting what skins work with what document types
public static bool IsSkinnable(string templateAlias)
{
return SkinnableTemplates().ContainsKey(templateAlias);
}
public static bool IsSkinnable(Template template)
{
return IsSkinnable(template.Alias);
}
public static Dictionary<string, string> AllowedSkins(int templateID)
{
var template = new Template(templateID);
return AllowedSkins(template.Alias);
}
public static Dictionary<string, string> AllowedSkins(Template template)
{
return AllowedSkins(template.Alias);
}
public static Dictionary<string, string> AllowedSkins(string templateAlias)
{
if (IsSkinnable(templateAlias))
{
return SkinnableTemplates()[templateAlias];
}
else
return new Dictionary<string, string>();
}
public static bool IsStarterKitInstalled()
{
foreach (var p in packager.InstalledPackage.GetAllInstalledPackages())
{
if (p.Data.EnableSkins)
return true;
}
return false;
}
public static Guid? StarterKitGuid()
{
foreach (var p in packager.InstalledPackage.GetAllInstalledPackages())
{
if (p.Data.EnableSkins)
return new Guid(p.Data.PackageGuid);
}
return null;
}
public static Guid? StarterKitGuid(int template)
{
string packageFile = IOHelper.MapPath(SystemDirectories.Packages) + "/installed/installedPackages.config";
var installed = new XmlDocument();
if (File.Exists(packageFile))
{
installed.Load(packageFile);
var starterKit = installed.SelectSingleNode(
string.Format("//package [@enableSkins = 'True' and @packageGuid != '' and contains(./templates, '{0}')]", template));
if (starterKit != null)
return new Guid(starterKit.Attributes["packageGuid"].Value);
}
return null;
}
public static bool HasAvailableSkins(int template)
{
var r = false;
var g = StarterKitGuid(template);
if (g != null)
{
try
{
var skinRepoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66";
if (packager.InstalledPackage.GetByGuid(g.ToString()).Data.SkinRepoGuid != null &&
packager.InstalledPackage.GetByGuid(g.ToString()).Data.SkinRepoGuid != Guid.Empty)
{
skinRepoGuid = packager.InstalledPackage.GetByGuid(g.ToString()).Data.SkinRepoGuid.ToString();
}
var repo = packager.repositories.Repository.getByGuid(skinRepoGuid);
if (repo == null)
{
return false;
}
r = repo.Webservice.Skins(g.ToString()).Length > 0;
}
catch { }
}
return r;
}
public static bool IsSkinInstalled(Guid SkinGuid)
{
return IsPackageInstalled(SkinGuid);
}
public static bool IsPackageInstalled(Guid PackageGuid)
{
var installed = new XmlDocument();
installed.Load(IOHelper.MapPath(SystemDirectories.Packages) + "/installed/installedPackages.config");
var packageNode = installed.SelectSingleNode(
string.Format("//package [@packageGuid = '{0}']", PackageGuid.ToString()));
return packageNode != null;
}
public static bool IsPackageInstalled(string Name)
{
var installed = new XmlDocument();
installed.Load(IOHelper.MapPath(SystemDirectories.Packages) + "/installed/installedPackages.config");
var packageNode = installed.SelectSingleNode(
string.Format("//package [@name = '{0}']", Name));
return packageNode != null;
}
public static string GetModuleAlias(string Name)
{
var installed = new XmlDocument();
installed.Load(IOHelper.MapPath(SystemDirectories.Packages) + "/installed/installedPackages.config");
var packageNode = installed.SelectSingleNode(
string.Format("//package [@name = '{0}']", Name));
var macroNode = packageNode.SelectSingleNode(".//macros");
var m = new macro.Macro(Convert.ToInt32(macroNode.InnerText.Split(',')[0]));
return m.Alias;
}
}
}

View File

@@ -1,92 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Web;
using System.Reflection;
namespace umbraco.cms.businesslogic.skinning
{
public class Task
{
public Task()
{
Properties = new Dictionary<string, string>();
}
public static Task CreateFromXmlNode(XmlNode node)
{
Task t = new Task();
if (node.Attributes["type"] != null)
{
if (node.Attributes["assembly"] != null)
{
//custom task type
//string assemblyFile =
// HttpContext.Current.Server.MapPath(
// String.Format("{0}/../bin/{1}.dll",
// GlobalSettings.Path,
// node.Attributes["assembly"].Value));
//Assembly customAssembly = Assembly.LoadFrom(assemblyFile);
Assembly customAssembly = Assembly.Load(node.Attributes["assembly"].Value);
t.TaskType = (TaskType)Activator.CreateInstance(
customAssembly.GetType(node.Attributes["type"].Value));
}
else
{
//internal dependency type
//string assemblyFile =
// HttpContext.Current.Server.MapPath(
// String.Format("{0}/../bin/{1}.dll",
// GlobalSettings.Path,
// "cms"));
//Assembly defaultAssembly = Assembly.LoadFrom(assemblyFile);
Assembly defaultAssembly = Assembly.Load("cms");
t.TaskType = (TaskType)Activator.CreateInstance(
defaultAssembly.GetType(
string.Format(
"umbraco.cms.businesslogic.skinning.tasks.{0}",
node.Attributes["type"].Value)));
}
}
foreach (XmlNode prop in node.ChildNodes)
{
if (prop.Name != "OriginalValue" && prop.Name != "NewValue")
{
if (prop.Name == "Value")
t.Value = prop.InnerText;
else
t.Properties.Add(prop.Name, prop.InnerText);
t.TaskType.GetType().InvokeMember(
prop.Name,
System.Reflection.BindingFlags.SetProperty,
null,
t.TaskType,
new object[] { prop.InnerText });
}
}
return t;
}
public TaskType TaskType { get; set; }
public Dictionary<string, string> Properties { get; set; }
public string Value { get; set; }
}
}

View File

@@ -1,68 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using umbraco.interfaces.skinning;
using System.Xml;
using System.Reflection;
namespace umbraco.cms.businesslogic.skinning
{
public abstract class TaskType : ProviderBase, ITaskType
{
public abstract TaskExecutionDetails Execute(string Value);
public virtual TaskExecutionStatus RollBack(string OriginalValue)
{
return Execute(OriginalValue).TaskExecutionStatus;
}
public abstract string PreviewClientScript(string ControlClientId, string ClientSidePreviewEventType, string ClientSideGetValueScript);
public String Value { get; set; }
public virtual XmlNode ToXml(string OriginalValue, string NewValue)
{
XmlDocument d = new XmlDocument();
XmlNode n = d.CreateElement("Task");
XmlAttribute type = d.CreateAttribute("type");
type.Value = this.GetType().Name;
n.Attributes.Append(type);
if (!this.GetType().FullName.Contains("umbraco.cms.businesslogic.skinning"))
{
XmlAttribute assembly = d.CreateAttribute("assembly");
assembly.Value = this.GetType().Assembly.FullName;
n.Attributes.Append(assembly);
}
XmlAttribute executed = d.CreateAttribute("executed");
executed.Value = DateTime.Now.ToString("s");
n.Attributes.Append(executed);
foreach(PropertyInfo p in this.GetType().GetProperties())
{
if(p.Name != "Name" && p.Name != "Description")
{
XmlNode pNode = d.CreateElement(p.Name);
pNode.InnerText = p.GetValue(this,null) != null ? p.GetValue(this,null).ToString() : string.Empty;
n.AppendChild(pNode);
}
}
XmlNode origValNode = d.CreateElement("OriginalValue");
origValNode.InnerText = OriginalValue;
n.AppendChild(origValNode);
XmlNode newValNode = d.CreateElement("NewValue");
newValNode.InnerText = NewValue;
n.AppendChild(newValNode);
return n;
}
}
}

View File

@@ -1,26 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using ClientDependency.Core;
using System.Web.UI;
using ClientDependency.Core.Controls;
namespace umbraco.cms.businesslogic.skinning.controls
{
[ClientDependency(450,ClientDependencyType.Javascript, "colorpicker/js/colorpicker.js", "UmbracoClient")]
[ClientDependency(460, ClientDependencyType.Javascript, "LiveEditing/Modules/SkinModule/js/initcolorpicker.js", "UmbracoRoot")]
[ClientDependency(200,ClientDependencyType.Css, "colorpicker/css/colorpicker.css", "UmbracoClient")]
public class ColorPicker: TextBox
{
protected override void Render(HtmlTextWriter writer)
{
this.TextMode = System.Web.UI.WebControls.TextBoxMode.SingleLine;
this.CssClass = "skinningcolorpicker";
base.Render(writer);
}
}
}

View File

@@ -1,28 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using ClientDependency.Core;
namespace umbraco.cms.businesslogic.skinning.controls
{
[ClientDependency(ClientDependencyType.Css, "modal/style.css", "UmbracoClient")]
[ClientDependency(500,ClientDependencyType.Javascript, "modal/modal.js", "UmbracoClient")]
public class ImageUploader : TextBox
{
public int ImageHeight { get; set; }
public int ImageWidth { get; set; }
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
base.Render(writer);
writer.WriteLine(
string.Format(
"&nbsp;<a href=\"#\" onclick=\"{0}\">Upload image</a>",
"Umbraco.Controls.ModalWindow().open('" + this.ResolveUrl(GlobalSettings.Path) + "/LiveEditing/Modules/SkinModule/ImageUploader.aspx?ctrl=" + this.ClientID + "&w="+this.ImageWidth+"&h="+this.ImageHeight +"','Upload image',true,750,550,50,0, ['.modalbuton'], null);return false;"));
}
}
}

View File

@@ -1,35 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using ClientDependency.Core.Controls;
using ClientDependency.Core;
namespace umbraco.cms.businesslogic.skinning.controls
{
[ClientDependency(430, ClientDependencyType.Javascript, "ui/jqueryui.js", "UmbracoClient")]
[ClientDependency(440, ClientDependencyType.Javascript, "LiveEditing/Modules/SkinModule/js/initslider.js", "UmbracoRoot")]
[ClientDependency(ClientDependencyType.Css, "ui/ui-lightness/jquery-ui.custom.css", "UmbracoClient")]
public class SliderControl: TextBox
{
public int MinimumValue { get; set; }
public int MaximumValue { get; set; }
public int InitialValue { get; set; }
public int Ratio { get; set; }
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
this.Attributes.Add("style", "display:none;");
base.Render(writer);
writer.WriteLine(
string.Format(
"<div class='skinningslider' rel='{0}'></div>",
MinimumValue + "," + MaximumValue + "," + InitialValue + "," + Ratio +","+this.ClientID));
}
}
}

View File

@@ -1,60 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using umbraco.cms.businesslogic.skinning;
using umbraco.cms.businesslogic.skinning.controls;
using System.Web.UI.WebControls;
namespace umbraco.cms.businesslogic.skinning.dependencies
{
public class Color : DependencyType
{
public ColorPicker cp;
public List<Object> _value;
public Color()
{
this.Name = "Color";
this.Description = "Will render a color picker";
cp = new ColorPicker();
_value = new List<object>();
}
public override WebControl Editor
{
get
{
if (_value.Count > 0 && !string.IsNullOrEmpty(_value[0].ToString()))
cp.Text = _value[0].ToString();
return cp;
}
set
{
base.Editor = value;
}
}
public override List<Object> Values
{
get
{
if (cp.Text != "")
{
_value.Clear();
_value.Add(cp.Text);
}
return _value;
}
set
{
_value = value;
}
}
}
}

View File

@@ -1,80 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using umbraco.cms.businesslogic.skinning.controls;
namespace umbraco.cms.businesslogic.skinning.dependencies
{
public class Image: DependencyType
{
public string Height { get; set; }
public string Width { get; set; }
//currently just returning a textbox, need to replace this with a custom image control
public ImageUploader iu;
public List<Object> _value;
public Image()
{
this.Name = "Text";
this.Description = "Will render a text input";
iu = new ImageUploader();
_value = new List<object>();
}
public override WebControl Editor
{
get
{
iu.TextMode = System.Web.UI.WebControls.TextBoxMode.SingleLine;
iu.CssClass = "image";
int w;
if(int.TryParse(Width, out w))
iu.ImageWidth = w;
int h;
if(int.TryParse(Height, out h))
iu.ImageHeight = h;
if (_value.Count > 0 && !string.IsNullOrEmpty(_value[0].ToString()))
iu.Text = _value[0].ToString();
return iu;
}
set
{
base.Editor = value;
}
}
public override List<Object> Values
{
get
{
if (iu.Text != "")
{
_value.Clear();
_value.Add(iu.Text);
}
return _value;
}
set
{
_value = value;
}
}
}
}

View File

@@ -1,71 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
namespace umbraco.cms.businesslogic.skinning.dependencies
{
public class Option : DependencyType
{
public DropDownList ddl;
public List<Object> _value;
public string Options { get; set; }
public Option()
{
this.Name = "Option";
this.Description = "Will render a dropdown";
ddl = new DropDownList();
_value = new List<object>();
}
public override WebControl Editor
{
get
{
ddl.Items.Clear();
ddl.Items.Add("");
foreach (string option in Options.Split('|'))
{
string text = option.Split(';')[0];
string value = option.Split(';').Length == 2 ? option.Split(';')[1] : text;
ddl.Items.Add(new ListItem(text,value));
}
if (_value.Count > 0)
ddl.SelectedValue = _value[0].ToString();
return ddl;
}
set
{
base.Editor = value;
}
}
public override List<Object> Values
{
get
{
if (ddl.SelectedValue != "")
{
_value.Clear();
_value.Add(ddl.SelectedValue);
}
return _value;
}
set
{
_value = value;
}
}
}
}

View File

@@ -1,88 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using umbraco.cms.businesslogic.skinning.controls;
using System.Web.UI.WebControls;
namespace umbraco.cms.businesslogic.skinning.dependencies
{
public class Slider : DependencyType
{
public SliderControl sc;
public List<Object> _value;
public string Minimum { get; set; }
public string Maximum { get; set; }
public string Initial { get; set; }
public string Ratio { get; set; }
public Slider()
{
this.Name = "Slider";
this.Description = "Will render a slider";
sc = new SliderControl();
_value = new List<object>();
}
public override WebControl Editor
{
get
{
int min;
if (int.TryParse(Minimum, out min))
sc.MinimumValue = min;
int max;
if (int.TryParse(Maximum, out max))
sc.MaximumValue = max;
int ratio;
if (int.TryParse(Ratio, out ratio))
sc.Ratio = max;
int init;
if (int.TryParse(Initial, out init))
{
sc.InitialValue = init;
sc.Text = init.ToString();
}
if (_value.Count > 0 && !string.IsNullOrEmpty(_value[0].ToString()))
sc.Text = _value[0].ToString();
return sc;
}
set
{
base.Editor = value;
}
}
public override List<Object> Values
{
get
{
if (sc.Text != "")
{
_value.Clear();
_value.Add(sc.Text);
}
return _value;
}
set
{
_value = value;
}
}
}
}

View File

@@ -1,60 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
namespace umbraco.cms.businesslogic.skinning.dependencies
{
public class Text : DependencyType
{
public System.Web.UI.WebControls.TextBox tb;
public List<Object> _value;
public Text()
{
this.Name = "Text";
this.Description = "Will render a text input";
tb = new TextBox();
_value = new List<object>();
}
public override WebControl Editor
{
get
{
tb.TextMode = System.Web.UI.WebControls.TextBoxMode.SingleLine;
tb.CssClass = "text";
if (_value.Count > 0 && !string.IsNullOrEmpty(_value[0].ToString()))
tb.Text = _value[0].ToString();
return tb;
}
set
{
base.Editor = value;
}
}
public override List<Object> Values
{
get
{
if (tb.Text != "")
{
_value.Clear();
_value.Add(tb.Text);
}
return _value;
}
set
{
_value = value;
}
}
}
}

View File

@@ -1,114 +0,0 @@
using System;
using umbraco.interfaces.skinning;
using HtmlAgilityPack;
using umbraco.IO;
namespace umbraco.cms.businesslogic.skinning.tasks
{
public class AddStyleSheetToTemplate : TaskType
{
public string TargetFile { get; set; }
public string TargetSelector { get; set; }
public string Media { get; set; }
public AddStyleSheetToTemplate()
{
this.Name = "Add StyleSheet To Template";
this.Description = "Will add an additional stylesheet to a template";
}
public override TaskExecutionDetails Execute(string Value)
{
TaskExecutionDetails d = new TaskExecutionDetails();
HtmlDocument doc = new HtmlDocument();
doc.Load(IO.IOHelper.MapPath(SystemDirectories.Masterpages) + "/" + TargetFile);
//if (doc.DocumentNode.SelectSingleNode(string.Format("//link [@href = '{0}']", Value)) == null)
//{
HtmlNode target = doc.DocumentNode.SelectSingleNode(string.IsNullOrEmpty(TargetSelector) ? "//head" : TargetSelector.ToLower());
if (target != null)
{
HtmlNode s = doc.CreateElement("link");
//s.Name = "link";
s.Attributes.Append("rel", "stylesheet");
s.Attributes.Append("type", "text/css");
s.Attributes.Append("href", Value);
if (!string.IsNullOrEmpty(Media))
s.Attributes.Append("media", Media);
target.AppendChild(s);
doc.Save(IO.IOHelper.MapPath(SystemDirectories.Masterpages) + "/" + TargetFile);
d.TaskExecutionStatus = TaskExecutionStatus.Completed;
d.NewValue = Value;
}
else
d.TaskExecutionStatus = TaskExecutionStatus.Cancelled;
//}
//else
// d.TaskExecutionStatus = TaskExecutionStatus.Cancelled;
return d;
}
public override TaskExecutionStatus RollBack(string OriginalValue)
{
HtmlDocument doc = new HtmlDocument();
doc.Load(IO.IOHelper.MapPath(SystemDirectories.Masterpages) + "/" + TargetFile);
HtmlNode s = doc.DocumentNode.SelectSingleNode(string.Format("//link [@href = '{0}']", Value));
if (s != null)
{
s.RemoveAll();
doc.Save(IO.IOHelper.MapPath(SystemDirectories.Masterpages) + "/" + TargetFile);
return TaskExecutionStatus.Completed;
}
else
return TaskExecutionStatus.Cancelled;
}
public override string PreviewClientScript(string ControlClientId, string ClientSidePreviewEventType, string ClientSideGetValueScript)
{
return string.Format(
@"var link{4};
jQuery('#{0}').bind('{2}', function() {{
jQuery(link{4}).remove();
link{4} = jQuery('<link>');
link{4}.attr({{
type: 'text/css',
rel: 'stylesheet',
{3}
href:{1}
}});
jQuery('head').append(link{4});
}});
//cancel support
jQuery('#cancelSkinCustomization').click(function () {{
jQuery(link{4}).remove();
}});
",
ControlClientId,
ClientSideGetValueScript,
ClientSidePreviewEventType,
string.IsNullOrEmpty(Media) ? "" : string.Format("media :'{0}',",Media),
Guid.NewGuid().ToString().Replace("-", ""));
}
}
}

View File

@@ -1,93 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using umbraco.interfaces.skinning;
using System.IO;
using umbraco.IO;
using System.Web;
namespace umbraco.cms.businesslogic.skinning.tasks
{
public class ModifyCss : TaskType
{
public string TargetFile { get; set; }
public string TargetRule { get; set; }
public string TargetParameter { get; set; }
public ModifyCss()
{
this.Name = "Modify Css";
this.Description = "Will modify the stylesheet";
}
public override TaskExecutionDetails Execute(string Value)
{
TaskExecutionDetails d = new TaskExecutionDetails();
//currently just appending it to the end of the css file
StreamWriter sw = File.AppendText(IO.IOHelper.MapPath(SystemDirectories.Css) + "/" + TargetFile);
sw.WriteLine(string.Format("{0}{{ {1}:{2};}}", TargetRule, TargetParameter, Value));
sw.Close();
d.TaskExecutionStatus = TaskExecutionStatus.Completed;
d.OriginalValue = "";
d.NewValue = Value;
return d;
}
public override TaskExecutionStatus RollBack(string OriginalValue)
{
string[] filecontents = File.ReadAllLines(IO.IOHelper.MapPath(SystemDirectories.Css) + "/" + TargetFile);
for (int i = filecontents.Length; i > 0; i--)
{
if (filecontents[i - 1].Contains(string.Format("{0}{{ {1}:", TargetRule, TargetParameter)))
{
filecontents[i - 1] = string.Empty;
break;
}
}
StringBuilder s = new StringBuilder();
foreach (string line in filecontents)
s.AppendLine(line);
System.IO.StreamWriter file = new System.IO.StreamWriter(IO.IOHelper.MapPath(SystemDirectories.Css) + "/" + TargetFile);
file.WriteLine(s.ToString());
file.Close();
return TaskExecutionStatus.Completed;
}
public override string PreviewClientScript(string ControlClientId,string ClientSidePreviewEventType, string ClientSideGetValueScript)
{
return string.Format(
@"jQuery('#{0}').bind('{5}', function() {{
var val = '{3}';
jQuery('{1}').css('{2}', val.replace('${{Output}}',{4}));
}});
//cancel support
var init{6} = jQuery('{1}').css('{2}');
jQuery('#cancelSkinCustomization').click(function () {{
jQuery('{1}').css('{2}',init{6});
}});
",
ControlClientId,
TargetRule,
TargetParameter,
Value,
ClientSideGetValueScript,
ClientSidePreviewEventType,
Guid.NewGuid().ToString().Replace("-", ""));
}
}
}

View File

@@ -1,77 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using umbraco.interfaces.skinning;
using umbraco.cms.businesslogic.web;
using System.Web;
namespace umbraco.cms.businesslogic.skinning.tasks
{
public class ModifyPageProperty : TaskType
{
public string PropertyAlias { get; set; }
public string ClientSideContainerID { get; set; }
public ModifyPageProperty()
{
this.Name = " Modify page property";
this.Description = "Will modify a property on the current page";
}
public override TaskExecutionDetails Execute(string Value)
{
TaskExecutionDetails d = new TaskExecutionDetails();
if (HttpContext.Current != null && HttpContext.Current.Items["pageID"] != null)
{
string id = HttpContext.Current.Items["pageID"].ToString();
Document doc = new Document(Convert.ToInt32(id));
if (doc.getProperty(PropertyAlias) != null)
{
d.OriginalValue = doc.getProperty(PropertyAlias).Value.ToString();
doc.getProperty(PropertyAlias).Value = Value;
doc.SaveAndPublish(new BusinessLogic.User(0));
d.NewValue = Value;
d.TaskExecutionStatus = TaskExecutionStatus.Completed;
}
else
d.TaskExecutionStatus = TaskExecutionStatus.Cancelled;
}
else
d.TaskExecutionStatus = TaskExecutionStatus.Cancelled;
return d;
}
public override string PreviewClientScript(string ControlClientId, string ClientSidePreviewEventType, string ClientSideGetValueScript)
{
return string.Format(
@"jQuery('#{0}').bind('{3}', function() {{
jQuery('#{1}').html({2});
}});
//cancel support
var init{4} = jQuery('#{1}').html();
jQuery('#cancelSkinCustomization').click(function () {{
jQuery('#{1}').html(init{4});
}});
",
ControlClientId,
ClientSideContainerID,
ClientSideGetValueScript,
ClientSidePreviewEventType,
Guid.NewGuid().ToString().Replace("-", ""));
}
}
}

View File

@@ -1,111 +0,0 @@
using System;
using umbraco.interfaces.skinning;
using umbraco.IO;
using HtmlAgilityPack;
namespace umbraco.cms.businesslogic.skinning.tasks
{
public class ModifyTemplate : TaskType
{
public string TargetFile { get; set; }
public string TargetID { get; set; }
public string TargetAttribute { get; set; }
public ModifyTemplate()
{
this.Name = " Modify template";
this.Description = "Will modify a template";
}
public override TaskExecutionDetails Execute(string Value)
{
TaskExecutionDetails d = new TaskExecutionDetails();
//open template
HtmlDocument doc = new HtmlDocument();
doc.Load(IO.IOHelper.MapPath(SystemDirectories.Masterpages) + "/" +TargetFile);
if (doc.DocumentNode.SelectNodes(string.Format("//*[@id = '{0}']", TargetID)) != null)
{
foreach (HtmlNode target in doc.DocumentNode.SelectNodes(string.Format("//*[@id = '{0}']", TargetID)))
{
if (string.IsNullOrEmpty(TargetAttribute))
{
d.OriginalValue = target.InnerHtml;
target.InnerHtml = Value;
}
else
{
if (target.Attributes[TargetAttribute] == null)
{
target.Attributes.Append(TargetAttribute, Value);
}
else
{
d.OriginalValue = target.Attributes[TargetAttribute].Value;
target.Attributes[TargetAttribute].Value = Value;
}
}
}
}
doc.Save(IO.IOHelper.MapPath(SystemDirectories.Masterpages) + "/" + TargetFile);
d.TaskExecutionStatus = TaskExecutionStatus.Completed;
d.NewValue = Value;
//save
return d;
}
public override string PreviewClientScript(string ControlClientId,string ClientSidePreviewEventType, string ClientSideGetValueScript)
{
if (string.IsNullOrEmpty(TargetAttribute))
{
return string.Format(
@"jQuery('#{0}').bind('{3}', function() {{
var val = '{5}';
jQuery('#{1}').html(val.replace('${{Output}}',{2}));
}});
//cancel support
var init{4} = jQuery('#{1}').html();
jQuery('#cancelSkinCustomization').click(function () {{
jQuery('#{1}').html(init{4});
}});
",
ControlClientId,
TargetID,
ClientSideGetValueScript,
ClientSidePreviewEventType,
Guid.NewGuid().ToString().Replace("-", ""),
Value);
}
else
{
return string.Format(
@"jQuery('#{0}').bind('{4}', function() {{
var val = '{6}';
jQuery('#{1}').attr('{2}',val.replace('${{Output}}',{3}));
}});
//cancel support
var init{5} = jQuery('#{1}').attr('{2}');
jQuery('#cancelSkinCustomization').click(function () {{
jQuery('#{1}').attr('{2}',init{5});
}});
",
ControlClientId,
TargetID,
TargetAttribute,
ClientSideGetValueScript,
ClientSidePreviewEventType,
Guid.NewGuid().ToString().Replace("-", ""),
Value);
}
}
}
}

View File

@@ -212,7 +212,6 @@
<Compile Include="Actions\LegacyActionMenuItemAttribute.cs" />
<Compile Include="businesslogic\CMSPreviewNode.cs" />
<Compile Include="businesslogic\datatype\AbstractDataEditorControl.cs" />
<Compile Include="businesslogic\datatype\ClientDependencyAttribute.cs" />
<Compile Include="businesslogic\datatype\DataEditorSetting.cs" />
<Compile Include="businesslogic\datatype\DataEditorSettingsStorage.cs" />
<Compile Include="businesslogic\datatype\DataEditorSettingType.cs" />
@@ -257,34 +256,13 @@
<Compile Include="businesslogic\Packager\PackageActions\removeStringFromTemplate.cs" />
<Compile Include="businesslogic\propertytype\PropertyTypeGroup.cs" />
<Compile Include="businesslogic\Property\Properties.cs" />
<Compile Include="businesslogic\skinning\controls\ColorPicker.cs" />
<Compile Include="businesslogic\skinning\controls\ImageUploader.cs" />
<Compile Include="businesslogic\skinning\controls\SliderControl.cs" />
<Compile Include="businesslogic\skinning\CssVariable.cs" />
<Compile Include="businesslogic\skinning\CssVariableProperty.cs" />
<Compile Include="businesslogic\skinning\dependencies\Color.cs" />
<Compile Include="businesslogic\skinning\dependencies\Image.cs" />
<Compile Include="businesslogic\skinning\dependencies\Option.cs" />
<Compile Include="businesslogic\skinning\dependencies\Slider.cs" />
<Compile Include="businesslogic\skinning\dependencies\Text.cs" />
<Compile Include="businesslogic\skinning\Dependency.cs" />
<Compile Include="businesslogic\skinning\DependencyType.cs" />
<Compile Include="businesslogic\skinning\EmbeddedCss.cs" />
<Compile Include="businesslogic\ProviderBase.cs" />
<Compile Include="businesslogic\skinning\Skin.cs" />
<Compile Include="businesslogic\skinning\Task.cs" />
<Compile Include="businesslogic\skinning\tasks\AddStyleSheetToTemplate.cs" />
<Compile Include="businesslogic\skinning\tasks\ModifyCss.cs" />
<Compile Include="businesslogic\skinning\tasks\ModifyPageProperty.cs" />
<Compile Include="businesslogic\skinning\tasks\ModifyTemplate.cs" />
<Compile Include="businesslogic\skinning\TaskType.cs" />
<Compile Include="businesslogic\Tags\Tag.cs" />
<Compile Include="businesslogic\task\Tasks.cs" />
<Compile Include="businesslogic\template\MasterpageHelper.cs" />
<Compile Include="businesslogic\template\ViewHelper.cs" />
<Compile Include="businesslogic\Tuple.cs" />
<Compile Include="businesslogic\web\DocumentVersionList.cs" />
<Compile Include="businesslogic\skinning\Skinning.cs" />
<Compile Include="helpers\Casing.cs" />
<Compile Include="helpers\DeepLink.cs" />
<Compile Include="helpers\DeepLinkType.cs" />

View File

@@ -1,6 +1,7 @@
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using ClientDependency.Core;
using umbraco.interfaces;
using umbraco.cms.businesslogic.datatype;

View File

@@ -313,8 +313,8 @@ namespace umbraco.editorControls.MultiNodeTreePicker
base.OnLoad(e);
//add the js/css required
this.RegisterEmbeddedClientResource("umbraco.editorControls.MultiNodeTreePicker.MultiNodePickerStyles.css", umbraco.cms.businesslogic.datatype.ClientDependencyType.Css);
this.RegisterEmbeddedClientResource("umbraco.editorControls.MultiNodeTreePicker.MultiNodePickerScripts.js", umbraco.cms.businesslogic.datatype.ClientDependencyType.Javascript);
this.RegisterEmbeddedClientResource("umbraco.editorControls.MultiNodeTreePicker.MultiNodePickerStyles.css", ClientDependencyType.Css);
this.RegisterEmbeddedClientResource("umbraco.editorControls.MultiNodeTreePicker.MultiNodePickerScripts.js", ClientDependencyType.Javascript);
//update the tree type (we need to do this each time because i don't think view state works with these controls)
switch (TreeToRender)

View File

@@ -3,10 +3,11 @@ using System.Collections;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using ClientDependency.Core;
using umbraco.cms.businesslogic.datatype;
using umbraco.interfaces;
using umbraco.uicontrols.TreePicker;
using Umbraco.Core;
using Constants = Umbraco.Core.Constants;
namespace umbraco.editorControls.MultiNodeTreePicker
{

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Web.UI;
using System.Web.UI.WebControls;
using ClientDependency.Core;
using umbraco;
using umbraco.cms.businesslogic.datatype;

View File

@@ -1,5 +1,6 @@
using System;
using System.Web.UI;
using ClientDependency.Core;
using umbraco;
using umbraco.cms.businesslogic.datatype;
using System.Web.UI.HtmlControls;

View File

@@ -170,21 +170,7 @@ namespace umbraco.editorControls.macrocontainer
base.OnLoad(e);
// And a reference to the macro container calls
//if (!UmbracoContext.Current.LiveEditingContext.Enabled)
//{
// ScriptManager sm = ScriptManager.GetCurrent(base.Page);
// ServiceReference webservicePath = new ServiceReference(SystemDirectories.Webservices + "/MacroContainerService.asmx");
// if (!sm.Services.Contains(webservicePath))
// sm.Services.Add(webservicePath);
//}
//else
//{
// ClientDependencyLoader.Instance.RegisterDependency("webservices/MacroContainerService.asmx/js", "UmbracoRoot", ClientDependencyType.Javascript);
//}
//ClientDependencyLoader.Instance.RegisterDependency("webservices/MacroContainerService.asmx/js", "UmbracoRoot", ClientDependencyType.Javascript);
string script = "function " + ID + "makesortable(){ ";

View File

@@ -18,7 +18,7 @@ using umbraco.uicontrols;
namespace umbraco.editorControls.tinyMCE3
{
public class TinyMCE : TinyMCEWebControl, IDataEditor, IMenuElement, ILiveEditingDataEditor
public class TinyMCE : TinyMCEWebControl, IDataEditor, IMenuElement
{
private readonly string _activateButtons = "";
private readonly string _advancedUsers = "";
@@ -38,8 +38,6 @@ namespace umbraco.editorControls.tinyMCE3
private readonly int m_maxImageWidth = 500;
private bool _isInitialized;
private string _plugins = "";
private bool m_isInLiveEditingMode;
public TinyMCE(IData Data, string Configuration)
{
@@ -402,19 +400,6 @@ namespace umbraco.editorControls.tinyMCE3
}
}
#region ILiveEditingDataEditor Members
public Control LiveEditingControl
{
get
{
m_isInLiveEditingMode = true;
base.IsInLiveEditingMode = true;
return this;
}
}
#endregion
#region IMenuElement Members
@@ -457,20 +442,9 @@ namespace umbraco.editorControls.tinyMCE3
config.Add("theme_umbraco_versionId", base.VersionId.ToString());
// we'll need to make an extra check for the liveediting as that value is set after the constructor have initialized
if (IsInLiveEditingMode)
{
if (config["theme_umbraco_toolbar_location"] == null)
config.Add("theme_umbraco_toolbar_location", "");
config["theme_umbraco_toolbar_location"] = "external";
config.Add("umbraco_toolbar_id",
"LiveEditingClientToolbar");
}
else
{
config.Add("umbraco_toolbar_id",
config.Add("umbraco_toolbar_id",
ElementIdPreFix +
((cms.businesslogic.datatype.DefaultData)_data).PropertyId);
}
}
else
{

View File

@@ -26,8 +26,6 @@ namespace umbraco.editorControls.tinyMCE3.webcontrol
private int _nodeId = 0;
private Guid _versionId;
public bool IsInLiveEditingMode { get; set; }
public int NodeId
{
set { _nodeId = value; }
@@ -109,33 +107,19 @@ namespace umbraco.editorControls.tinyMCE3.webcontrol
protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
if (!IsInLiveEditingMode)
writer.Write(m_scriptInitBlock.ToString());
else
// add a marker to tell Live Editing when a tinyMCE control is on the page
writer.Write("<input type='hidden' id='__umbraco_tinyMCE' />");
// add a marker to tell Live Editing when a tinyMCE control is on the page
writer.Write("<input type='hidden' id='__umbraco_tinyMCE' />");
}
protected override void OnLoad(EventArgs args)
{
if (!IsInLiveEditingMode)
this.config["elements"] = this.ClientID;
this.config["elements"] = this.ClientID;
bool first = true;
// Render HTML for TinyMCE instance
// in the liveediting mode we're always preloading tinymce script
if (!IsInLiveEditingMode)
{
//TinyMCE uses it's own compressor so leave it up to ScriptManager to render
ScriptManager.RegisterClientScriptInclude(this, this.GetType(), _versionId.ToString(), this.ScriptURI);
}
else
{
//We're in live edit mode so add the base js file to the dependency list
ClientDependencyLoader.Instance.RegisterDependency("tinymce3/tiny_mce_src.js",
"UmbracoClient", ClientDependencyType.Javascript);
}
//TinyMCE uses it's own compressor so leave it up to ScriptManager to render
ScriptManager.RegisterClientScriptInclude(this, this.GetType(), _versionId.ToString(), this.ScriptURI);
// Write script tag start
m_scriptInitBlock.Append(HtmlTextWriter.TagLeftChar.ToString());
@@ -150,54 +134,28 @@ namespace umbraco.editorControls.tinyMCE3.webcontrol
foreach (string key in this.config.Keys)
{
//TODO: This is a hack to test if we can prevent tinymce from automatically download languages
if (!IsInLiveEditingMode || (key != "language"))
{
string val = this.config[key];
string val = this.config[key];
if (!first)
m_scriptInitBlock.Append(",\n");
else
first = false;
if (!first)
m_scriptInitBlock.Append(",\n");
else
first = false;
// Is boolean state or string
if (val == "true" || val == "false")
m_scriptInitBlock.Append(key + ":" + this.config[key]);
else
m_scriptInitBlock.Append(key + ":'" + this.config[key] + "'");
}
// Is boolean state or string
if (val == "true" || val == "false")
m_scriptInitBlock.Append(key + ":" + this.config[key]);
else
m_scriptInitBlock.Append(key + ":'" + this.config[key] + "'");
}
m_scriptInitBlock.Append("\n});\n");
// we're wrapping the tinymce init call in a load function when in live editing,
// so we'll need to close that function declaration
if (IsInLiveEditingMode)
{
m_scriptInitBlock.Append(@"(function() { var f =
function() {
if(document.getElementById('__umbraco_tinyMCE'))
tinyMCE.execCommand('mceAddControl',false,'").Append(ClientID).Append(@"');
ItemEditing.remove_startEdit(f);
}
ItemEditing.add_startEdit(f);})();");
m_scriptInitBlock.Append(@"(function() { var f =
function() {
tinyMCE.execCommand('mceRemoveControl',false,'").Append(ClientID).Append(@"');
ItemEditing.remove_stopEdit(f);
}
ItemEditing.add_stopEdit(f);})();");
}
// Write script tag end
m_scriptInitBlock.Append(HtmlTextWriter.EndTagLeftChars);
m_scriptInitBlock.Append("script");
m_scriptInitBlock.Append(HtmlTextWriter.TagRightChar.ToString());
// add to script manager
if (IsInLiveEditingMode)
{
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), new Guid().ToString(),
m_scriptInitBlock.ToString(), false);
}
}

View File

@@ -237,7 +237,7 @@ namespace umbraco.editorControls.tinymce
data += "|";
// full width currenctly not useLiveEditing
data += "0|";
/*
if (_fullWidth.Checked)

View File

@@ -1,18 +0,0 @@
using System;
using System.Web.UI;
namespace umbraco.interfaces
{
/// <summary>
/// Data type editor controls can choose to implement this interface
/// to customize their Live Editing behavior.
/// </summary>
[Obsolete("ILiveEditingDataEditor is obsolete and is no longer used, it will be removed from the codebase in future versions")]
public interface ILiveEditingDataEditor
{
/// <summary>
/// Gets the control used for Live Editing.
/// </summary>
Control LiveEditingControl { get; }
}
}

View File

@@ -150,7 +150,6 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="IDataWithPreview.cs" />
<Compile Include="ILiveEditingDataEditor.cs" />
<Compile Include="IMacroGuiRendering.cs">
<SubType>Code</SubType>
</Compile>