New dashboard using angular
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* @ngdoc directive
|
||||
* @name umbraco.directives.directive:resizeToContent
|
||||
* @element div
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
* Resize iframe's automatically to fit to the content they contain
|
||||
*
|
||||
* @example
|
||||
<example module="umbraco.directives">
|
||||
<file name="index.html">
|
||||
<iframe resize-to-content src="meh.html"></iframe>
|
||||
</file>
|
||||
</example>
|
||||
*/
|
||||
angular.module("umbraco.directives")
|
||||
.directive('resizeToContent', function ($window, $timeout) {
|
||||
return function (scope, el, attrs) {
|
||||
var iframe = el[0];
|
||||
var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
|
||||
if (iframeWin.document.body) {
|
||||
|
||||
$timeout(function(){
|
||||
var height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;
|
||||
el.height(height);
|
||||
}, 2000);
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* @ngdoc service
|
||||
* @name umbraco.resources.dashboardResource
|
||||
* @description Handles loading the dashboard manifest
|
||||
**/
|
||||
function dashboardResource($q, $http, umbRequestHelper) {
|
||||
//the factory object returned
|
||||
return {
|
||||
getDashboard: function (section) {
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"dashboardApiBaseUrl",
|
||||
"GetDashboard",
|
||||
[{ section: section }])),
|
||||
'Failed to get dashboard ' + section);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
angular.module('umbraco.resources').factory('dashboardResource', dashboardResource);
|
||||
@@ -382,7 +382,7 @@ angular.module('umbraco.services').factory('iconHelper', iconHelper);
|
||||
* @description
|
||||
* Used to convert legacy xml data to json and back again
|
||||
*/
|
||||
function xmlhelper() {
|
||||
function xmlhelper($http) {
|
||||
/*
|
||||
Copyright 2011 Abdulla Abdurakhmanov
|
||||
Original sources are available at https://code.google.com/p/x2js/
|
||||
@@ -748,7 +748,10 @@ function xmlhelper() {
|
||||
fromJson: function(json) {
|
||||
var xml = x2js.json2xml_str( json );
|
||||
return xml;
|
||||
}
|
||||
},
|
||||
parseFeed: function (url) {
|
||||
return $http.jsonp('//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=50&callback=JSON_CALLBACK&q=' + encodeURIComponent(url));
|
||||
}
|
||||
};
|
||||
}
|
||||
angular.module('umbraco.services').factory('xmlhelper', xmlhelper);
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
@import "../../lib/bootstrap/less/pagination.less";
|
||||
@import "../../lib/bootstrap/less/pager.less";
|
||||
|
||||
|
||||
// Components: Popovers
|
||||
@import "../../lib/bootstrap/less/modals.less";
|
||||
@import "../../lib/bootstrap/less/tooltip.less";
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
@font-face {
|
||||
font-family: 'FontAwesome';
|
||||
src: url('../fonts/fontawesome/fontawesome-webfont.eot?v=3.2.1');
|
||||
src: url('../fonts/fontawesome/fontawesome-webfont.eot?#iefix&v=3.2.1') format('embedded-opentype'), url('../fonts/fontawesome/fontawesome-webfont.woff?v=3.2.1') format('woff'), url('../fonts/fontawesome/fontawesome-webfont.ttf?v=3.2.1') format('truetype'), url('../fonts/fontawesome/fontawesome-webfont.svg#fontawesomeregular?v=3.2.1') format('svg');
|
||||
src: url('../fonts/fontawesome/fontawesome-webfont.eot?#iefix&v=3.2.1') format('embedded-opentype'), url('../fonts/fontawesome/fontawesome-webfont.ttf?v=3.2.1') format('truetype'), url('../fonts/fontawesome/fontawesome-webfont.svg#fontawesomeregular?v=3.2.1') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@@ -19,29 +19,29 @@
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.umb-headline-editor-wrapper h1 {
|
||||
.umb-headline-editor-wrapper{height: 50px;}
|
||||
.umb-headline-editor-wrapper h1, h1.headline {
|
||||
margin: 0;
|
||||
font-size: @fontSizeLarge;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.umb-panel-header h1 {
|
||||
.umb-panel-header h1, {
|
||||
margin: 0;
|
||||
font-size: @fontSizeLarge;
|
||||
font-weight: 400;
|
||||
color: @gray;
|
||||
padding: 4px 0px 4px 6px;
|
||||
line-height: 22px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.umb-headline-editor-wrapper input{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.umb-headline-editor-wrapper h1:hover, .umb-headline-editor-wrapper input {
|
||||
.umb-headline-editor-wrapper h1.umb-headline-editor:hover, .umb-headline-editor-wrapper input {
|
||||
border-bottom: 1px dashed @grayLight;
|
||||
padding: 4px 0px 4px 6px;
|
||||
line-height: 22px;
|
||||
margin: 4px 0 0 -7px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.umb-headline-editor-wrapper input:focus {
|
||||
|
||||
@@ -42,10 +42,9 @@
|
||||
@linkColor: @black;
|
||||
@linkColorHover: darken(@linkColor, 15%);
|
||||
|
||||
|
||||
// Typography
|
||||
// -------------------------
|
||||
@sansFontFamily: 'Open Sans', sans-serif;
|
||||
@sansFontFamily: "'Helvetica Neue', 'Open Sans', Helvetica, Arial, sans-serif;
|
||||
@serifFontFamily: Georgia, "Times New Roman", Times, serif;
|
||||
@monoFontFamily: Monaco, Menlo, Consolas, "Courier New", monospace;
|
||||
|
||||
@@ -55,7 +54,7 @@
|
||||
@altFontFamily: @serifFontFamily;
|
||||
|
||||
@headingsFontFamily: inherit; // empty to use BS default, @baseFontFamily
|
||||
@headingsFontWeight: bold; // instead of browser default, bold
|
||||
@headingsFontWeight: 500; // instead of browser default, bold
|
||||
@headingsColor: inherit; // empty to use BS default, @textColor
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ app.config(function ($routeProvider) {
|
||||
}
|
||||
|
||||
rp.url = "dashboard.aspx?app=" + rp.section;
|
||||
return 'views/common/legacy.html';
|
||||
return 'views/common/dashboard.html';
|
||||
}
|
||||
})
|
||||
.when('/framed/:url', {
|
||||
|
||||
@@ -7,8 +7,16 @@
|
||||
* Controls the dashboards of the application
|
||||
*
|
||||
*/
|
||||
function DashboardController($scope, $routeParams) {
|
||||
$scope.name = $routeParams.section;
|
||||
|
||||
function DashboardController($scope, $routeParams, dashboardResource) {
|
||||
$scope.dashboard = {};
|
||||
$scope.dashboard.name = $routeParams.section;
|
||||
|
||||
dashboardResource.getDashboard($scope.dashboard.name).then(function(tabs){
|
||||
$scope.dashboard.tabs = tabs;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//register it
|
||||
angular.module('umbraco').controller("Umbraco.DashboardController", DashboardController);
|
||||
|
||||
@@ -1,16 +1,30 @@
|
||||
<div class="umb-panel dashboard" ng-controller="Umbraco.DashboardController">
|
||||
<form ng-controller="Umbraco.DashboardController" class="umb-dashboard">
|
||||
<umb-panel val-show-validation>
|
||||
<umb-header tabs="dashboard.tabs">
|
||||
<div class="umb-headline-editor-wrapper span12">
|
||||
<h1 class="headline">{{dashboard.name}}</h1>
|
||||
</div>
|
||||
</umb-header>
|
||||
<umb-tab-view>
|
||||
<umb-tab id="tab{{tab.id}}" rel="{{tab.id}}" ng-repeat="tab in dashboard.tabs">
|
||||
<div class="umb-pane">
|
||||
<div ng-repeat="property in tab.properties" ng-switch on="property.serverSide">
|
||||
|
||||
<div class="umb-panel-header">
|
||||
<div class="umb-el-wrap">
|
||||
<div class="headline"></div>
|
||||
</div>
|
||||
<div class="span12 umb-dashboard-control clearfix"
|
||||
ng-switch-when="false">
|
||||
<h3 ng-show="property.caption">{{property.caption}}</h3>
|
||||
<div ng-include="property.path"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="span12 umb-dashboard-control clearfix"
|
||||
ng-switch-when="true">
|
||||
<h3 ng-show="property.caption">{{property.caption}}</h3>
|
||||
<iframe style="min-height: 200px; max-height: 90%;" resize-to-content ng-src="dashboard/usercontrolproxy.aspx?ctrl={{ property.path}}"></iframe>
|
||||
</div>
|
||||
|
||||
<div class="umb-panel-body umb-scrollable" auto-scale="1">
|
||||
<div class="tab-content form-horizontal">
|
||||
<div class="" style="height: 400px;" id="test_map"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</umb-tab>
|
||||
</umb-tab-view>
|
||||
</umb-panel>
|
||||
</form>
|
||||
@@ -4,12 +4,10 @@ angular.module("umbraco").controller("Umbraco.Dialogs.ContentPickerController",
|
||||
var dialogOptions = $scope.$parent.dialogOptions;
|
||||
$scope.dialogTreeEventHandler = $({});
|
||||
|
||||
$log.log($scope);
|
||||
|
||||
$scope.dialogTreeEventHandler.bind("treeNodeSelect", function(ev, args){
|
||||
args.event.preventDefault();
|
||||
args.event.stopPropagation();
|
||||
|
||||
|
||||
|
||||
eventsService.publish("Umbraco.Dialogs.ContentPickerController.Select", args, "hello").then(function(args){
|
||||
if(dialogOptions && dialogOptions.multipicker){
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<h3>Thank you for choosing Umbraco!</h3>
|
||||
<p>We think this could be the beginning of something beautiful. You have made a great choice, to help you get started here are some links to addtional information:</p>
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span4">
|
||||
<h4>New to Umbraco</h4>
|
||||
<ul>
|
||||
<li>Download and read the <a href="http://umbraco.codeplex.com/documentation" target="_blank">Umbraco Getting Started Guide</a></li>
|
||||
<li>Download the <a href="http://our.umbraco.org/projects/website-utilities/editors-manual" target="_blank">Editors Manual</a> for details on working with the Umbraco UI</li>
|
||||
<li>Watch the Umbraco foundation videos on <a href="http://www.youtube.com/user/UmbracoCMS" target="_blank">Youtube</a></li>
|
||||
<li>Find an Umbraco Certified Developer near you</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<h4>Go further</h4>
|
||||
<ul>
|
||||
<li>Find an add-on <a href="http://our.umbraco.org/projects" target="_blank">package</a> to help you get going quickly</li>
|
||||
<li>Learn to extend Umbraco at <a href="http://umbraco.tv" target="_blank">Umbraco TV</a> (some videos are free, some require a subscription)</li>
|
||||
<li>Read the API documentation on our <a href="http://our.umbraco.org/wiki/recommendations/recommended-reading-for-net-developers" target="_blank">Community Wiki</a></li>
|
||||
<li>Become a <a href="http://umbraco.org/training/training-schedule" target="_blank">Certified Umbraco Developer</a> and learn from the source</li>
|
||||
<li>Find out about our <a href="http://umbraco.org/products" target="_blank">productivity boosting tools</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<h4>Get support</h4>
|
||||
<ul>
|
||||
<li>Ask a question in the <a href="http://our.umbraco.org/" target="_blank">Community Forum</a></li>
|
||||
<li>Watch our <a href="http://umbraco.tv" target="_blank">tutorial videos</a> (some are free, some require a subscription)</li>
|
||||
<li>Find out about our <a href="http://umbraco.org/products" target="_blank">commercial support</a></li>
|
||||
<li>Find out about real-life <a href="http://umbraco.org/training/training-schedule" target="_blank">training and certification</a> opportunities</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,15 @@
|
||||
<h3>Install a Starter Site and Skin</h3>
|
||||
<p>If you haven't already installed one of our Starter Kits, we think you should do that now. This is one of the best ways to start working with Umbraco. After you install a Starter Kit, you can select a skin to make it look great and customize the kit to your liking.</p>
|
||||
<h4>Starter Kits:</h4>
|
||||
<div class="dashboardColWrapper">
|
||||
<div class="dashboardCols">
|
||||
<div class="dashboardCol">
|
||||
<ul>
|
||||
<li><strong><a href="/install/?installStep=skinning" target="_blank">Simple Starter Kit</a></strong> a bare-bones website that introduces you to a set of well-defined conventions for building an Umbraco website</li>
|
||||
<li><strong><a href="/install/?installStep=skinning" target="_blank">Blog Starter Kit</a></strong> a powerful blog kit with all the bells and whistles</li>
|
||||
<li><strong><a href="/install/?installStep=skinning" target="_blank">Business Starter Kit</a></strong> a basic business kit to get you up and running today</li>
|
||||
<li><strong><a href="/install/?installStep=skinning" target="_blank">Personal Starter Kit</a></strong> a basic personal kit for your own space on the web</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,15 @@
|
||||
<h3>Hours of Umbraco training videos are only a click away</h3>
|
||||
<p>Want to master Umbraco? Spend a couple of minutes learning some best practices by watching one of these videos about using Umbraco. And visit <a href="http://umbraco.tv" target="_blank">umbraco.tv</a> for even more Umbraco videos</p>
|
||||
<h4>To get you started:</h4>
|
||||
|
||||
<div class="row-fluid">
|
||||
<ul class="thumbnails" ng-controller="Umbraco.Dashboard.StartupVideosController">
|
||||
<li class="span2" ng-repeat="video in videos">
|
||||
<div class="thumbnail" style="margin-right: 20px">
|
||||
<a target="_blank" href="{{video.link}}" title="{{video.title}}">
|
||||
<img ng-src="{{video.thumbnail}}" alt="{{video.title}}">
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,20 @@
|
||||
function startUpVideosDashboardController($scope, xmlhelper, $log, $http) {
|
||||
|
||||
|
||||
//xmlHelper.parseFeed("http://umbraco.org/feeds/videos/getting-started").then(function(feed){
|
||||
|
||||
//});
|
||||
$scope.videos = [];
|
||||
$http.get("dashboard/feedproxy.aspx?url=http://umbraco.org/feeds/videos/getting-started").then(function(data){
|
||||
var feed = $(data.data);
|
||||
$('item', feed).each(function (i, item) {
|
||||
var video = {};
|
||||
video.thumbnail = $(item).find('thumbnail').attr('url');
|
||||
video.title = $("title", item).text();
|
||||
video.link = $("guid", item).text();
|
||||
$scope.videos.push(video);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
angular.module("umbraco").controller("Umbraco.Dashboard.StartupVideosController", startUpVideosDashboardController);
|
||||
@@ -0,0 +1 @@
|
||||
<h1>Hello</h1>
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="umb-image-mask">
|
||||
<i class="icon-screenshot"></i>
|
||||
<i class="icon-circle"></i>
|
||||
<img ng-src="{{currentImage.src}}" style="max-width: 600px; max-height: 400px" alt="">
|
||||
<img ng-src="{{currentImage.src}}" style="max-width: 600px; max-height: 400px" alt="">
|
||||
</div>
|
||||
|
||||
<div class="umb-image-controls clearfix">
|
||||
@@ -14,6 +14,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul ng-show="currentImage" class="thumbnails umb-crop-preview">
|
||||
<li class="umb-thumbnail" ng-repeat="crop in config.crops">
|
||||
<a href="#">
|
||||
<img src="/media/dummy/crop-preview-horizontal.png" alt="">
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<ul class="thumbnails umb-crop-preview">
|
||||
<li class="umb-thumbnail" ng-repeat="image in images">
|
||||
|
||||
@@ -62,7 +62,8 @@
|
||||
'~/App_Plugins/MyPackage/Common/Js/MyPackage.js',
|
||||
'~/App_Plugins/MyPackage/PropertyEditors/Js/CsvEditor.js',
|
||||
'~/App_Plugins/MyPackage/PropertyEditors/Js/PostcodeEditor.js',
|
||||
'~/App_Plugins/MyPackage/PropertyEditors/Js/RegexEditor.js',
|
||||
'~/App_Plugins/MyPackage/PropertyEditors/Js/CustomJsonEditor.js'
|
||||
'~/App_Plugins/MyPackage/PropertyEditors/Js/RegexEditor.js'
|
||||
/*
|
||||
'~/App_Plugins/MyPackage/PropertyEditors/Js/CustomJsonEditor.js'*/
|
||||
]
|
||||
}
|
||||
@@ -439,6 +439,13 @@
|
||||
<Compile Include="Umbraco\Dashboard\ExamineManagement.ascx.designer.cs">
|
||||
<DependentUpon>ExamineManagement.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\Dashboard\UserControlProxy.aspx.cs">
|
||||
<DependentUpon>UserControlProxy.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\Dashboard\UserControlProxy.aspx.designer.cs">
|
||||
<DependentUpon>UserControlProxy.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\Developer\Macros\EditMacro.aspx.cs">
|
||||
<DependentUpon>editMacro.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
@@ -588,6 +595,7 @@
|
||||
<Content Include="App_Plugins\MyPackage\PropertyEditors\Views\RegexEditor.html" />
|
||||
<Content Include="Config\Splashes\booting.aspx" />
|
||||
<Content Include="Config\Splashes\noNodes.aspx" />
|
||||
<Content Include="Umbraco\Dashboard\UserControlProxy.aspx" />
|
||||
<Content Include="Umbraco\Images\PinnedIcons\task_content.ico" />
|
||||
<Content Include="Umbraco\Images\PinnedIcons\task_default.ico" />
|
||||
<Content Include="Umbraco\Images\PinnedIcons\task_developer.ico" />
|
||||
|
||||
16
src/Umbraco.Web.UI/Umbraco/dashboard/UserControlProxy.aspx
Normal file
16
src/Umbraco.Web.UI/Umbraco/dashboard/UserControlProxy.aspx
Normal file
@@ -0,0 +1,16 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserControlProxy.aspx.cs" Inherits="Umbraco.Web.UI.Dashboard.UserControlProxy" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<title></title>
|
||||
<link href="../assets/css/umbraco.css" type="text/css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<div>
|
||||
<asp:PlaceHolder ID="container" runat="server" />
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using umbraco.IO;
|
||||
|
||||
namespace Umbraco.Web.UI.Dashboard
|
||||
{
|
||||
public partial class UserControlProxy : Pages.UmbracoEnsuredPage
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
base.OnInit(e);
|
||||
|
||||
var path = Request.QueryString["ctrl"];
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
path = IOHelper.FindFile(path);
|
||||
|
||||
try
|
||||
{
|
||||
Control c = LoadControl(path);
|
||||
container.Controls.Add(c);
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
container.Controls.Add(
|
||||
new LiteralControl(
|
||||
"<p class=\"umbracoErrorMessage\">Could not load control: '" + path +
|
||||
"'. <br/><span class=\"guiDialogTiny\"><strong>Error message:</strong> " +
|
||||
ee.ToString() + "</span></p>"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
33
src/Umbraco.Web.UI/Umbraco/dashboard/UserControlProxy.aspx.designer.cs
generated
Normal file
33
src/Umbraco.Web.UI/Umbraco/dashboard/UserControlProxy.aspx.designer.cs
generated
Normal file
@@ -0,0 +1,33 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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.Dashboard {
|
||||
|
||||
|
||||
public partial class UserControlProxy {
|
||||
|
||||
/// <summary>
|
||||
/// form1 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.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// container 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 container;
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,7 @@
|
||||
</control>
|
||||
</tab>
|
||||
</section>
|
||||
|
||||
<section alias="StartupDashboardSection">
|
||||
<access>
|
||||
<deny>translator</deny>
|
||||
@@ -56,25 +57,28 @@
|
||||
</areas>
|
||||
<tab caption="Get Started">
|
||||
<control showOnce="true" addPanel="true" panelCaption="">
|
||||
/umbraco/dashboard/startupdashboardintro.ascx
|
||||
views/dashboard/startupdashboardintro.html
|
||||
</control>
|
||||
<control showOnce="true" addPanel="true" panelCaption="">
|
||||
/umbraco/dashboard/startupdashboardkits.ascx
|
||||
views/dashboard/startupdashboardkits.html
|
||||
<access>
|
||||
<deny>editor</deny>
|
||||
<deny>writer</deny>
|
||||
</access>
|
||||
</control>
|
||||
<control showOnce="true" addPanel="true" panelCaption="">
|
||||
/umbraco/dashboard/startupdashboardvideos.ascx
|
||||
views/dashboard/startupdashboardvideos.html
|
||||
</control>
|
||||
</tab>
|
||||
|
||||
<tab caption="Last Edits">
|
||||
<control addPanel="true" MaxRecords="30">/umbraco/dashboard/latestEdits.ascx</control>
|
||||
</tab>
|
||||
|
||||
<tab caption="Change Password">
|
||||
<control addPanel="true">/umbraco/dashboard/changepassword.ascx</control>
|
||||
</tab>
|
||||
|
||||
</section>
|
||||
<section alias="StartupMemberDashboardSection">
|
||||
<areas>
|
||||
|
||||
@@ -1,16 +1,31 @@
|
||||
<div class="umb-panel dashboard" ng-controller="Umbraco.DashboardController">
|
||||
<form ng-controller="Umbraco.DashboardController" class="umb-dashboard">
|
||||
<umb-panel val-show-validation>
|
||||
<umb-header tabs="dashboard.tabs">
|
||||
<div class="umb-headline-editor-wrapper span12">
|
||||
<h1 class="headline">{{dashboard.name}}</h1>
|
||||
</div>
|
||||
</umb-header>
|
||||
<umb-tab-view>
|
||||
<umb-tab id="tab{{tab.id}}" rel="{{tab.id}}" ng-repeat="tab in dashboard.tabs">
|
||||
|
||||
<div class="umb-panel-header">
|
||||
<div class="umb-el-wrap">
|
||||
<div class="headline"></div>
|
||||
</div>
|
||||
<div class="umb-pane">
|
||||
<div ng-repeat="property in tab.properties" ng-switch on="property.serverSide">
|
||||
|
||||
</div>
|
||||
<div class="span12 umb-dashboard-control clearfix"
|
||||
ng-switch-when="false">
|
||||
<h3 ng-show="property.caption">{{property.caption}}</h3>
|
||||
<div ng-include="property.path"></div>
|
||||
</div>
|
||||
|
||||
<div class="umb-panel-body umb-scrollable" auto-scale="1">
|
||||
<div class="tab-content form-horizontal">
|
||||
<div class="" style="height: 400px;" id="test_map"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="span12 umb-dashboard-control clearfix"
|
||||
ng-switch-when="true">
|
||||
<h3 ng-show="property.caption">{{property.caption}}</h3>
|
||||
<iframe style="min-height: 200px; max-height: 90%;" resize-to-content ng-src="dashboard/usercontrolproxy.aspx?ctrl={{ property.path}}"></iframe>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</umb-tab>
|
||||
</umb-tab-view>
|
||||
</umb-panel>
|
||||
</form>
|
||||
@@ -64,6 +64,7 @@ namespace Umbraco.Web.Editors
|
||||
{"legacyApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl<LegacyController>("DeleteLegacyItem")},
|
||||
{"entityApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl<EntityController>("GetById")},
|
||||
{"dataTypeApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl<DataTypeController>("GetById")},
|
||||
{"dashboardApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl<DashboardController>("GetDashboard")},
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
217
src/Umbraco.Web/Editors/dashboardcontroller.cs
Normal file
217
src/Umbraco.Web/Editors/dashboardcontroller.cs
Normal file
@@ -0,0 +1,217 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Controllers;
|
||||
using System.Web.Http.ModelBinding;
|
||||
using AutoMapper;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.WebApi;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Models.EntityBase;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Web.WebApi.Filters;
|
||||
|
||||
using Constants = Umbraco.Core.Constants;
|
||||
|
||||
using System.Xml;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
|
||||
namespace Umbraco.Web.Editors
|
||||
{
|
||||
/// <summary>
|
||||
/// The API controller used for getting entity objects, basic name, icon, id representation of any umbraco object
|
||||
/// </summary>
|
||||
[PluginController("UmbracoApi")]
|
||||
public class DashboardController : UmbracoAuthorizedJsonController
|
||||
{
|
||||
|
||||
public IEnumerable<Tab<Control>> GetDashboard(string section)
|
||||
{
|
||||
return GetDashboardFromXml(section);
|
||||
|
||||
//return Mapper.Map<EntityBasic>(Services.EntityService.Get(id, UmbracoObjectTypes.Document));
|
||||
}
|
||||
|
||||
//TODO migrate this into a more managed class
|
||||
private IEnumerable<Tab<Control>> GetDashboardFromXml(string section)
|
||||
{
|
||||
|
||||
XmlDocument dashBoardXml = new XmlDocument();
|
||||
dashBoardXml.Load(IOHelper.MapPath(SystemFiles.DashboardConfig));
|
||||
var user = UmbracoContext.Security.CurrentUser;
|
||||
var tabs = new List<Tab<Control>>();
|
||||
|
||||
// test for new tab interface
|
||||
foreach (XmlNode dashboard in dashBoardXml.DocumentElement.SelectNodes("//section [areas/area = '" + section.ToLower() + "']"))
|
||||
{
|
||||
if (dashboard != null)
|
||||
{
|
||||
var i = 0;
|
||||
|
||||
foreach (XmlNode entry in dashboard.SelectNodes("./tab"))
|
||||
{
|
||||
|
||||
if (validateAccess(entry, user))
|
||||
{
|
||||
i++;
|
||||
|
||||
Tab<Control> tab = new Tab<Control>();
|
||||
tab.Label = entry.Attributes.GetNamedItem("caption").Value;
|
||||
var props = new List<Control>();
|
||||
tab.Id = i;
|
||||
tab.Alias = tab.Label.ToLower().Replace(" ", "_");
|
||||
tab.IsActive = i == 1;
|
||||
|
||||
foreach (XmlNode uc in entry.SelectNodes("./control"))
|
||||
{
|
||||
if (validateAccess(uc, user))
|
||||
{
|
||||
Control ctrl = new Control();
|
||||
|
||||
string control = Core.XmlHelper.GetNodeValue(uc).Trim(' ', '\r', '\n');
|
||||
ctrl.Path = IOHelper.FindFile(control);
|
||||
if (control.ToLower().EndsWith(".ascx"))
|
||||
ctrl.ServerSide = true;
|
||||
|
||||
props.Add(ctrl);
|
||||
|
||||
/*
|
||||
try
|
||||
{
|
||||
Control c = LoadControl(path);
|
||||
|
||||
// set properties
|
||||
Type type = c.GetType();
|
||||
if (type != null)
|
||||
{
|
||||
foreach (XmlAttribute att in uc.Attributes)
|
||||
{
|
||||
string attributeName = att.Name;
|
||||
string attributeValue = parseControlValues(att.Value).ToString();
|
||||
// parse special type of values
|
||||
|
||||
|
||||
PropertyInfo prop = type.GetProperty(attributeName);
|
||||
if (prop == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
prop.SetValue(c, Convert.ChangeType(attributeValue, prop.PropertyType),
|
||||
null);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//resolving files from dashboard config which probably does not map to a virtual fi
|
||||
tab.Controls.Add(AddPanel(uc, c));
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
tab.Controls.Add(
|
||||
new LiteralControl(
|
||||
"<p class=\"umbracoErrorMessage\">Could not load control: '" + path +
|
||||
"'. <br/><span class=\"guiDialogTiny\"><strong>Error message:</strong> " +
|
||||
ee.ToString() + "</span></p>"));
|
||||
}*/
|
||||
}
|
||||
}
|
||||
tab.Properties = props;
|
||||
tabs.Add(tab);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return tabs;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//TODO: This has to go away, jesus
|
||||
//for now I'm just returning true, this is likely to change anyway
|
||||
private bool validateAccess(XmlNode node, IUser currentUser)
|
||||
{
|
||||
return true;
|
||||
|
||||
/*
|
||||
// check if this area should be shown at all
|
||||
string onlyOnceValue = StateHelper.GetCookieValue(generateCookieKey(node));
|
||||
if (!String.IsNullOrEmpty(onlyOnceValue))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// the root user can always see everything
|
||||
if (currentUser.IsRoot())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (node != null)
|
||||
{
|
||||
XmlNode accessRules = node.SelectSingleNode("access");
|
||||
bool retVal = true;
|
||||
if (accessRules != null && accessRules.HasChildNodes)
|
||||
{
|
||||
string currentUserType = CurrentUser.UserType.Alias.ToLowerInvariant();
|
||||
|
||||
//Update access rules so we'll be comparing lower case to lower case always
|
||||
|
||||
var denies = accessRules.SelectNodes("deny");
|
||||
foreach (XmlNode deny in denies)
|
||||
{
|
||||
deny.InnerText = deny.InnerText.ToLowerInvariant();
|
||||
}
|
||||
|
||||
var grants = accessRules.SelectNodes("grant");
|
||||
foreach (XmlNode grant in grants)
|
||||
{
|
||||
grant.InnerText = grant.InnerText.ToLowerInvariant();
|
||||
}
|
||||
|
||||
string allowedSections = ",";
|
||||
foreach (BusinessLogic.Application app in CurrentUser.Applications)
|
||||
{
|
||||
allowedSections += app.alias.ToLower() + ",";
|
||||
}
|
||||
XmlNodeList grantedTypes = accessRules.SelectNodes("grant");
|
||||
XmlNodeList grantedBySectionTypes = accessRules.SelectNodes("grantBySection");
|
||||
XmlNodeList deniedTypes = accessRules.SelectNodes("deny");
|
||||
|
||||
// if there's a grant type, everyone who's not granted is automatically denied
|
||||
if (grantedTypes.Count > 0 || grantedBySectionTypes.Count > 0)
|
||||
{
|
||||
retVal = false;
|
||||
if (grantedBySectionTypes.Count > 0 && accessRules.SelectSingleNode(String.Format("grantBySection [contains('{0}', concat(',',.,','))]", allowedSections)) != null)
|
||||
{
|
||||
retVal = true;
|
||||
}
|
||||
else if (grantedTypes.Count > 0 && accessRules.SelectSingleNode(String.Format("grant [. = '{0}']", currentUserType)) != null)
|
||||
{
|
||||
retVal = true;
|
||||
}
|
||||
}
|
||||
// if the current type of user is denied we'll say nay
|
||||
if (deniedTypes.Count > 0 && accessRules.SelectSingleNode(String.Format("deny [. = '{0}']", currentUserType)) != null)
|
||||
{
|
||||
retVal = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
return false;
|
||||
* */
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
28
src/Umbraco.Web/Models/ContentEditing/Control.cs
Normal file
28
src/Umbraco.Web/Models/ContentEditing/Control.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
[DataContract(Name = "control", Namespace = "")]
|
||||
public class Control
|
||||
{
|
||||
[DataMember(Name = "showOnce")]
|
||||
public bool ShowOnce { get; set; }
|
||||
|
||||
[DataMember(Name = "addPanel")]
|
||||
public bool AddPanel { get; set; }
|
||||
|
||||
[DataMember(Name = "serverSide")]
|
||||
public bool ServerSide { get; set; }
|
||||
|
||||
[DataMember(Name = "path")]
|
||||
public string Path { get; set; }
|
||||
|
||||
[DataMember(Name = "caption")]
|
||||
public string Caption { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -301,11 +301,13 @@
|
||||
<Compile Include="Controllers\ProfileController.cs" />
|
||||
<Compile Include="Controllers\LoginStatusController.cs" />
|
||||
<Compile Include="Editors\ContentPostValidateAttribute.cs" />
|
||||
<Compile Include="Editors\dashboardcontroller.cs" />
|
||||
<Compile Include="Editors\DataTypeController.cs" />
|
||||
<Compile Include="Editors\DataTypeValidateAttribute.cs" />
|
||||
<Compile Include="Editors\EntityController.cs" />
|
||||
<Compile Include="Editors\MediaPostValidateAttribute.cs" />
|
||||
<Compile Include="Editors\UserController.cs" />
|
||||
<Compile Include="Models\ContentEditing\Control.cs" />
|
||||
<Compile Include="Models\ContentEditing\DataTypeDisplay.cs" />
|
||||
<Compile Include="Models\ContentEditing\DataTypeSave.cs" />
|
||||
<Compile Include="Models\ContentEditing\EntityBasic.cs" />
|
||||
|
||||
@@ -49,6 +49,8 @@ namespace umbraco.cms.presentation
|
||||
{
|
||||
|
||||
base.OnInit(e);
|
||||
|
||||
/*
|
||||
// Load dashboard content
|
||||
if (helper.Request("app") != "")
|
||||
_section = helper.Request("app");
|
||||
@@ -60,6 +62,9 @@ namespace umbraco.cms.presentation
|
||||
XmlDocument dashBoardXml = new XmlDocument();
|
||||
dashBoardXml.Load(IOHelper.MapPath(SystemFiles.DashboardConfig));
|
||||
|
||||
var control = dashBoardXml.DocumentElement.SelectSingleNode("//control [areas/area = '" + _section.ToLower() + "']");
|
||||
*/
|
||||
/*
|
||||
// test for new tab interface
|
||||
foreach (XmlNode section in dashBoardXml.DocumentElement.SelectNodes("//section [areas/area = '" + _section.ToLower() + "']"))
|
||||
{
|
||||
@@ -161,7 +166,7 @@ namespace umbraco.cms.presentation
|
||||
dashBoardContent.Controls.Add(placeHolder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
private object parseControlValues(string value)
|
||||
|
||||
Reference in New Issue
Block a user