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

This commit is contained in:
perploug
2013-10-10 08:52:40 +02:00
52 changed files with 1223 additions and 352 deletions

View File

@@ -12,6 +12,7 @@ function sectionsDirective($timeout, $window, navigationService, sectionResource
scope.maxSections = 7;
scope.overflowingSections = 0;
scope.sections = [];
function loadSections(){
sectionResource.getSections()

View File

@@ -1,8 +1,10 @@
angular.module('umbraco.directives.validation')
.directive('valCompare',function () {
return {
require: "ngModel",
link: function(scope, elem, attrs, ctrl) {
require: "ngModel",
link: function (scope, elem, attrs, ctrl) {
//TODO: Pretty sure this should be done using a requires ^form in the directive declaration
var otherInput = elem.inheritedData("$formController")[attrs.valCompare];
ctrl.$parsers.push(function(value) {

View File

@@ -102,7 +102,9 @@ function valPropertyMsg(serverValidationManager) {
var errCount = 0;
for (var e in formCtrl.$error) {
errCount++;
if (e) {
errCount++;
}
}
if ((errCount === 1 && formCtrl.$error.valPropertyMsg !== undefined) ||

View File

@@ -6,17 +6,36 @@
* NOTE: there's already an ng-pattern but this requires that a regex expression is set, not a regex string
**/
function valRegex() {
return {
require: 'ngModel',
restrict: "A",
link: function (scope, elm, attrs, ctrl) {
var flags = "";
if (attrs.valRegexFlags) {
try {
flags = scope.$eval(attrs.valRegexFlags);
if (!flags) {
flags = attrs.valRegexFlags;
}
}
catch (e) {
flags = attrs.valRegexFlags;
}
}
var regex;
try {
regex = new RegExp(scope.$eval(attrs.valRegex));
var resolved = scope.$eval(attrs.valRegex);
if (resolved) {
regex = new RegExp(resolved, flags);
}
else {
regex = new RegExp(attrs.valRegex, flags);
}
}
catch(e) {
regex = new RegExp(attrs.valRegex);
regex = new RegExp(attrs.valRegex, flags);
}
var patternValidator = function (viewValue) {

View File

@@ -213,7 +213,7 @@ function contentEditingHelper($location, $routeParams, notificationsService, ser
}
args.scope.$broadcast("saved", { scope: args.scope });
if (!this.redirectToCreatedContent(args.newContent.id)) {
if (!this.redirectToCreatedContent(args.redirectId ? args.redirectId : args.newContent.id)) {
//we are not redirecting because this is not new content, it is existing content. In this case
// we need to detect what properties have changed and re-bind them with the server data.

View File

@@ -203,7 +203,7 @@ function umbDataFormatter() {
/** formats the display model used to display the member to the model used to save the member */
formatMemberPostData: function(displayModel, action) {
//this is basically the same as for media but we need to explicitly add the username,email to the save model
//this is basically the same as for media but we need to explicitly add the username,email, password to the save model
var saveModel = this.formatMediaPostData(displayModel, action);
var genericTab = _.find(displayModel.tabs, function (item) {
@@ -216,8 +216,17 @@ function umbDataFormatter() {
var propEmail = _.find(genericTab.properties, function (item) {
return item.alias === "_umb_email";
});
var propPass = _.find(genericTab.properties, function (item) {
return item.alias === "_umb_password";
});
saveModel.email = propEmail.value;
saveModel.username = propLogin.value;
//NOTE: This would only be set for new members!
if (angular.isString(propPass.value)) {
// if we are resetting or changing passwords then that data will come from the property editor and
// it's value will be an object not just a string.
saveModel.password = propPass.value;
}
return saveModel;
},

View File

@@ -1,7 +1,8 @@
<form novalidate name="contentForm"
ng-controller="Umbraco.Editors.DataType.EditController"
ng-show="loaded"
ng-submit="save()">
ng-submit="save()"
val-status-changed>
<umb-panel val-show-validation>
<umb-header>

View File

@@ -65,6 +65,8 @@ function MemberEditController($scope, $routeParams, $q, $timeout, $window, membe
contentEditingHelper.handleSuccessfulSave({
scope: $scope,
newContent: data,
//specify a custom id to redirect to since we want to use the GUID
redirectId: data.key,
rebindCallback: contentEditingHelper.reBindChangedProperties($scope.content, data)
});

View File

@@ -0,0 +1,40 @@
angular.module("umbraco").controller("Umbraco.PropertyEditors.ChangePasswordController",
function($scope) {
//the model config will contain an object, if it does not we'll create defaults
//NOTE: We will not support doing the password regex on the client side because the regex on the server side
//based on the membership provider cannot always be ported to js from .net directly.
/*
{
requiresQuestionAnswer: true/false,
enableReset: true/false,
minPasswordLength: 10
}
*/
//set defaults if they are not available
if (!$scope.model.config || !$scope.model.config.requiresQuestionAnswer) {
$scope.model.config.requiresQuestionAnswer = false;
}
if (!$scope.model.config || !$scope.model.config.enableReset) {
$scope.model.config.enableReset = true;
}
if (!$scope.model.config || !$scope.model.config.minPasswordLength) {
$scope.model.config.minPasswordLength = 7;
}
$scope.confirm = "";
$scope.hasPassword = $scope.model.value !== undefined && $scope.model.value !== null && $scope.model.value !== "";
$scope.changing = !$scope.hasPassword;
$scope.doChange = function() {
$scope.changing = true;
};
$scope.cancelChange = function() {
$scope.changing = false;
};
});

View File

@@ -0,0 +1,33 @@
<div ng-controller="Umbraco.PropertyEditors.ChangePasswordController" ng-switch="changing">
<div ng-switch-when="false">
<!--<a href="" ng-click="doChange()">Change password</a> -->
<div class="control-group warning">
<span class="help-block">Password changing or resetting is currently not supported</span>
</div>
</div>
<div ng-switch-when="true">
<div class="control-group">
<input type="text" name="password" ng-model="model.value" id="{{model.alias}}"
class="umb-editor umb-textstring textstring"
required
val-server
ng-minlength="{{model.config.minPasswordLength}}" />
<span class="help-inline" val-msg-for="password" val-toggle-msg="required">Required</span>
<span class="help-inline" val-msg-for="password" val-toggle-msg="minlength">Minimum {{model.config.minPasswordLength}} characters</span>
<span class="help-inline" val-msg-for="password" val-toggle-msg="valServer"></span>
</div>
<div class="control-group">
<input type="text" name="confirmpassword" ng-model="model.confirm" id="{{model.alias}}"
class="umb-editor umb-textstring textstring"
val-compare="password" />
<span class="help-inline" val-msg-for="confirmpassword" val-toggle-msg="valCompare">Passwords must match</span>
</div>
<!--<a href="" ng-click="cancelChange()" ng-show="hasPassword">Cancel</a> -->
</div>
</div>

View File

@@ -1,6 +0,0 @@
angular.module("umbraco")
.controller("Umbraco.PropertyEditors.EmailController",
function($rootScope, $scope, dialogService, $routeParams, contentResource, contentTypeResource, editorContextService, notificationsService) {
});

View File

@@ -1,3 +1,13 @@
<input type="email" name="textbox" ng-model="model.value" id="{{model.alias}}" class="umb-editor umb-textstring textstring" val-server="value" />
<span class="help-inline" val-msg-for="textbox" val-toggle-msg="email">Invalid email</span>
<span class="help-inline" val-msg-for="textbox" val-toggle-msg="valServer"></span>
<div>
<input type="email" name="textbox"
ng-model="model.value"
id="{{model.alias}}"
class="umb-editor umb-textstring textstring"
ng-required="model.config.IsRequired"
val-server="value" />
<span class="help-inline" val-msg-for="textbox" val-toggle-msg="required">Required</span>
<span class="help-inline" val-msg-for="textbox" val-toggle-msg="email">Invalid email</span>
<span class="help-inline" val-msg-for="textbox" val-toggle-msg="valServer"></span>
</div>

View File

@@ -1,2 +1,9 @@
<input type="text" name="textbox" ng-model="model.value" id="{{model.alias}}" class="umb-editor umb-textstring textstring" val-server="value" />
<span class="help-inline" val-msg-for="textbox" val-toggle-msg="valServer"></span>
<div>
<input type="text" name="textbox" ng-model="model.value" id="{{model.alias}}"
class="umb-editor umb-textstring textstring"
val-server="value"
ng-required="model.config.IsRequired" />
<span class="help-inline" val-msg-for="textbox" val-toggle-msg="required">Required</span>
<span class="help-inline" val-msg-for="textbox" val-toggle-msg="valServer"></span>
</div>