Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0

This commit is contained in:
Shannon
2013-10-02 18:58:21 +10:00
28 changed files with 154 additions and 54 deletions

View File

@@ -128,7 +128,14 @@ namespace Umbraco.Core.Manifest
{
throw new FormatException("The manifest is not formatted correctly contains more than one 'javascript' element");
}
//validate the css
var cssinit = deserialized.Properties().Where(x => x.Name == "stylesheet").ToArray();
if (cssinit.Length > 1)
{
throw new FormatException("The manifest is not formatted correctly contains more than one 'stylesheet' element");
}
//validate the property editors section
var propEditors = deserialized.Properties().Where(x => x.Name == "propertyEditors").ToArray();
if (propEditors.Length > 1)
@@ -139,6 +146,9 @@ namespace Umbraco.Core.Manifest
var jConfig = init.Any() ? (JArray)deserialized["javascript"] : new JArray();
ReplaceVirtualPaths(jConfig);
var cssConfig = cssinit.Any() ? (JArray)deserialized["stylesheet"] : new JArray();
ReplaceVirtualPaths(cssConfig);
//replace virtual paths for each property editor
if (deserialized["propertyEditors"] != null)
{
@@ -158,6 +168,7 @@ namespace Umbraco.Core.Manifest
var manifest = new PackageManifest()
{
JavaScriptInitialize = jConfig,
StyleSheetInitialize = cssConfig,
PropertyEditors = propEditors.Any() ? (JArray)deserialized["propertyEditors"] : new JArray(),
ParameterEditors = propEditors.Any() ? (JArray)deserialized["parameterEditors"] : new JArray()
};

View File

@@ -12,6 +12,11 @@ namespace Umbraco.Core.Manifest
/// </summary>
public JArray JavaScriptInitialize { get; set; }
/// <summary>
/// The json array used to initialize the application with the CSS dependencies required
/// </summary>
public JArray StyleSheetInitialize { get; set; }
/// <summary>
/// The json array of property editors
/// </summary>

View File

@@ -145,8 +145,9 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
* });
* </pre>
* @param {Object} args arguments object
* @param {Int} args.idd the ID of the node to copy
* @param {Int} args.id the ID of the node to copy
* @param {Int} args.parentId the ID of the parent node to copy to
* @param {Boolean} args.relateToOriginal if true, relates the copy to the original through the relation api
* @returns {Promise} resourcePromise object.
*
*/
@@ -163,10 +164,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
return umbRequestHelper.resourcePromise(
$http.post(umbRequestHelper.getApiUrl("contentApiBaseUrl", "PostCopy"),
{
parentId: args.parentId,
id: args.id
}),
args),
'Failed to copy content');
},

View File

@@ -31,9 +31,6 @@ function treeService($q, treeResource, iconHelper, notificationsService, $rootSc
if (treeNodes[i].metaData && treeNodes[i].metaData["treeAlias"]) {
//this is a root node
treeNodes[i].routePath = section;
//we're going to remove any js callbacks from legacy tree nodes here!
//treeNodes[i].metaData["jsClickCallback"] = null;
}
else {
var treeAlias = this.getTreeAlias(treeNodes[i]);
@@ -201,12 +198,11 @@ function treeService($q, treeResource, iconHelper, notificationsService, $rootSc
cacheKey += "_" + section;
//return the cache if it exists
//if (treeArray[cacheKey] !== undefined){
// return treeArray[cacheKey];
// }
if (treeArray[cacheKey] !== undefined){
return treeArray[cacheKey];
}
var self = this;
return treeResource.loadApplication(args)
.then(function(data) {
//this will be called once the tree app data has loaded

View File

@@ -418,7 +418,7 @@ function iconHelper($q) {
},
/** Return a list of icons, optionally filter them */
/** It fetches them directly from the active stylesheet in the browser */
/** It fetches them directly from the active stylesheets in the browser */
getIcons: function(filter){
var deferred = $q.defer();
@@ -426,22 +426,32 @@ function iconHelper($q) {
deferred.resolve(collectedIcons);
}
var classes = document.styleSheets[0].rules || document.styleSheets[0].cssRules;
collectedIcons = [];
var f = filter || "";
var c = ".icon-" + f;
for (var i = document.styleSheets.length - 1; i >= 0; i--) {
var classes = document.styleSheets[i].rules || document.styleSheets[i].cssRules;
for(var x=0;x<classes.length;x++) {
var cur = classes[x];
if(cur.selectorText && cur.selectorText.indexOf(c) === 0) {
var s = cur.selectorText.substring(1);
var hasSpace = s.indexOf(" ");
if(hasSpace>0){
s = s.substring(0, hasSpace);
}
var hasPseudo = s.indexOf(":");
if(hasPseudo>0){
s = s.substring(0, hasPseudo);
}
for(var x=0;x<classes.length;x++) {
var cur = classes[x];
if(cur.selectorText && cur.selectorText.indexOf(c) === 0 && cur.selectorText.indexOf("before") > 0 && cur.selectorText.indexOf(",") < 0) {
var s = cur.selectorText;
s = cur.selectorText.substring(1, s.indexOf(":"));
if(collectedIcons.indexOf(s) < 0){
collectedIcons.push(s);
if(collectedIcons.indexOf(s) < 0){
collectedIcons.push(s);
}
}
}
}
deferred.resolve(collectedIcons);
return deferred.promise;
},

View File

@@ -7,9 +7,10 @@
*/
@font-face {
font-family: 'open_sansregular';
font-family: 'Open Sans';
src: url('../fonts/opensans/OpenSans-Regular-webfont.eot');
src: url('../fonts/opensans/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'),
src: local('Open Sans'), local('OpenSans'),
url('../fonts/opensans/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/opensans/OpenSans-Regular-webfont.woff') format('woff'),
url('../fonts/opensans/OpenSans-Regular-webfont.ttf') format('truetype'),
url('../fonts/opensans/OpenSans-Regular-webfont.svg#open_sansregular') format('svg');
@@ -18,13 +19,13 @@
}
@font-face {
font-family: 'open_sanssemibold';
font-family: 'Open Sans';
src: url('../fonts/opensans/OpenSans-Semibold-webfont.eot');
src: url('../fonts/opensans/OpenSans-Semibold-webfont.eot?#iefix') format('embedded-opentype'),
src: local('Open Sans Semibold'), local('OpenSans-Semibold'),
url('../fonts/opensans/OpenSans-Semibold-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/opensans/OpenSans-Semibold-webfont.woff') format('woff'),
url('../fonts/opensans/OpenSans-Semibold-webfont.ttf') format('truetype'),
url('../fonts/opensans/OpenSans-Semibold-webfont.svg#open_sanssemibold') format('svg');
font-weight: 500;
font-weight: 600;
font-style: normal;
}

View File

@@ -47,7 +47,7 @@
// Typography
// -------------------------
@sansFontFamily: "open_sansregular", "Helvetica Neue", Helvetica, Arial, sans-serif;
@sansFontFamily: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
@serifFontFamily: Georgia, "Times New Roman", Times, serif;
@monoFontFamily: Monaco, Menlo, Consolas, "Courier New", monospace;
@@ -56,7 +56,7 @@
@baseLineHeight: 20px;
@altFontFamily: @serifFontFamily;
@headingsFontFamily: "open_sanssemibold", inherit; // empty to use BS default, @baseFontFamily
@headingsFontFamily: inherit; // empty to use BS default, @baseFontFamily
@headingsFontWeight: 500; // instead of browser default, bold
@headingsColor: inherit; // empty to use BS default, @textColor

View File

@@ -0,0 +1,6 @@
.icon-rs-custom{
background: red;
display: inline-block;
height: 32px;
width: 32px;
};

View File

@@ -27,5 +27,8 @@
,
javascript: [
'~/App_Plugins/MarkDownEditor/markdowneditor.controller.js'
],
stylesheet: [
'~/App_Plugins/MarkDownEditor/lib/red.css'
]
}

View File

@@ -26,7 +26,7 @@ angular.module("umbraco")
});
$scope.copy = function(){
contentResource.copy({parentId: $scope.target.id, id: node.id})
contentResource.copy({parentId: $scope.target.id, id: node.id, relateToOriginal: $scope.relate})
.then(function(){
$scope.error = false;
$scope.success = true;

View File

@@ -1,5 +1,5 @@
<div ng-controller="Umbraco.Editors.Content.CopyController">
<div class="umb-dialog-body">
<div class="umb-dialog-body form-horizontal">
<div class="umb-pane">
<p class="abstract" ng-hide="success">
@@ -26,6 +26,13 @@
showoptions="false"
eventhandler="dialogTreeEventHandler">
</umb-tree>
<umb-pane>
<umb-control-group label="Relate to original">
<input type="checkbox" ng-model="relate" /> </label>
</umb-control-group>
</umb-pane>
</div>
</div>
</div>

View File

@@ -1,4 +1,4 @@
<div class="umb-dialog-body" ng-controller="Umbraco.Editors.Content.CreateController">
<div class="umb-dialog-body with-footer" ng-controller="Umbraco.Editors.Content.CreateController">
<div class="umb-pane">
<h5>Create a page under {{currentNode.name}}</h5>

View File

@@ -1,20 +1,22 @@
<div class="umb-dialog umb-pane" ng-controller="Umbraco.Editors.Media.CreateController">
<div class="umb-dialog-body" auto-scale="90">
<p class="umb-abstract">Create a page under {{currentNode.name}}</p>
<div class="umb-dialog-body with-footer" ng-controller="Umbraco.Editors.Media.CreateController">
<div class="umb-pane">
<h5>Create a page under {{currentNode.name}}</h5>
<ul class="umb-actions">
<li class="action">
<ul class="umb-actions-child">
<li ng-repeat="docType in allowedTypes">
<a href="#media/media/edit/{{currentNode.id}}?doctype={{docType.alias}}&create=true" ng-click="nav.hideNavigation()">
<i class="icon-large {{docType.cssClass}}" style="{{docType.style}}"></i>
<i class="large {{docType.icon}}"></i>
<span class="menu-label">
{{docType.name}}
<small>
{{docType.description}}
</small>
</span>
{{docType.name}}
<small>
{{docType.description}}
</small>
</span>
</a>
</li>
<!--
@@ -33,8 +35,9 @@
</li>
</ul>
</div>
<div class="btn-toolbar umb-btn-toolbar">
<button class="btn" ng-click="nav.hideDialog()">Do something else</button>
</div>
</div>
<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar">
<button class="btn" ng-click="nav.hideDialog()">Do something else</button>
</div>

View File

@@ -27,5 +27,8 @@
,
javascript: [
'~/App_Plugins/MarkDownEditor/markdowneditor.controller.js'
],
stylesheet: [
'~/App_Plugins/MarkDownEditor/lib/red.css'
]
}

View File

@@ -34,8 +34,13 @@ namespace Umbraco.Web.Editors
{
var plugins = new DirectoryInfo(Server.MapPath("~/App_Plugins"));
var parser = new ManifestParser(plugins);
var requireJs = new JsInitialization(parser);
var result = requireJs.GetJavascriptInitialization(JsInitialization.GetDefaultInitialization());
var initJs = new JsInitialization(parser);
var initCss = new CssInitialization(parser);
var result = initJs.GetJavascriptInitialization(JsInitialization.GetDefaultInitialization());
result += initCss.GetStylesheetInitialization();
return JavaScript(result);
}

View File

@@ -77,7 +77,7 @@ namespace Umbraco.Web.Trees
// root actions
menu.AddMenuItem<ActionNew>();
menu.AddMenuItem<ActionSort>(true);
menu.AddMenuItem<ActionSort>(true).ConvertLegacyMenuItem(null, "media", "media");
menu.AddMenuItem<RefreshNode, ActionRefresh>(true);
return menu;
}
@@ -94,9 +94,9 @@ namespace Umbraco.Web.Trees
}
//return a normal node menu:
menu.AddMenuItem<ActionNew>();
menu.AddMenuItem<ActionMove>().ConvertLegacyMenuItem(item, "media", "media");
menu.AddMenuItem<ActionMove>();
menu.AddMenuItem<ActionDelete>();
menu.AddMenuItem<ActionSort>();
menu.AddMenuItem<ActionSort>().ConvertLegacyMenuItem(null, "media", "media");
menu.AddMenuItem<ActionRefresh>(true);
return menu;
}

View File

@@ -0,0 +1,51 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Umbraco.Core.IO;
using Umbraco.Core.Manifest;
namespace Umbraco.Web.UI.JavaScript
{
internal class CssInitialization
{
private readonly ManifestParser _parser;
public CssInitialization(ManifestParser parser)
{
_parser = parser;
}
/// <summary>
/// Processes all found manifest files and outputs yepnope.injectcss calls for all css files found in all manifests
/// </summary>
public string GetStylesheetInitialization()
{
JArray merged = new JArray();
foreach (var m in _parser.GetManifests())
{
ManifestParser.MergeJArrays(merged, m.StyleSheetInitialize);
}
return ParseMain(merged);
}
/// <summary>
/// Parses the CssResources.Main and returns a yepnop.injectCss format
/// </summary>
/// <param name="replacements"></param>
/// <returns></returns>
internal static string ParseMain(JArray files)
{
StringBuilder sb = new StringBuilder();
foreach (var file in files)
sb.AppendFormat("{0}yepnope.injectCss('{1}');", Environment.NewLine, file);
return sb.ToString();
}
}
}

View File

@@ -27,8 +27,8 @@
*/
/* temporary sorter lib, should be updated
'lib/angular/angular-ui-sortable.js',*/
'lib/jquery/jquery.sortable/jquery.sortable.js',
'lib/angular/angular-ui-sortable.js',
'lib/jquery/jquery.sortable/jquery.sortable.js',*/
/* App-wide file-upload helper */
'lib/jquery/jquery.upload/js/jquery.fileupload.js',

View File

@@ -373,6 +373,7 @@
<Compile Include="Trees\DataTypeTreeController.cs" />
<Compile Include="Trees\MemberTreeController.cs" />
<Compile Include="Trees\Menu\CreateChildEntity.cs" />
<Compile Include="UI\JavaScript\CssInitialization.cs" />
<Compile Include="umbraco.presentation\umbraco\create.aspx.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>