Merge remote-tracking branch 'origin/7.0.0' into 7.0.0

Conflicts:
	src/Umbraco.Web/Umbraco.Web.csproj
This commit is contained in:
Shannon
2013-09-20 09:58:24 +10:00
13 changed files with 217 additions and 60 deletions

View File

@@ -157,6 +157,18 @@ namespace Umbraco.Core
/// </summary>
public const string IntegerAlias = "Umbraco.Integer";
/// <summary>
/// Alias for the listview datatype.
/// </summary>
public const string ListViewAlias = "Umbraco.ListView";
/// <summary>
/// Guid for the list view datatype.
/// </summary>
[Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")]
public const string ListView = "474FCFF8-9D2D-12DE-ABC6-AD7A56D89593";
/// <summary>
/// Guid for the Macro Container datatype.
/// </summary>

View File

@@ -99,6 +99,7 @@ namespace Umbraco.Core.PropertyEditors
CreateMap(Guid.Parse(Constants.PropertyEditors.FolderBrowser), Constants.PropertyEditors.FolderBrowserAlias);
CreateMap(Guid.Parse(Constants.PropertyEditors.ImageCropper), Constants.PropertyEditors.ImageCropperAlias);
CreateMap(Guid.Parse(Constants.PropertyEditors.Integer), Constants.PropertyEditors.IntegerAlias);
CreateMap(Guid.Parse(Constants.PropertyEditors.ListView), Constants.PropertyEditors.ListViewAlias);
CreateMap(Guid.Parse(Constants.PropertyEditors.MacroContainer), Constants.PropertyEditors.MacroContainerAlias);
CreateMap(Guid.Parse(Constants.PropertyEditors.MediaPicker), Constants.PropertyEditors.MediaPickerAlias);
CreateMap(Guid.Parse(Constants.PropertyEditors.MemberPicker), Constants.PropertyEditors.MemberPickerAlias);

View File

@@ -20,4 +20,5 @@
</div>
</div>
</div>
</div>

View File

@@ -6,27 +6,29 @@
</div>
</div>
<h1>{{user.name}}</h1>
<small>{{user.email}}</small>
<h1 class="headline">{{user.name}}</h1>
</div>
<div class="umb-panel-body umb-scrollable">
<div class="tab-content umb-control-group">
<div class="umb-pane">
<h5>Your profile</h5>
<p>
<a href="#/framed/%252Fumbraco%252Fusers%252Fedituser.aspx%253Fid%253D{{user.id}}" class="btn btn-primary">Edit your profile</a>
</p>
</div>
<div class="umb-pane">
<h5>Your recent history</h5>
<ul class="umb-tree">
<li ng-repeat="item in history | orderBy:'time'">
<a ng-href="{{item.link}}" ng-click="gotoHistory(item.link)" prevent-default>
<i class="{{item.icon}}"></i> {{item.name}}</a>
</li>
</ul>
<h5>Your profile</h5>
<p>
<a href="#/framed/%252Fumbraco%252Fusers%252Fedituser.aspx%253Fid%253D{{user.id}}" class="btn btn-primary">Edit your profile</a>
</p>
</div>
<div class="umb-pane">
<h5>Your recent history</h5>
<ul class="umb-tree">
<li ng-repeat="item in history | orderBy:'time'">
<a ng-href="{{item.link}}" ng-click="gotoHistory(item.link)" prevent-default>
<i class="{{item.icon}}"></i> {{item.name}}</a>
</li>
</ul>
</div>
</div>

View File

@@ -32,7 +32,7 @@ function DataTypeEditController($scope, $routeParams, $location, dataTypeResourc
},
selectedEditorId: {
alias: "selectedEditorId",
label: "Property editor GUID"
label: "Property editor alias"
}
};

View File

@@ -1,12 +1,15 @@
angular.module("umbraco")
.controller("Umbraco.Editors.ListViewController",
function ($rootScope, $scope, $routeParams, contentResource, contentTypeResource) {
function ($rootScope, $scope, $routeParams, contentResource, contentTypeResource, editorContextService, notificationsService) {
$scope.selected = [];
$scope.actionInProgress = false;
$scope.options = {
pageSize: 10,
pageNumber: 1,
filter: '',
orderBy: 'id',
orderBy: 'Id',
orderDirection: "desc"
};
@@ -14,32 +17,34 @@ angular.module("umbraco")
$scope.next = function(){
if ($scope.options.pageNumber < $scope.listViewResultSet.totalPages) {
$scope.options.pageNumber++;
$scope.reloadView();
$scope.reloadView($scope.content.id);
}
};
$scope.goToPage = function (pageNumber) {
$scope.options.pageNumber = pageNumber + 1;
$scope.reloadView();
$scope.reloadView($scope.content.id);
};
$scope.sort = function(field){
$scope.options.sortby = field;
$scope.sort = function (field) {
$scope.options.orderBy = field;
if(field !== $scope.options.sortby){
if($scope.options.order === "desc"){
$scope.options.order = "asc";
}else{
$scope.options.order = "desc";
}
if ($scope.options.orderDirection === "desc") {
$scope.options.orderDirection = "asc";
}else{
$scope.options.orderDirection = "desc";
}
$scope.reloadView();
$scope.reloadView($scope.content.id);
};
$scope.prev = function(){
if ($scope.options.pageNumber > 1) {
$scope.options.pageNumber--;
$scope.reloadView();
$scope.reloadView($scope.content.id);
}
};
@@ -64,11 +69,107 @@ angular.module("umbraco")
});
};
var updateSelected = function (action, id) {
if (action === 'add' && $scope.selected.indexOf(id) === -1) {
$scope.selected.push(id);
}
if (action === 'remove' && $scope.selected.indexOf(id) !== -1) {
$scope.selected.splice($scope.selected.indexOf(id), 1);
}
};
$scope.updateSelection = function ($event, id) {
var checkbox = $event.target;
var action = (checkbox.checked ? 'add' : 'remove');
updateSelected(action, id);
};
$scope.selectAll = function ($event) {
var checkbox = $event.target;
var action = (checkbox.checked ? 'add' : 'remove');
for (var i = 0; i < $scope.listViewResultSet.items.length; i++) {
var entity = $scope.listViewResultSet.items[i];
updateSelected(action, entity.id);
}
};
$scope.getSelectedClass = function (entity) {
return $scope.isSelected(entity.id) ? 'selected' : '';
};
$scope.isSelected = function (id) {
return $scope.selected.indexOf(id) >= 0;
};
$scope.isSelectedAll = function () {
if ($scope.listViewResultSet != null)
return $scope.selected.length === $scope.listViewResultSet.items.length;
else
return false;
};
$scope.isAnythingSelected = function() {
return $scope.selected.length > 0;
};
$scope.delete = function () {
if (confirm("Sure you want to delete?") == true) {
$scope.actionInProgress = true;
$scope.bulkStatus = "Starting with delete";
var current = 1;
var total = $scope.selected.length;
for (var i = 0; i < $scope.selected.length; i++) {
$scope.bulkStatus = "Deleted doc " + current + " out of " + total + " documents";
contentResource.deleteById($scope.selected[i]).then(function(data) {
if (current == total) {
notificationsService.success("Bulk action", "Deleted " + total + "documents");
$scope.bulkStatus = "";
$scope.selected = [];
$scope.reloadView($scope.content.id);
$scope.actionInProgress = false;
}
current++;
});
}
}
};
$scope.publish = function () {
$scope.actionInProgress = true;
$scope.bulkStatus = "Starting with publish";
var current = 1;
var total = $scope.selected.length;
for (var i = 0; i < $scope.selected.length; i++) {
$scope.bulkStatus = "Publishing doc " + current + " out of " + total + " documents";
contentResource.getById($scope.selected[i]).then(function(content) {
contentResource.publish(content, false)
.then(function(content){
if (current == total) {
notificationsService.success("Bulk action", "Published " + total + "documents");
$scope.bulkStatus = "";
$scope.reloadView($scope.content.id);
$scope.actionInProgress = false;
}
current++;
});
});
}
};
$scope.unpublish = function () {
};
if($routeParams.id){
$scope.pagination = new Array(100);
$scope.listViewAllowedTypes = contentTypeResource.getAllowedTypes($routeParams.id);
$scope.reloadView($routeParams.id);
$scope.content = editorContextService.getContext();
}
});

View File

@@ -2,42 +2,54 @@
<div class="umb-listview" ng-controller="Umbraco.Editors.ListViewController">
<div class="row-fluid">
<div class="umb-sub-header">
<div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
Create
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li ng-repeat="contentType in listViewAllowedTypes">
<a href="#/content/edit/{{content.id}}?doctype={{contentType.alias}}&create=true">
<i class="icon-{{contentType.cssClass}}"></i> {{contentType.name}}</a>
</li>
</ul>
</div>
<div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
Create
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li ng-repeat="contentType in listViewAllowedTypes">
<a href="#/content/content/edit/{{content.id}}?doctype={{contentType.alias}}&create=true">
<i class="icon-{{contentType.cssClass}}"></i> {{contentType.name}}</a>
</li>
</ul>
</div>
<div class="btn-group" ng-show="isAnythingSelected()">
<a class="btn btn-success" ng-disabled="actionInProgress" ng-click="publish()" prevent-default>Publish</a>
</div>
<div class="btn-group" ng-show="isAnythingSelected()">
<a class="btn btn-warning" ng-disabled="actionInProgress" ng-click="unpublish()" prevent-default>Unpublish</a>
</div>
<div class="btn-group" ng-show="isAnythingSelected()">
<a class="btn btn-danger" ng-disabled="actionInProgress" ng-click="delete()" prevent-default>Delete</a>
</div>
<span ng-bind="bulkStatus" ng-show="isAnythingSelected()"></span>
</div>
<table class="table table-striped">
<thead>
<tr>
<td with="20"><input type="checkbox"></td>
<td><a href="#" ng-click="sort('name')" prevent-default>Name <i class="icon-sort"></i></a></td>
<td><a href="#" ng-click="sort('updateDate')" prevent-default>Last updated <i class="icon-sort"></i></a></td>
<td><a href="#" ng-click="sort('owner')" prevent-default>Editor <i class="icon-sort"></i></a></td>
<td with="20"><input type="checkbox" ng-click="selectAll($event)" ng-checked="isSelectedAll()"></td>
<td><a href="#" ng-click="sort('Name')" prevent-default>Name <i class="icon-sort"></i></a></td>
<td><a href="#" ng-click="sort('UpdateDate')" prevent-default>Last updated <i class="icon-sort"></i></a></td>
<td><a href="#" ng-click="sort('Owner')" prevent-default>Editor <i class="icon-sort"></i></a></td>
<td with="20"><form class="pull-right" novalidate>
<i class="icon-search"></i>
<input type="text" ng-model="options.filter" on-keyup="reloadView()">
<input type="text" ng-model="options.filter" on-keyup="reloadView(content.id)">
</form></td>
</tr>
</thead>
<tbody>
<tr ng-repeat="result in listViewResultSet.items">
<td><i class="{{result.icon}}"></i><input type="checkbox"></td>
<td><a href="#/content/edit/{{result.id}}">{{result.name}}</a></td>
<td>{{result.updateDate|date:'medium'}}
<span class="label label-success">Publish</span>
<td><!--<i class="icon {{result.icon}}"></i>--><input type="checkbox" ng-checked="isSelected(result.id)" ng-click="updateSelection($event, result.id)"></td>
<td><a href="#/content/content/edit/{{result.id}}">{{result.name}}</a></td>
<td>{{result.updateDate|date:'medium'}}
<!--<<span class="label label-success">Publish</span>-->
</td>
<td>{{result.owner.name}} <span class="label">Admin</span></td>
<td>{{result.owner.name}} <!--<span class="label">Admin</span>--></td>
<td></td>
</tr>
</tbody>
@@ -52,7 +64,7 @@
<ul>
<li><a href="#" ng-click="prev()" prevent-default>Prev</a></li>
<li ng-repeat="pgn in pagination"
<li ng-repeat="pgn in pagination track by $index"
ng-class="{active:$index==options.offset}">
<a href="#" ng-click="goToPage($index)" prevent-default>{{$index + 1}}</a>
</li>

View File

@@ -85,7 +85,10 @@ namespace Umbraco.Web.Editors
HandleContentNotFound(id);
}
return Mapper.Map<IContent, ContentItemDisplay>(foundContent);
var content = Mapper.Map<IContent, ContentItemDisplay>(foundContent);
return content;
// content.Tabs.ElementAt(0).Properties.
}
/// <summary>

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Umbraco.Core;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.PropertyEditors
{
[PropertyEditor(Constants.PropertyEditors.ListViewAlias, "List view", "listview")]
public class ListViewPropertyEditor : PropertyEditor
{
}
}

View File

@@ -80,16 +80,24 @@ namespace Umbraco.Web.Trees
foreach (var entity in entities)
{
var e = (UmbracoEntity)entity;
var allowedUserOptions = GetUserMenuItemsForNode(e);
if (CanUserAccessNode(e, allowedUserOptions))
{
//TODO: if the node is of a specific type, don't list its children
//this is to enable the list view on the editor
//for WIP I'm just checking against a hardcoded value
var hasChildren = e.HasChildren;
if (e.ContentTypeAlias == "umbNewsArea")
hasChildren = false;
var node = CreateTreeNode(
e.Id.ToInvariantString(),
queryStrings,
e.Name,
e.ContentTypeIcon,
e.HasChildren);
hasChildren);
//InjectLegacyTreeCompatibility(node, queryStrings);

View File

@@ -308,6 +308,7 @@
<Compile Include="Models\ContentEditing\UmbracoEntityTypes.cs" />
<Compile Include="Models\Mapping\MacroModelMapper.cs" />
<Compile Include="PropertyEditors\ColorListPreValueEditor.cs" />
<Compile Include="PropertyEditors\ListViewPropertyEditor.cs" />
<Compile Include="PropertyEditors\ParameterEditors\TextAreaParameterEditor.cs" />
<Compile Include="PropertyEditors\ParameterEditors\TextParameterEditor.cs" />
<Compile Include="PropertyEditors\ParameterEditors\TrueFalseParameterEditor.cs" />

View File

@@ -99,8 +99,7 @@ namespace umbraco.cms.presentation.settings
var save = Panel1.Menu.NewButton();
save.Icon = "save";
save.OnClientClick = "doSubmit()";
save.OnClientClick = "doSubmit()";
save.Text = ui.Text("save");
save.ButtonType = MenuButtonType.Primary;
save.ID = "save";

View File

@@ -37,7 +37,6 @@ namespace umbraco.cms.presentation.settings.stylesheet
SaveButton = Panel1.Menu.NewButton();
SaveButton.Icon = "save";
SaveButton.Text = ui.Text("save");
SaveButton.ButtonType = MenuButtonType.Primary;
SaveButton.ID = "save";