Removes legacy dialog client files

This commit is contained in:
Shannon
2018-05-16 10:33:46 +02:00
parent 95c6de5534
commit 6c5abf14bd
34 changed files with 2 additions and 2497 deletions

View File

@@ -280,7 +280,7 @@ function navigationService($rootScope, $route, $routeParams, $log, $location, $q
* @param {Event} event the click event triggering the method, passed from the DOM element
*/
showMenu: function(args) {
var deferred = $q.defer();
var self = this;
@@ -410,37 +410,7 @@ function navigationService($rootScope, $route, $routeParams, $log, $location, $q
});
}
},
/**
* @ngdoc method
* @name umbraco.services.navigationService#showUserDialog
* @methodOf umbraco.services.navigationService
*
* @description
* Opens the user dialog, next to the sections navigation
* template is located in views/common/dialogs/user.html
*/
showUserDialog: function () {
// hide tray and close help dialog
if (service.helpDialog) {
service.helpDialog.close();
}
service.hideTray();
if (service.userDialog) {
service.userDialog.close();
service.userDialog = undefined;
}
service.userDialog = dialogService.open(
{
template: "views/common/dialogs/user.html",
modalClass: "umb-modal-left",
show: true
});
return service.userDialog;
},
/**
* @ngdoc method

View File

@@ -1,25 +0,0 @@
angular.module("umbraco")
.controller("Umbraco.Dialogs.ApprovedColorPickerController", function ($scope, $http, umbPropEditorHelper, assetsService) {
assetsService.loadJs("lib/cssparser/cssparser.js", $scope)
.then(function () {
var cssPath = $scope.dialogData.cssPath;
$scope.cssClass = $scope.dialogData.cssClass;
$scope.classes = [];
$scope.change = function (newClass) {
$scope.model.value = newClass;
}
$http.get(cssPath)
.success(function (data) {
var parser = new CSSParser();
$scope.classes = parser.parse(data, false, false).cssRules;
$scope.classes.splice(0, 0, "noclass");
})
assetsService.loadCss("/App_Plugins/Lecoati.uSky.Grid/lib/uSky.Grid.ApprovedColorPicker.css", $scope);
assetsService.loadCss(cssPath, $scope);
});
});

View File

@@ -1,7 +0,0 @@
<div ng-controller="Umbraco.Dialogs.ApprovedColorController">
<div class='CssClassPickerBox {{(class.mSelectorText.substring(1) == cssClass)? "select" : "" }}'
ng-click="submit(class.mSelectorText.substring(1))" ng-repeat='class in classes'>
<div class='{{class.mSelectorText.substring(1)}}'>
</div>
</div>
</div>

View File

@@ -1,50 +0,0 @@
angular.module("umbraco")
.controller("Umbraco.Dialogs.HelpController", function ($scope, $location, $routeParams, helpService, userService, localizationService) {
$scope.section = $routeParams.section;
$scope.version = Umbraco.Sys.ServerVariables.application.version + " assembly: " + Umbraco.Sys.ServerVariables.application.assemblyVersion;
if(!$scope.section){
$scope.section = "content";
}
$scope.sectionName = $scope.section;
var rq = {};
rq.section = $scope.section;
//translate section name
localizationService.localize("sections_" + rq.section).then(function (value) {
$scope.sectionName = value;
});
userService.getCurrentUser().then(function(user){
rq.lang = user.locale;
if($routeParams.url){
rq.path = decodeURIComponent($routeParams.url);
if(rq.path.indexOf(Umbraco.Sys.ServerVariables.umbracoSettings.umbracoPath) === 0){
rq.path = rq.path.substring(Umbraco.Sys.ServerVariables.umbracoSettings.umbracoPath.length);
}
if(rq.path.indexOf(".aspx") > 0){
rq.path = rq.path.substring(0, rq.path.indexOf(".aspx"));
}
}else{
rq.path = rq.section + "/" + $routeParams.tree + "/" + $routeParams.method;
}
helpService.findHelp(rq).then(function(topics){
$scope.topics = topics;
});
helpService.findVideos(rq).then(function(videos){
$scope.videos = videos;
});
});
});

View File

@@ -1,58 +0,0 @@
<div class="umb-panel" ng-controller="Umbraco.Dialogs.HelpController">
<div class="umb-panel-header">
<h1 class="headline"><localize key="sections_help">Help</localize></h1>
<small class="umb-version">Umbraco version {{version}}</small>
</div>
<div class="umb-panel-body umb-scrollable">
<div class="tab-content umb-control-group">
<div class="umb-pane">
<h5><localize key="help_helpTopicsFor">Help topics for</localize>: {{sectionName}}</h5>
<ul class="unstyled list-icons" ng-show="topics">
<li ng-repeat="topic in topics">
<i class="icon icon-help-alt"></i>
<a target="_blank" href="{{topic.link}}?utm_source=core&utm_medium=help&utm_content=topic-link&utm_campaign=our" title="{{topic.title}}">
{{topic.title}}
</a>
<small class="umb-detail">{{topic.description}}</small>
</li>
</ul>
<ul class="unstyled list-icons">
<li>
<i class="icon icon-favorite"></i>
<a target="_blank" href="http://our.umbraco.org?utm_source=core&utm_medium=help&utm_content=link&utm_campaign=our">
<localize key="help_goTo">go to</localize> our.umbraco.org
</a>
<small class="umb-detail">The friendliest community</small>
</li>
</ul>
</div>
<div class="umb-pane">
<h5><localize key="help_videoChaptersFor">Video chapters for</localize>: {{sectionName}}</h5>
<ul class="thumbnails" ng-show="videos">
<li class="span2" ng-repeat="video in videos">
<div class="thumbnail" style="margin-right: 20px">
<a target="_blank" href="{{video.link}}?utm_source=core&utm_medium=help&utm_content=link&utm_campaign=tv" title="{{video.title}}">
<img ng-src="{{video.thumbnail}}?width=120" alt="{{video.title}}">
</a>
</div>
</li>
</ul>
<ul class="unstyled list-icons">
<li>
<i class="icon icon-tv-old"></i>
<a target="_blank" href="http://umbraco.tv?utm_source=core&utm_medium=help&utm_content=link&utm_campaign=tv">
<localize key="help_goTo">go to</localize> umbraco.tv
</a>
<small class="umb-detail"><localize key="help_theBestUmbracoVideoTutorials">The best Umbraco video tutorials</localize></small>
</li>
</ul>
</div>
</div>
</div>
</div>

View File

@@ -1,19 +0,0 @@
//used for the icon picker dialog
angular.module("umbraco")
.controller("Umbraco.Dialogs.IconPickerController",
function ($scope, iconHelper) {
iconHelper.getIcons().then(function(icons){
$scope.icons = icons;
});
$scope.submitClass = function(icon){
if($scope.color) {
$scope.submit(icon + " " + $scope.color);
}
else {
$scope.submit(icon);
}
};
}
);

View File

@@ -1,57 +0,0 @@
<div class="umb-panel" ng-controller="Umbraco.Dialogs.IconPickerController">
<div class="umb-panel-header">
<div class="umb-el-wrap umb-panel-buttons">
<div class="form-search">
<i class="icon-search"></i>
<input type="text"
style="width: 100%"
ng-model="searchTerm"
class="umb-search-field search-query input-block-level"
localize="placeholder"
placeholder="@placeholders_filter"
no-dirty-check />
</div>
</div>
</div>
<div class="umb-panel-body with-footer">
<div class="umb-control-group">
<select ng-model="color" class="input-block-level">
<option value=""><localize key="colors_black">Black</localize></option>
<option value="color-green"><localize key="colors_green">Green</localize></option>
<option value="color-yellow"><localize key="colors_yellow">Yellow</localize></option>
<option value="color-orange"><localize key="colors_orange">Orange</localize></option>
<option value="color-blue"><localize key="colors_blue">Blue</localize></option>
<option value="color-red"><localize key="colors_red">Red</localize></option>
</select>
</div>
<umb-load-indicator ng-if="loading"></umb-load-indicator>
<div class="umb-control-group" ng-show="!loading">
<ul class="umb-iconpicker" ng-class="color" ng-show="icons">
<li class="umb-iconpicker-item" ng-repeat="icon in filtered = (icons | filter: searchTerm) track by $id(icon)">
<a href="#" title="{{icon}}" ng-click="submitClass(icon)" prevent-default>
<i class="{{icon}} large"></i>
</a>
</li>
</ul>
</div>
<umb-empty-state ng-if="filtered.length === 0"
position="center">
<localize key="defaultdialogs_noIconsFound">No icons were found.</localize>
</umb-empty-state>
</div>
<div class="umb-panel-footer">
<div class="umb-el-wrap umb-panel-buttons">
<div class="btn-toolbar umb-btn-toolbar pull-right">
<a href ng-click="close()" class="btn btn-link">
<localize key="general_cancel">Cancel</localize>
</a>
</div>
</div>
</div>
</div>

View File

@@ -1,169 +0,0 @@
/**
* @ngdoc controller
* @name Umbraco.Dialogs.InsertMacroController
* @function
*
* @description
* The controller for the custom insert macro dialog. Until we upgrade the template editor to be angular this
* is actually loaded into an iframe with full html.
*/
function InsertMacroController($scope, entityResource, macroResource, umbPropEditorHelper, macroService, formHelper) {
/** changes the view to edit the params of the selected macro */
function editParams() {
//get the macro params if there are any
macroResource.getMacroParameters($scope.selectedMacro.id)
.then(function (data) {
//go to next page if there are params otherwise we can just exit
if (!angular.isArray(data) || data.length === 0) {
//we can just exist!
submitForm();
} else {
$scope.wizardStep = "paramSelect";
$scope.macroParams = data;
//fill in the data if we are editing this macro
if ($scope.dialogData && $scope.dialogData.macroData && $scope.dialogData.macroData.macroParamsDictionary) {
_.each($scope.dialogData.macroData.macroParamsDictionary, function (val, key) {
var prop = _.find($scope.macroParams, function (item) {
return item.alias == key;
});
if (prop) {
if (_.isString(val)) {
//we need to unescape values as they have most likely been escaped while inserted
val = _.unescape(val);
//detect if it is a json string
if (val.detectIsJson()) {
try {
//Parse it to json
prop.value = angular.fromJson(val);
}
catch (e) {
// not json
prop.value = val;
}
}
else {
prop.value = val;
}
}
else {
prop.value = val;
}
}
});
}
}
});
}
/** submit the filled out macro params */
function submitForm() {
//collect the value data, close the dialog and send the data back to the caller
//create a dictionary for the macro params
var paramDictionary = {};
_.each($scope.macroParams, function (item) {
var val = item.value;
if (item.value != null && item.value != undefined && !_.isString(item.value)) {
try {
val = angular.toJson(val);
}
catch (e) {
// not json
}
}
//each value needs to be xml escaped!! since the value get's stored as an xml attribute
paramDictionary[item.alias] = _.escape(val);
});
//need to find the macro alias for the selected id
var macroAlias = $scope.selectedMacro.alias;
//get the syntax based on the rendering engine
var syntax;
if ($scope.dialogData.renderingEngine && $scope.dialogData.renderingEngine === "WebForms") {
syntax = macroService.generateWebFormsSyntax({ macroAlias: macroAlias, macroParamsDictionary: paramDictionary });
}
else if ($scope.dialogData.renderingEngine && $scope.dialogData.renderingEngine === "Mvc") {
syntax = macroService.generateMvcSyntax({ macroAlias: macroAlias, macroParamsDictionary: paramDictionary });
}
else {
syntax = macroService.generateMacroSyntax({ macroAlias: macroAlias, macroParamsDictionary: paramDictionary });
}
$scope.submit({ syntax: syntax, macroAlias: macroAlias, macroParamsDictionary: paramDictionary });
}
$scope.macros = [];
$scope.selectedMacro = null;
$scope.wizardStep = "macroSelect";
$scope.macroParams = [];
$scope.submitForm = function () {
if (formHelper.submitForm({ scope: $scope })) {
formHelper.resetForm({ scope: $scope });
if ($scope.wizardStep === "macroSelect") {
editParams();
}
else {
submitForm();
}
}
};
//here we check to see if we've been passed a selected macro and if so we'll set the
//editor to start with parameter editing
if ($scope.dialogData && $scope.dialogData.macroData) {
$scope.wizardStep = "paramSelect";
}
//get the macro list - pass in a filter if it is only for rte
entityResource.getAll("Macro", ($scope.dialogData && $scope.dialogData.richTextEditor && $scope.dialogData.richTextEditor === true) ? "UseInEditor=true" : null)
.then(function (data) {
//if 'allowedMacros' is specified, we need to filter
if (angular.isArray($scope.dialogData.allowedMacros) && $scope.dialogData.allowedMacros.length > 0) {
$scope.macros = _.filter(data, function(d) {
return _.contains($scope.dialogData.allowedMacros, d.alias);
});
}
else {
$scope.macros = data;
}
//check if there's a pre-selected macro and if it exists
if ($scope.dialogData && $scope.dialogData.macroData && $scope.dialogData.macroData.macroAlias) {
var found = _.find(data, function (item) {
return item.alias === $scope.dialogData.macroData.macroAlias;
});
if (found) {
//select the macro and go to next screen
$scope.selectedMacro = found;
editParams();
return;
}
}
//we don't have a pre-selected macro so ensure the correct step is set
$scope.wizardStep = "macroSelect";
});
}
angular.module("umbraco").controller("Umbraco.Dialogs.InsertMacroController", InsertMacroController);

View File

@@ -1,50 +0,0 @@
<form novalidate name="insertMacroForm" ng-controller="Umbraco.Dialogs.InsertMacroController" val-form-manager>
<div class="umb-panel">
<div class="umb-panel-footer">
<div class="btn-toolbar umb-btn-toolbar pull-right">
<a href class="btn btn-link" ng-click="close()">
<localize key="cancel" />
</a>
<button type="button" ng-click="submitForm()" class="btn btn-primary">
<localize key="buttons_select" />
</button>
</div>
</div>
<div class="umb-panel-body no-header umb-scrollable" auto-scale="90" ng-switch="wizardStep">
<umb-control-group label="Choose a macro" ng-switch-when="macroSelect">
<select class="umb-editor" ng-change="submitForm()"
name="selectedMacro"
ng-model="$parent.$parent.selectedMacro"
ng-options="m as m.name for m in macros"
required>
<option value=""><localize key="choose" />...</option>
</select>
<span class="help-inline" val-msg-for="selectedMacro" val-toggle-msg="required"><localize key="required" /></span>
</umb-control-group>
<div class="umb-pane" ng-switch-when="paramSelect">
<h5>{{$parent.$parent.selectedMacro.name}}</h5>
<ul class="unstyled">
<li ng-repeat="param in $parent.macroParams">
<ng-form name="parameterForm">
<umb-control-group label="{{param.name}}">
<umb-editor model="param"></umb-editor>
</umb-control-group>
</ng-form>
</li>
</ul>
</div>
</div>
</div>
</form>

View File

@@ -1,34 +0,0 @@
/**
* @ngdoc controller
* @name Umbraco.Dialogs.LegacyDeleteController
* @function
*
* @description
* The controller for deleting content
*/
function LegacyDeleteController($scope, legacyResource, treeService, navigationService) {
$scope.performDelete = function() {
//mark it for deletion (used in the UI)
$scope.currentNode.loading = true;
legacyResource.deleteItem({
nodeId: $scope.currentNode.id,
nodeType: $scope.currentNode.nodeType,
alias: $scope.currentNode.name,
}).then(function () {
$scope.currentNode.loading = false;
//TODO: Need to sync tree, etc...
treeService.removeNode($scope.currentNode);
navigationService.hideMenu();
});
};
$scope.cancel = function() {
navigationService.hideDialog();
};
}
angular.module("umbraco").controller("Umbraco.Dialogs.LegacyDeleteController", LegacyDeleteController);

View File

@@ -1,14 +0,0 @@
<div class="umb-dialog" ng-controller="Umbraco.Dialogs.LegacyDeleteController">
<div class="umb-dialog-body" >
<div class="umb-pane">
<p>
<localize key="defaultdialogs_confirmdelete">Are you sure you want to delete</localize> <strong>{{currentNode.name}}</strong> ?
</p>
<umb-confirm on-confirm="performDelete" on-cancel="cancel">
</umb-confirm>
</div>
</div>
</div>

View File

@@ -1,147 +0,0 @@
//used for the media picker dialog
angular.module("umbraco").controller("Umbraco.Dialogs.LinkPickerController",
function ($scope, eventsService, dialogService, entityResource, contentResource, mediaHelper, userService, localizationService) {
var dialogOptions = $scope.dialogOptions;
var searchText = "Search...";
localizationService.localize("general_search").then(function (value) {
searchText = value + "...";
});
$scope.dialogTreeApi = {};
$scope.target = {};
$scope.searchInfo = {
searchFromId: null,
searchFromName: null,
showSearch: false,
results: [],
selectedSearchResults: []
}
if (dialogOptions.currentTarget) {
$scope.target = dialogOptions.currentTarget;
//if we have a node ID, we fetch the current node to build the form data
if ($scope.target.id || $scope.target.udi) {
var id = $scope.target.udi ? $scope.target.udi : $scope.target.id;
if (!$scope.target.path) {
entityResource.getPath(id, "Document").then(function (path) {
$scope.target.path = path;
//now sync the tree to this path
$scope.dialogTreeApi.syncTree({ path: $scope.target.path, tree: "content" });
});
}
contentResource.getNiceUrl(id).then(function (url) {
$scope.target.url = url;
});
}
}
function nodeSelectHandler(args) {
args.event.preventDefault();
args.event.stopPropagation();
if (args.node.metaData.listViewNode) {
//check if list view 'search' node was selected
$scope.searchInfo.showSearch = true;
$scope.searchInfo.searchFromId = args.node.metaData.listViewNode.id;
$scope.searchInfo.searchFromName = args.node.metaData.listViewNode.name;
}
else {
eventsService.emit("dialogs.linkPicker.select", args);
if ($scope.currentNode) {
//un-select if there's a current one selected
$scope.currentNode.selected = false;
}
$scope.currentNode = args.node;
$scope.currentNode.selected = true;
$scope.target.id = args.node.id;
$scope.target.udi = args.node.udi;
$scope.target.name = args.node.name;
if (args.node.id < 0) {
$scope.target.url = "/";
}
else {
contentResource.getNiceUrl(args.node.id).then(function (url) {
$scope.target.url = url;
});
}
if (!angular.isUndefined($scope.target.isMedia)) {
delete $scope.target.isMedia;
}
}
}
function nodeExpandedHandler(args) {
if (angular.isArray(args.children)) {
//iterate children
_.each(args.children, function (child) {
//check if any of the items are list views, if so we need to add a custom
// child: A node to activate the search
if (child.metaData.isContainer) {
child.hasChildren = true;
child.children = [
{
level: child.level + 1,
hasChildren: false,
name: searchText,
metaData: {
listViewNode: child,
},
cssClass: "icon umb-tree-icon sprTree icon-search",
cssClasses: ["not-published"]
}
];
}
});
}
}
$scope.switchToMediaPicker = function () {
userService.getCurrentUser().then(function (userData) {
dialogService.mediaPicker({
startNodeId: userData.startMediaIds.length == 0 ? -1 : userData.startMediaIds[0],
callback: function(media) {
$scope.target.id = media.id;
$scope.target.isMedia = true;
$scope.target.name = media.name;
$scope.target.url = mediaHelper.resolveFile(media);
}
});
});
};
$scope.hideSearch = function () {
$scope.searchInfo.showSearch = false;
$scope.searchInfo.searchFromId = null;
$scope.searchInfo.searchFromName = null;
$scope.searchInfo.results = [];
}
// method to select a search result
$scope.selectResult = function (evt, result) {
result.selected = result.selected === true ? false : true;
nodeSelectHandler(evt, {event: evt, node: result});
};
//callback when there are search results
$scope.onSearchResults = function (results) {
$scope.searchInfo.results = results;
$scope.searchInfo.showSearch = true;
};
$scope.onTreeInit = function () {
$scope.dialogTreeApi.callbacks.treeNodeSelect(nodeSelectHandler);
$scope.dialogTreeApi.callbacks.treeNodeExpanded(nodeExpandedHandler);
}
});

View File

@@ -1,75 +0,0 @@
<div class="umb-panel" ng-controller="Umbraco.Dialogs.LinkPickerController">
<div class="umb-panel-body no-header with-footer compact">
<umb-pane>
<umb-control-group label="@defaultdialogs_urlLinkPicker">
<input type="text"
localize="placeholder"
placeholder="@general_url"
class="umb-editor umb-textstring"
ng-model="target.url"
ng-disabled="target.id"
/>
</umb-control-group>
<umb-control-group label="@defaultdialogs_nodeNameLinkPicker">
<input type="text"
localize="placeholder"
placeholder="@placeholders_entername"
class="umb-editor umb-textstring"
ng-model="target.name" />
</umb-control-group>
<umb-control-group label="@content_target">
<select class="umb-editor umb-dropdown" ng-model="target.target">
<option value=""></option>
<option value="_blank"><localize key="defaultdialogs_openInNewWindow">Opens the linked document in a new window or tab</localize></option>
</select>
</umb-control-group>
</umb-pane>
<umb-tree-search-box hide-search-callback="hideSearch"
search-callback="onSearchResults"
search-from-id="{{searchInfo.searchFromId}}"
search-from-name="{{searchInfo.searchFromName}}"
show-search="{{searchInfo.showSearch}}"
section="{{section}}">
</umb-tree-search-box>
<br/>
<umb-tree-search-results ng-if="searchInfo.showSearch"
results="searchInfo.results"
select-result-callback="selectResult">
</umb-tree-search-results>
<div ng-hide="searchInfo.showSearch">
<umb-tree section="content"
hideheader="true"
hideoptions="true"
api="dialogTreeApi"
on-init="onTreeInit()"
isdialog="true"
enablecheckboxes="true">
</umb-tree>
</div>
</div>
<div class="umb-panel-footer">
<div class="umb-el-wrap umb-panel-buttons">
<div class="btn-toolbar umb-btn-toolbar pull-right">
<a href ng-click="close()" class="btn btn-link">
<localize key="general_cancel">Cancel</localize>
</a>
<a href ng-click="switchToMediaPicker()" class="btn">
<localize key="defaultdialogs_selectMedia">Select media</localize>
</a>
<button
class="btn btn-primary"
ng-click="submit(target)">
<localize key="buttons_select">Select</localize>
</button>
</div>
</div>
</div>
</div>

View File

@@ -1,14 +0,0 @@
//used for the macro picker dialog
angular.module("umbraco").controller("Umbraco.Dialogs.MacroPickerController", function ($scope, macroFactory, umbPropEditorHelper) {
$scope.macros = macroFactory.all(true);
$scope.dialogMode = "list";
$scope.configureMacro = function(macro){
$scope.dialogMode = "configure";
$scope.dialogData.macro = macroFactory.getMacro(macro.alias);
//set the correct view for each item
for (var i = 0; i < dialogData.macro.properties.length; i++) {
dialogData.macro.properties[i].editorView = umbPropEditorHelper.getViewPath(dialogData.macro.properties[i].view);
}
};
});

View File

@@ -1,38 +0,0 @@
<div class="umb-panel" ng-controller="Umbraco.Dialogs.MacroPickerController">
<div class="umb-panel-body no-header with-footer umb-scrollable" ng-switch on="dialogMode">
<div class="umb-control-group">
<div ng-switch-when="list" ng-swicth-default class="tab-content form-horizontal umb-el-wrap">
<ul class="nav nav-tabs nav-stacked">
<li ng-repeat="macro in macros">
<a href="#" ng-click="configureMacro(macro)" prevent-default>
{{macro.name}}
</a>
</li>
</ul>
</div>
<div ng-switch-when="configure" class="tab-content form umb-el-wrap">
<h5>{{dialogData.macro.name}}</h5>
<div class="umb-pane" ng-repeat="model in dialogData.macro.properties">
<label class="control-label" ng-hide="model.hideLabel" for="{{model.alias}}">{{model.label}}
</label>
<div class="controls"
ng-include="model.editorView">
</div>
</div>
</div>
</div>
</div>
<div class="umb-panel-footer">
<div class="umb-el-wrap umb-panel-buttons">
<div class="btn-toolbar umb-btn-toolbar">
<input type="button" ng-click="submit(dialogData)" class="btn btn-primary" value="select" />
</div>
</div>
</div>
</div>

View File

@@ -1,134 +0,0 @@
//used for the media picker dialog
angular.module("umbraco")
.controller("Umbraco.Dialogs.MediaPickerController",
function($scope, mediaResource, umbRequestHelper, entityResource, $log, mediaHelper, mediaTypeHelper, eventsService, treeService) {
var dialogOptions = $scope.dialogOptions;
$scope.onlyImages = dialogOptions.onlyImages;
$scope.showDetails = dialogOptions.showDetails;
$scope.multiPicker = (dialogOptions.multiPicker && dialogOptions.multiPicker !== "0") ? true : false;
$scope.startNodeId = dialogOptions.startNodeId ? dialogOptions.startNodeId : -1;
$scope.cropSize = dialogOptions.cropSize;
//preload selected item
$scope.target = undefined;
if (dialogOptions.currentTarget) {
$scope.target = dialogOptions.currentTarget;
}
$scope.acceptedMediatypes = [];
mediaTypeHelper.getAllowedImagetypes($scope.startNodeId)
.then(function(types) {
$scope.acceptedMediatypes = types;
});
$scope.upload = function(v) {
angular.element(".umb-file-dropzone-directive .file-select").click();
};
$scope.dragLeave = function(el, event) {
$scope.activeDrag = false;
};
$scope.dragEnter = function(el, event) {
$scope.activeDrag = true;
};
$scope.submitFolder = function(e) {
if (e.keyCode === 13) {
e.preventDefault();
mediaResource
.addFolder($scope.newFolderName, $scope.currentFolder.id)
.then(function(data) {
$scope.showFolderInput = false;
$scope.newFolderName = "";
//we've added a new folder so lets clear the tree cache for that specific item
treeService.clearCache({
cacheKey: "__media", //this is the main media tree cache key
childrenOf: data.parentId //clear the children of the parent
});
$scope.gotoFolder(data);
});
}
};
$scope.gotoFolder = function(folder) {
if (!folder) {
folder = { id: -1, name: "Media", icon: "icon-folder" };
}
if (folder.id > 0) {
entityResource.getAncestors(folder.id, "media")
.then(function(anc) {
// anc.splice(0,1);
$scope.path = _.filter(anc,
function(f) {
return f.path.indexOf($scope.startNodeId) !== -1;
});
});
mediaTypeHelper.getAllowedImagetypes(folder.id)
.then(function(types) {
$scope.acceptedMediatypes = types;
});
} else {
$scope.path = [];
}
//mediaResource.rootMedia()
mediaResource.getChildren(folder.id)
.then(function(data) {
$scope.searchTerm = "";
$scope.images = data.items ? data.items : [];
});
$scope.currentFolder = folder;
};
$scope.clickHandler = function(image, ev, select) {
ev.preventDefault();
if (image.isFolder && !select) {
$scope.gotoFolder(image);
} else {
eventsService.emit("dialogs.mediaPicker.select", image);
//we have 3 options add to collection (if multi) show details, or submit it right back to the callback
if ($scope.multiPicker) {
$scope.select(image);
image.cssclass = ($scope.dialogData.selection.indexOf(image) > -1) ? "selected" : "";
} else if ($scope.showDetails) {
$scope.target = image;
$scope.target.url = mediaHelper.resolveFile(image);
} else {
$scope.submit(image);
}
}
};
$scope.exitDetails = function() {
if (!$scope.currentFolder) {
$scope.gotoFolder();
}
$scope.target = undefined;
};
$scope.onUploadComplete = function() {
$scope.gotoFolder($scope.currentFolder);
};
$scope.onFilesQueue = function() {
$scope.activeDrag = false;
};
//default root item
if (!$scope.target) {
$scope.gotoFolder({ id: $scope.startNodeId, name: "Media", icon: "icon-folder" });
}
});

View File

@@ -1,161 +0,0 @@
<form ng-controller="Umbraco.Dialogs.MediaPickerController" id="fileupload"
method="POST"
enctype="multipart/form-data"
umb-image-upload="options">
<div class="umb-panel umb-dialogs-mediapicker" ng-if="target">
<div class="umb-panel-body no-header with-footer compact">
<umb-pane>
<umb-control-group ng-if="target.url">
<div class="clearfix">
<umb-image-gravity src="target.url"
center="target.focalPoint" />
</div>
<div ng-if="cropSize">
<h5>Preview</h5>
<umb-image-thumbnail center="target.focalPoint"
src="target.url"
height="{{cropSize.height}}"
width="{{cropSize.width}}"
max-size="400" />
</div>
</umb-control-group>
<umb-control-group label="@general_url">
<input type="text"
localize="placeholder"
placeholder="@general_url"
class="umb-editor umb-textstring"
ng-model="target.url"
ng-disabled="target.id" />
</umb-control-group>
<umb-control-group label="@content_altTextOptional">
<input type="text"
class="umb-editor umb-textstring"
ng-model="target.altText" />
</umb-control-group>
</umb-pane>
</div>
<div class="umb-panel-footer">
<div class="umb-el-wrap umb-panel-buttons">
<div class="btn-toolbar umb-btn-toolbar pull-right">
<a href ng-click="exitDetails()" class="btn btn-link">
<localize key="general_cancel">Cancel</localize>
</a>
<button class="btn btn-primary"
ng-click="submit(target)">
<localize key="general_insert">Insert</localize>
</button>
</div>
</div>
</div>
</div>
<div class="umb-panel umb-dialogs-mediapicker browser"
on-drag-leave="dragLeave()"
on-drag-end="dragLeave()"
on-drag-enter="dragEnter()"
ng-hide="target">
<div class="umb-panel-header">
<div class="umb-el-wrap umb-panel-buttons umb-mediapicker-upload">
<div class="form-search">
<i class="icon-search"></i>
<input type="text"
ng-model="searchTerm"
class="umb-search-field search-query"
localize="placeholder"
placeholder="@placeholders_filter"
no-dirty-check />
</div>
<div class="upload-button">
<button class="btn fileinput-button" ng-click="upload()" ng-class="{disabled: disabled}">
<i class="icon-page-up"></i>
<localize key="general_upload">Upload</localize>
</button>
</div>
</div>
<div class="row">
<ul class="breadcrumb span12">
<li ng-hide="startNodeId != -1">
<a href ng-click="gotoFolder()" prevent-default>Media</a> /
</li>
<li ng-repeat="item in path">
<a href ng-click="gotoFolder(item)" prevent-default>{{item.name}}</a> /
</li>
<li>
<a href ng-hide="showFolderInput" ng-click="showFolderInput = true">
<i class="icon icon-add small"></i>
</a>
<input type="text"
class="input-foldername input-mini inline"
ng-show="showFolderInput"
ng-model="newFolderName"
ng-keydown="submitFolder($event)"
on-blur="showFolderInput = false"
focus-when="{{showFolderInput}}">
</li>
</ul>
</div>
</div>
<div class="umb-panel-body with-footer">
<umb-file-dropzone ng-if="acceptedMediatypes.length > 0"
accepted-mediatypes="acceptedMediatypes"
hide-dropzone="{{!activeDrag && images.length > 0}}"
parent-id="{{currentFolder.id}}"
files-uploaded="onUploadComplete"
files-queued="onFilesQueue">
</umb-file-dropzone>
<umb-photo-folder min-height="105"
min-width="150"
max-height="250"
ideal-items-per-row="3"
on-click="clickHandler"
ng-model="images"
images-only="{{onlyImages}}"
filter-by="searchTerm" />
</div>
<div class="umb-panel-footer">
<div class="umb-el-wrap umb-panel-buttons">
<div class="btn-toolbar umb-btn-toolbar pull-right">
<a href ng-click="close()" class="btn btn-link">
<localize key="general_cancel">Cancel</localize>
</a>
<button class="btn btn-primary"
ng-show="multiPicker"
ng-click="submit(dialogData.selection)">
<localize key="buttons_select">Select</localize>({{dialogData.selection.length}})
</button>
</div>
</div>
</div>
</div>
</form>

View File

@@ -1,37 +0,0 @@
//used for the member picker dialog
angular.module("umbraco").controller("Umbraco.Dialogs.MemberGroupPickerController",
function($scope, eventsService, entityResource, searchService, $log) {
var dialogOptions = $scope.dialogOptions;
$scope.dialogTreeApi = {};
$scope.multiPicker = dialogOptions.multiPicker;
/** Method used for selecting a node */
function select(text, id) {
if (dialogOptions.multiPicker) {
$scope.select(id);
}
else {
$scope.submit(id);
}
}
function nodeSelectHandler(args) {
args.event.preventDefault();
args.event.stopPropagation();
eventsService.emit("dialogs.memberGroupPicker.select", args);
//This is a tree node, so we don't have an entity to pass in, it will need to be looked up
//from the server in this method.
select(args.node.name, args.node.id);
//toggle checked state
args.node.selected = args.node.selected === true ? false : true;
}
function onTreeInit() {
$scope.dialogTreeApi.callbacks.treeNodeSelect(nodeSelectHandler);
}
});

View File

@@ -1,35 +0,0 @@
<div class="umb-panel" ng-controller="Umbraco.Dialogs.MemberGroupPickerController">
<div class="umb-panel-body with-footer no-header">
<div>
<umb-tree section="member"
treealias="memberGroups"
hideheader="true"
hideoptions="true"
isdialog="true"
on-init="onTreeInit()"
api="dialogTreeApi"
enablecheckboxes="{{multiPicker}}">
</umb-tree>
</div>
</div>
<div class="umb-panel-footer">
<div class="umb-el-wrap umb-panel-buttons">
<div class="btn-toolbar umb-btn-toolbar pull-right">
<a href ng-click="close()" class="btn btn-link">
<localize key="general_cancel">Cancel</localize>
</a>
<button class="btn btn-primary"
ng-click="submit(dialogData.selection)">
<localize key="buttons_select">Select</localize>
({{dialogData.selection.length}})
</button>
</div>
</div>
</div>
</div>

View File

@@ -1 +0,0 @@
{{propertyTypeToRender}}

View File

@@ -1,79 +0,0 @@
angular.module("umbraco").controller("Umbraco.Dialogs.RteEmbedController", function ($scope, $http, umbRequestHelper) {
$scope.form = {};
$scope.form.url = "";
$scope.form.width = 360;
$scope.form.height = 240;
$scope.form.constrain = true;
$scope.form.preview = "";
$scope.form.success = false;
$scope.form.info = "";
$scope.form.supportsDimensions = false;
var origWidth = 500;
var origHeight = 300;
$scope.showPreview = function() {
if ($scope.form.url) {
$scope.form.show = true;
$scope.form.preview = "<div class=\"umb-loader\" style=\"height: 10px; margin: 10px 0px;\"></div>";
$scope.form.info = "";
$scope.form.success = false;
$http({ method: 'GET', url: umbRequestHelper.getApiUrl("embedApiBaseUrl", "GetEmbed"), params: { url: $scope.form.url, width: $scope.form.width, height: $scope.form.height } })
.success(function (data) {
$scope.form.preview = "";
switch (data.Status) {
case 0:
//not supported
$scope.form.info = "Not supported";
break;
case 1:
//error
$scope.form.info = "Could not embed media - please ensure the URL is valid";
break;
case 2:
$scope.form.preview = data.Markup;
$scope.form.supportsDimensions = data.SupportsDimensions;
$scope.form.success = true;
break;
}
})
.error(function () {
$scope.form.supportsDimensions = false;
$scope.form.preview = "";
$scope.form.info = "Could not embed media - please ensure the URL is valid";
});
} else {
$scope.form.supportsDimensions = false;
$scope.form.preview = "";
$scope.form.info = "Please enter a URL";
}
};
$scope.changeSize = function (type) {
var width, height;
if ($scope.form.constrain) {
width = parseInt($scope.form.width, 10);
height = parseInt($scope.form.height, 10);
if (type == 'width') {
origHeight = Math.round((width / origWidth) * height);
$scope.form.height = origHeight;
} else {
origWidth = Math.round((height / origHeight) * width);
$scope.form.width = origWidth;
}
}
if ($scope.form.url != "") {
$scope.showPreview();
}
};
$scope.insert = function(){
$scope.submit($scope.form.preview);
};
});

View File

@@ -1,36 +0,0 @@
<form ng-controller="Umbraco.Dialogs.RteEmbedController" val-form-manager>
<div class="umb-panel">
<div class="umb-panel-body no-header with-footer">
<umb-pane>
<umb-control-group label="@general_url">
<input id="url" class="umb-editor input-block-level" type="text" ng-model="form.url" ng-keyup="$event.keyCode == 13 ? showPreview() : null" required />
<input type="button" ng-click="showPreview()" class="btn" localize="value" value="@general_retrieve" />
</umb-control-group>
<div ng-show="form.supportsDimensions">
<umb-control-group label="@general_size">
<input type="text" ng-model="form.width" on-blur="changeSize('width')" style="width:50px"/> x <input type="text" ng-model="form.height" on-blur="changeSize('height')" style="width:50px"/>
<label for="constrain" style="display:inline"><localize key="general_constrain">Constrain</localize>:</label>
<input id="constrain" type="checkbox" ng-model="form.constrain" style="margin-bottom: 10px;"/>
</umb-control-group>
</div>
<div>
<p ng-bind="form.info"></p>
<div ng-bind-html-unsafe="form.preview"></div>
</div>
</umb-pane>
</div>
<div class="umb-panel-footer">
<div class="btn-toolbar umb-btn-toolbar pull-right">
<a href class="btn btn-link" ng-click="close()">
<localize key="cancel" />
</a>
<input type="button" ng-click="insert()" class="btn btn-primary" value="Ok" ng-disabled="!form.success" />
</div>
</div>
</div>
</form>

View File

@@ -1,102 +0,0 @@
angular.module("umbraco").controller('Umbraco.Dialogs.Template.QueryBuilderController',
function($scope, $http, dialogService){
$http.get("backoffice/UmbracoApi/TemplateQuery/GetAllowedProperties").then(function(response) {
$scope.properties = response.data;
});
$http.get("backoffice/UmbracoApi/TemplateQuery/GetContentTypes").then(function (response) {
$scope.contentTypes = response.data;
});
$http.get("backoffice/UmbracoApi/TemplateQuery/GetFilterConditions").then(function (response) {
$scope.conditions = response.data;
});
$scope.query = {
contentType: {
name: "Everything"
},
source:{
name: "My website"
},
filters:[
{
property:undefined,
operator: undefined
}
],
sort:{
property:{
alias: "",
name: "",
},
direction: "ascending"
}
};
$scope.chooseSource = function(query){
dialogService.contentPicker({
callback: function (data) {
if (data.id > 0) {
query.source = { id: data.id, name: data.name };
} else {
query.source.name = "My website";
delete query.source.id;
}
}
});
};
var throttledFunc = _.throttle(function() {
$http.post("backoffice/UmbracoApi/TemplateQuery/PostTemplateQuery", $scope.query).then(function (response) {
$scope.result = response.data;
});
}, 200);
$scope.$watch("query", function(value) {
throttledFunc();
}, true);
$scope.getPropertyOperators = function (property) {
var conditions = _.filter($scope.conditions, function(condition) {
var index = condition.appliesTo.indexOf(property.type);
return index >= 0;
});
return conditions;
};
$scope.addFilter = function(query){
query.filters.push({});
};
$scope.trashFilter = function (query) {
query.filters.splice(query,1);
};
$scope.changeSortOrder = function(query){
if(query.sort.direction === "ascending"){
query.sort.direction = "descending";
}else{
query.sort.direction = "ascending";
}
};
$scope.setSortProperty = function(query, property){
query.sort.property = property;
if(property.type === "datetime"){
query.sort.direction = "descending";
}else{
query.sort.direction = "ascending";
}
};
});

View File

@@ -1,158 +0,0 @@
<form novalidate name="contentForm"
ng-controller="Umbraco.Dialogs.Template.QueryBuilderController"
ng-submit="close()"
val-form-manager>
<style>
.umb-querybuilder .row {font-size: 12px; line-height: 12px}
.umb-querybuilder .row a.btn{font-size: 12px; background: lightyellow}
.umb-querybuilder .row > div{
padding: 20px;
border-bottom: 1px solid #efefef;
}
</style>
<div class="umb-panel">
<div class="umb-panel-header">
<h1 class="headline" style="margin: 10px 0 0 0"><localize key="template_buildQuery">Build a query</localize></h1>
</div>
<div class="umb-panel-body with-footer umb-querybuilder">
<div class="row">
<div>
I want
<div class="btn-group">
<a class="btn btn-link dropdown-toggle"
data-toggle="dropdown" href="#">
{{query.contentType.name}}
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li ng-repeat="contentType in contentTypes">
<a href ng-click="query.contentType = contentType">
{{contentType.name}}
</a>
</li>
</ul>
</div>
<span>from</span>
<a href class="btn btn-link" ng-click="chooseSource(query)">
{{query.source.name}}
<span class="caret"></span>
</a>
</div>
<div ng-repeat="filter in query.filters">
<span ng-if="$first">Where</span>
<span ng-if="!$first">And</span>
<div class="btn-group">
<a class="btn btn-link dropdown-toggle"
data-toggle="dropdown" href="#">
{{filter.property.name}}
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li ng-repeat="property in properties">
<a href ng-click="filter.property = property">
{{property.name}}
</a>
</li>
</ul>
</div>
<div class="btn-group" ng-if="filter.property">
<a class="btn btn-link dropdown-toggle"
data-toggle="dropdown" href="#">
{{filter.term.name}}
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li ng-repeat="term in getPropertyOperators(filter.property)">
<a href ng-click="filter.term = term">
{{term.name}}
</a>
</li>
</ul>
</div>
<input type="text" ng-if="filter.term" style="width:90px;" ng-model="filter.constraintValue" />
<a href ng-click="addFilter(query)">
<i class="icon-add"></i>
</a>
<a href ng-if="query.filters.length > 1" ng-click="trashFilter(query)">
<i class="icon-trash"></i>
</a>
</div>
<div>
Order by
<div class="btn-group">
<a class="btn btn-link dropdown-toggle"
data-toggle="dropdown" href="#">
{{query.sort.property.name}}
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li ng-repeat="property in properties">
<a href ng-click="setSortProperty(query, property)">
{{property.name}}
</a>
</li>
</ul>
</div>
<a href class="btn" ng-click="changeSortOrder(query)">
{{query.sort.direction}}
</a>
</div>
</div>
<h4>Returns {{result.resultCount}} items in {{result.executionTime}} miliseconds</h4>
<ul class="nav unstyled">
<li ng-repeat="item in result.sampleResults">
<i class="icon icon-document blue"></i> {{item.name}}
</li>
</ul>
<pre>{{result.queryExpression}}</pre>
</div>
<div class="umb-panel-footer" >
<div class="umb-el-wrap umb-panel-buttons">
<div class="btn-toolbar umb-btn-toolbar pull-right">
<a href ng-click="close()" class="btn btn-link">
<localize key="general_close">Close</localize>
</a>
<a href ng-click="submit(result.queryExpression)" class="btn btn-primary"><localize key="general_insert">Insert</localize></a>
</div>
</div>
</div>
</div>
</div>
</form>

View File

@@ -1,8 +0,0 @@
angular.module("umbraco").controller('Umbraco.Dialogs.Template.SnippetController',
function($scope) {
$scope.type = $scope.dialogOptions.type;
$scope.section = {
name: "",
required: false
};
});

View File

@@ -1,37 +0,0 @@
<form novalidate name="contentForm"
ng-controller="Umbraco.Dialogs.Template.SnippetController"
ng-submit="close()"
val-form-manager>
<div class="umb-panel">
<div class="umb-panel-header">
<div class="panel-dialog--header" style="border-bottom: 1px solid whitesmoke">Configure the section</div>
</div>
<div class="umb-panel-body with-footer umb-querybuilder">
<label>
<div class="input-label--title">
Section name:
</div>
<input type="text" ng-model="section.name"/>
</label>
<label ng-show="type === 'rendersection'">
<input style="margin: 0;" type="checkbox" ng-checked="section.required" ng-model="section.required"/>
<div class="input-label--small">
<localize key="general_required">Required</localize>
</div>
</label>
</div>
<div class="umb-panel-footer">
<div class="umb-el-wrap umb-panel-buttons">
<div class="btn-toolbar umb-btn-toolbar pull-right">
<a href ng-click="close()" class="btn btn-link">
<localize key="general_close">Close</localize>
</a>
<a href ng-click="submit(section)" class="btn btn-primary"><localize key="general_insert">Insert</localize></a>
</div>
</div>
</div>
</div>
</form>

View File

@@ -1,428 +0,0 @@
//used for the media picker dialog
angular.module("umbraco").controller("Umbraco.Dialogs.TreePickerController",
function ($scope, entityResource, eventsService, $log, searchService, angularHelper, $timeout, localizationService, treeService) {
var tree = null;
var dialogOptions = $scope.dialogOptions;
$scope.dialogTreeApi = {};
$scope.section = dialogOptions.section;
$scope.treeAlias = dialogOptions.treeAlias;
$scope.multiPicker = dialogOptions.multiPicker;
$scope.hideHeader = true;
$scope.searchInfo = {
searchFromId: dialogOptions.startNodeId,
searchFromName: null,
showSearch: false,
results: [],
selectedSearchResults: []
}
//create the custom query string param for this tree
$scope.customTreeParams = dialogOptions.startNodeId ? "startNodeId=" + dialogOptions.startNodeId : "";
$scope.customTreeParams += dialogOptions.customTreeParams ? "&" + dialogOptions.customTreeParams : "";
var searchText = "Search...";
localizationService.localize("general_search").then(function (value) {
searchText = value + "...";
});
// Allow the entity type to be passed in but defaults to Document for backwards compatibility.
var entityType = dialogOptions.entityType ? dialogOptions.entityType : "Document";
//min / max values
if (dialogOptions.minNumber) {
dialogOptions.minNumber = parseInt(dialogOptions.minNumber, 10);
}
if (dialogOptions.maxNumber) {
dialogOptions.maxNumber = parseInt(dialogOptions.maxNumber, 10);
}
if (dialogOptions.section === "member") {
entityType = "Member";
}
else if (dialogOptions.section === "media") {
entityType = "Media";
}
//Configures filtering
if (dialogOptions.filter) {
dialogOptions.filterExclude = false;
dialogOptions.filterAdvanced = false;
//used advanced filtering
if (angular.isFunction(dialogOptions.filter)) {
dialogOptions.filterAdvanced = true;
}
else if (angular.isObject(dialogOptions.filter)) {
dialogOptions.filterAdvanced = true;
}
else {
if (dialogOptions.filter.startsWith("!")) {
dialogOptions.filterExclude = true;
dialogOptions.filter = dialogOptions.filter.substring(1);
}
//used advanced filtering
if (dialogOptions.filter.startsWith("{")) {
dialogOptions.filterAdvanced = true;
//convert to object
dialogOptions.filter = angular.fromJson(dialogOptions.filter);
}
}
}
function nodeExpandedHandler(ev, args) {
if (angular.isArray(args.children)) {
//iterate children
_.each(args.children, function (child) {
//check if any of the items are list views, if so we need to add some custom
// children: A node to activate the search, any nodes that have already been
// selected in the search
if (child.metaData.isContainer) {
child.hasChildren = true;
child.children = [
{
level: child.level + 1,
hasChildren: false,
parent: function () {
return child;
},
name: searchText,
metaData: {
listViewNode: child,
},
cssClass: "icon-search",
cssClasses: ["not-published"]
}
];
//add base transition classes to this node
child.cssClasses.push("tree-node-slide-up");
var listViewResults = _.filter($scope.searchInfo.selectedSearchResults, function(i) {
return i.parentId == child.id;
});
_.each(listViewResults, function(item) {
child.children.unshift({
id: item.id,
name: item.name,
cssClass: "icon umb-tree-icon sprTree " + item.icon,
level: child.level + 1,
metaData: {
isSearchResult: true
},
hasChildren: false,
parent: function () {
return child;
}
});
});
}
//now we need to look in the already selected search results and
// toggle the check boxes for those ones that are listed
var exists = _.find($scope.searchInfo.selectedSearchResults, function (selected) {
return child.id == selected.id;
});
if (exists) {
child.selected = true;
}
});
//check filter
performFiltering(args.children);
}
}
//gets the tree object when it loads
function treeLoadedHandler(args) {
tree = args.tree;
}
//wires up selection
function nodeSelectHandler(ev, args) {
args.event.preventDefault();
args.event.stopPropagation();
if (args.node.metaData.listViewNode) {
//check if list view 'search' node was selected
$scope.searchInfo.showSearch = true;
$scope.searchInfo.searchFromId = args.node.metaData.listViewNode.id;
$scope.searchInfo.searchFromName = args.node.metaData.listViewNode.name;
//add transition classes
var listViewNode = args.node.parent();
listViewNode.cssClasses.push('tree-node-slide-up-hide-active');
}
else if (args.node.metaData.isSearchResult) {
//check if the item selected was a search result from a list view
//unselect
select(args.node.name, args.node.id);
//remove it from the list view children
var listView = args.node.parent();
listView.children = _.reject(listView.children, function(child) {
return child.id == args.node.id;
});
//remove it from the custom tracked search result list
$scope.searchInfo.selectedSearchResults = _.reject($scope.searchInfo.selectedSearchResults, function (i) {
return i.id == args.node.id;
});
}
else {
eventsService.emit("dialogs.treePickerController.select", args);
if (args.node.filtered) {
return;
}
//This is a tree node, so we don't have an entity to pass in, it will need to be looked up
//from the server in this method.
select(args.node.name, args.node.id);
//toggle checked state
args.node.selected = args.node.selected === true ? false : true;
}
}
/** Method used for selecting a node */
function select(text, id, entity) {
//if we get the root, we just return a constructed entity, no need for server data
if (id < 0) {
if ($scope.multiPicker) {
$scope.select(id);
}
else {
var node = {
alias: null,
icon: "icon-folder",
id: id,
name: text
};
$scope.submit(node);
}
}
else {
if ($scope.multiPicker) {
$scope.select(Number(id));
}
else {
$scope.hideSearch();
//if an entity has been passed in, use it
if (entity) {
$scope.submit(entity);
} else {
//otherwise we have to get it from the server
entityResource.getById(id, entityType).then(function (ent) {
$scope.submit(ent);
});
}
}
}
}
function performFiltering(nodes) {
if (!dialogOptions.filter) {
return;
}
//remove any list view search nodes from being filtered since these are special nodes that always must
// be allowed to be clicked on
nodes = _.filter(nodes, function(n) {
return !angular.isObject(n.metaData.listViewNode);
});
if (dialogOptions.filterAdvanced) {
//filter either based on a method or an object
var filtered = angular.isFunction(dialogOptions.filter)
? _.filter(nodes, dialogOptions.filter)
: _.where(nodes, dialogOptions.filter);
angular.forEach(filtered, function (value, key) {
value.filtered = true;
if (dialogOptions.filterCssClass) {
if (!value.cssClasses) {
value.cssClasses = [];
}
value.cssClasses.push(dialogOptions.filterCssClass);
}
});
} else {
var a = dialogOptions.filter.toLowerCase().replace(/\s/g, '').split(',');
angular.forEach(nodes, function (value, key) {
var found = a.indexOf(value.metaData.contentType.toLowerCase()) >= 0;
if (!dialogOptions.filterExclude && !found || dialogOptions.filterExclude && found) {
value.filtered = true;
if (dialogOptions.filterCssClass) {
if (!value.cssClasses) {
value.cssClasses = [];
}
value.cssClasses.push(dialogOptions.filterCssClass);
}
}
});
}
}
$scope.multiSubmit = function (result) {
entityResource.getByIds(result, entityType).then(function (ents) {
$scope.submit(ents);
});
};
/** method to select a search result */
$scope.selectResult = function (evt, result) {
if (result.filtered) {
return;
}
result.selected = result.selected === true ? false : true;
//since result = an entity, we'll pass it in so we don't have to go back to the server
select(result.name, result.id, result);
//add/remove to our custom tracked list of selected search results
if (result.selected) {
$scope.searchInfo.selectedSearchResults.push(result);
}
else {
$scope.searchInfo.selectedSearchResults = _.reject($scope.searchInfo.selectedSearchResults, function(i) {
return i.id == result.id;
});
}
//ensure the tree node in the tree is checked/unchecked if it already exists there
if (tree) {
var found = treeService.getDescendantNode(tree.root, result.id);
if (found) {
found.selected = result.selected;
}
}
};
$scope.hideSearch = function () {
//Traverse the entire displayed tree and update each node to sync with the selected search results
if (tree) {
//we need to ensure that any currently displayed nodes that get selected
// from the search get updated to have a check box!
function checkChildren(children) {
_.each(children, function (child) {
//check if the id is in the selection, if so ensure it's flagged as selected
var exists = _.find($scope.searchInfo.selectedSearchResults, function (selected) {
return child.id == selected.id;
});
//if the curr node exists in selected search results, ensure it's checked
if (exists) {
child.selected = true;
}
//if the curr node does not exist in the selected search result, and the curr node is a child of a list view search result
else if (child.metaData.isSearchResult) {
//if this tree node is under a list view it means that the node was added
// to the tree dynamically under the list view that was searched, so we actually want to remove
// it all together from the tree
var listView = child.parent();
listView.children = _.reject(listView.children, function(c) {
return c.id == child.id;
});
}
//check if the current node is a list view and if so, check if there's any new results
// that need to be added as child nodes to it based on search results selected
if (child.metaData.isContainer) {
child.cssClasses = _.reject(child.cssClasses, function(c) {
return c === 'tree-node-slide-up-hide-active';
});
var listViewResults = _.filter($scope.searchInfo.selectedSearchResults, function (i) {
return i.parentId == child.id;
});
_.each(listViewResults, function (item) {
var childExists = _.find(child.children, function(c) {
return c.id == item.id;
});
if (!childExists) {
var parent = child;
child.children.unshift({
id: item.id,
name: item.name,
cssClass: "icon umb-tree-icon sprTree " + item.icon,
level: child.level + 1,
metaData: {
isSearchResult: true
},
hasChildren: false,
parent: function () {
return parent;
}
});
}
});
}
//recurse
if (child.children && child.children.length > 0) {
checkChildren(child.children);
}
});
}
checkChildren(tree.root.children);
}
$scope.searchInfo.showSearch = false;
$scope.searchInfo.searchFromId = dialogOptions.startNodeId;
$scope.searchInfo.searchFromName = null;
$scope.searchInfo.results = [];
}
$scope.onSearchResults = function(results) {
//filter all items - this will mark an item as filtered
performFiltering(results);
//now actually remove all filtered items so they are not even displayed
results = _.filter(results, function(item) {
return !item.filtered;
});
$scope.searchInfo.results = results;
//sync with the curr selected results
_.each($scope.searchInfo.results, function (result) {
var exists = _.find($scope.dialogData.selection, function (selectedId) {
return result.id == selectedId;
});
if (exists) {
result.selected = true;
}
});
$scope.searchInfo.showSearch = true;
};
$scope.onTreeInit = function () {
$scope.dialogTreeApi.callbacks.treeLoaded(treeLoadedHandler);
$scope.dialogTreeApi.callbacks.treeNodeExpanded(nodeExpandedHandler);
$scope.dialogTreeApi.callbacks.treeNodeSelect(nodeSelectHandler);
}
});

View File

@@ -1,61 +0,0 @@
<div class="umb-panel" ng-controller="Umbraco.Dialogs.TreePickerController">
<div class="umb-panel-header">
<div class="umb-el-wrap umb-panel-buttons">
<umb-tree-search-box hide-search-callback="hideSearch"
search-callback="onSearchResults"
search-from-id="{{searchInfo.searchFromId}}"
search-from-name="{{searchInfo.searchFromName}}"
show-search="{{searchInfo.showSearch}}"
section="{{section}}">
</umb-tree-search-box>
</div>
</div>
<div class="umb-panel-body with-footer">
<div class="tab-content umb-control-group">
<umb-tree-search-results
ng-if="searchInfo.showSearch"
results="searchInfo.results"
select-result-callback="selectResult">
</umb-tree-search-results>
<div ng-hide="searchInfo.showSearch" ng-animate="'tree-fade-out'">
<umb-tree section="{{section}}"
treealias="{{treeAlias}}"
hideheader="{{hideHeader}}"
hideoptions="true"
isdialog="true"
customtreeparams="{{customTreeParams}}"
api="dialogTreeApi"
on-init="onTreeInit()"
enablelistviewsearch="true"
enablecheckboxes="{{multiPicker}}">
</umb-tree>
</div>
</div>
</div>
<div class="umb-panel-footer">
<div class="umb-el-wrap umb-panel-buttons">
<div class="btn-toolbar umb-btn-toolbar pull-right">
<a href ng-click="close()" class="btn btn-link">
<localize key="general_cancel">Cancel</localize>
</a>
<button
class="btn btn-primary"
ng-if="dialogOptions.multiPicker"
ng-click="multiSubmit(dialogData.selection)">
<localize key="buttons_select">Select</localize>
({{dialogData.selection.length}})
</button>
</div>
</div>
</div>
</div>

View File

@@ -1,167 +0,0 @@
angular.module("umbraco")
.controller("Umbraco.Dialogs.UserController", function ($scope, $location, $timeout, userService, historyService, eventsService, externalLoginInfo, authResource, currentUserResource, formHelper) {
$scope.history = historyService.getCurrent();
$scope.version = Umbraco.Sys.ServerVariables.application.version + " assembly: " + Umbraco.Sys.ServerVariables.application.assemblyVersion;
$scope.showPasswordFields = false;
$scope.changePasswordButtonState = "init";
$scope.externalLoginProviders = externalLoginInfo.providers;
$scope.externalLinkLoginFormAction = Umbraco.Sys.ServerVariables.umbracoUrls.externalLinkLoginsUrl;
var evts = [];
evts.push(eventsService.on("historyService.add", function (e, args) {
$scope.history = args.all;
}));
evts.push(eventsService.on("historyService.remove", function (e, args) {
$scope.history = args.all;
}));
evts.push(eventsService.on("historyService.removeAll", function (e, args) {
$scope.history = [];
}));
$scope.logout = function () {
//Add event listener for when there are pending changes on an editor which means our route was not successful
var pendingChangeEvent = eventsService.on("valFormManager.pendingChanges", function (e, args) {
//one time listener, remove the event
pendingChangeEvent();
$scope.close();
});
//perform the path change, if it is successful then the promise will resolve otherwise it will fail
$scope.close();
$location.path("/logout");
};
$scope.gotoHistory = function (link) {
$location.path(link);
$scope.close();
};
//Manually update the remaining timeout seconds
function updateTimeout() {
$timeout(function () {
if ($scope.remainingAuthSeconds > 0) {
$scope.remainingAuthSeconds--;
$scope.$digest();
//recurse
updateTimeout();
}
}, 1000, false); // 1 second, do NOT execute a global digest
}
function updateUserInfo() {
//get the user
userService.getCurrentUser().then(function (user) {
$scope.user = user;
if ($scope.user) {
$scope.remainingAuthSeconds = $scope.user.remainingAuthSeconds;
$scope.canEditProfile = _.indexOf($scope.user.allowedSections, "users") > -1;
//set the timer
updateTimeout();
authResource.getCurrentUserLinkedLogins().then(function(logins) {
//reset all to be un-linked
for (var provider in $scope.externalLoginProviders) {
$scope.externalLoginProviders[provider].linkedProviderKey = undefined;
}
//set the linked logins
for (var login in logins) {
var found = _.find($scope.externalLoginProviders, function (i) {
return i.authType == login;
});
if (found) {
found.linkedProviderKey = logins[login];
}
}
});
}
});
}
$scope.unlink = function (e, loginProvider, providerKey) {
var result = confirm("Are you sure you want to unlink this account?");
if (!result) {
e.preventDefault();
return;
}
authResource.unlinkLogin(loginProvider, providerKey).then(function (a, b, c) {
updateUserInfo();
});
}
updateUserInfo();
//remove all event handlers
$scope.$on('$destroy', function () {
for (var e = 0; e < evts.length; e++) {
evts[e]();
}
});
/* ---------- UPDATE PASSWORD ---------- */
//create the initial model for change password property editor
$scope.changePasswordModel = {
alias: "_umb_password",
view: "changepassword",
config: {},
value: {}
};
//go get the config for the membership provider and add it to the model
authResource.getMembershipProviderConfig().then(function(data) {
$scope.changePasswordModel.config = data;
//ensure the hasPassword config option is set to true (the user of course has a password already assigned)
//this will ensure the oldPassword is shown so they can change it
// disable reset password functionality beacuse it does not make sense for the current user.
$scope.changePasswordModel.config.hasPassword = true;
$scope.changePasswordModel.config.disableToggle = true;
$scope.changePasswordModel.config.enableReset = false;
});
$scope.changePassword = function() {
if (formHelper.submitForm({ scope: $scope })) {
$scope.changePasswordButtonState = "busy";
currentUserResource.changePassword($scope.changePasswordModel.value).then(function(data) {
//if the password has been reset, then update our model
if (data.value) {
$scope.changePasswordModel.value.generatedPassword = data.value;
}
formHelper.resetForm({ scope: $scope, notifications: data.notifications });
$scope.changePasswordButtonState = "success";
}, function (err) {
formHelper.handleError(err);
$scope.changePasswordButtonState = "error";
});
}
};
$scope.togglePasswordFields = function() {
clearPasswordFields();
$scope.showPasswordFields = !$scope.showPasswordFields;
}
function clearPasswordFields() {
$scope.changePasswordModel.value.newPassword = "";
$scope.changePasswordModel.confirm = "";
}
});

View File

@@ -1,119 +0,0 @@
<div class="umb-panel umb-user-panel" ng-controller="Umbraco.Dialogs.UserController">
<div class="umb-panel-header">
<div class="umb-el-wrap umb-panel-buttons">
<div class="btn-toolbar umb-btn-toolbar">
<button ng-click="logout()" hotkey="ctrl+shift+l" class="btn btn-warning">
<localize key="general_logout">Log out</localize>
</button>
</div>
</div>
<h1 class="headline">{{user.name}}</h1>
<small class="umb-version">Umbraco version {{version}}</small>
<p class="muted">
<small>
<localize key="user_sessionExpires" />: {{remainingAuthSeconds | timespan}}
</small>
</p>
</div>
<div class="umb-panel-body umb-scrollable">
<div class="tab-content umb-control-group">
<div class="umb-pane" ng-if="!showPasswordFields">
<h5><localize key="user_yourProfile" /></h5>
<a href="#/users/users/user/{{user.id}}"
class="btn btn-primary"
ng-click="close()"
ng-if="canEditProfile">
<localize key="general_edit">Edit</localize>
</a>
<umb-button
type="button"
action="togglePasswordFields()"
label="Change password"
button-style="success">
</umb-button>
</div>
<div class="umb-pane external-logins" ng-if="externalLoginProviders.length > 0 && !showPasswordFields">
<h5><localize key="defaultdialogs_externalLoginProviders">External login providers</localize></h5>
<div ng-repeat="login in externalLoginProviders">
<form ng-if="login.linkedProviderKey == undefined" method="POST" name="externalLoginForm"
action="{{externalLinkLoginFormAction}}" id="oauthloginform" name="oauthloginform">
<input type="hidden" name="provider" value="{{login.authType}}" />
<button class="btn btn-block btn-social"
ng-class="login.properties.SocialStyle"
id="{{login.authType}}"
onclick="document.forms.oauthloginform.submit();">
<i class="fa" ng-class="login.properties.SocialIcon"></i>
<localize key="defaultdialogs_linkYour">Link your</localize> {{login.caption}} <localize key="defaultdialogs_account">account</localize>
</button>
</form>
<button ng-if="login.linkedProviderKey != undefined"
ng-click="unlink($event, login.authType, login.linkedProviderKey)"
class="btn btn-block btn-social"
ng-class="login.properties.SocialStyle"
id="{{login.authType}}"
name="provider"
value="{{login.authType}}">
<i class="fa" ng-class="login.properties.SocialIcon"></i>
<localize key="defaultdialogs_unLinkYour">Un-link your</localize> {{login.caption}} <localize key="defaultdialogs_account">account</localize>
</button>
</div>
</div>
<div class="umb-pane" ng-if="!showPasswordFields">
<h5><localize key="user_yourHistory" /></h5>
<ul class="umb-tree">
<li ng-repeat="item in history | orderBy:'time':true">
<a ng-href="{{item.link}}" ng-click="gotoHistory(item.link)" prevent-default>
<i class="{{item.icon}}"></i> {{item.name}}
</a>
</li>
</ul>
</div>
<div class="umb-pane" ng-show="showPasswordFields">
<h5>Change password</h5>
<form
name="passwordForm"
class="block-form"
ng-submit="changePassword()"
novalidate
val-form-manager>
<umb-editor model="changePasswordModel"></umb-editor>
<umb-button
type="button"
action="togglePasswordFields()"
label="Back"
button-style="Cancel">
</umb-button>
<umb-button
type="submit"
label="Change password"
state="changePasswordButtonState"
button-style="success">
</umb-button>
</form>
</div>
</div>
</div>

View File

@@ -1,97 +0,0 @@
angular.module("umbraco")
.controller("Umbraco.PropertyEditors.GoogleMapsController",
function ($element, $rootScope, $scope, notificationsService, dialogService, assetsService, $log, $timeout) {
assetsService.loadJs('https://www.google.com/jsapi', $scope)
.then(function () {
google.load("maps", "3",
{
callback: initMap,
other_params: "sensor=false"
});
});
function initMap() {
//Google maps is available and all components are ready to use.
var valueArray = $scope.model.value.split(',');
var latLng = new google.maps.LatLng(valueArray[0], valueArray[1]);
var mapDiv = document.getElementById($scope.model.alias + '_map');
var mapOptions = {
zoom: $scope.model.config.zoom,
center: latLng,
mapTypeId: google.maps.MapTypeId[$scope.model.config.mapType]
};
var geocoder = new google.maps.Geocoder();
var map = new google.maps.Map(mapDiv, mapOptions);
var marker = new google.maps.Marker({
map: map,
position: latLng,
draggable: true
});
google.maps.event.addListener(map, 'click', function (event) {
dialogService.mediaPicker({
callback: function (data) {
var image = data.selection[0].src;
var latLng = event.latLng;
var marker = new google.maps.Marker({
map: map,
icon: image,
position: latLng,
draggable: true
});
google.maps.event.addListener(marker, "dragend", function (e) {
var newLat = marker.getPosition().lat();
var newLng = marker.getPosition().lng();
codeLatLng(marker.getPosition(), geocoder);
//set the model value
$scope.model.vvalue = newLat + "," + newLng;
});
}
});
});
var tabShown = function(e) {
google.maps.event.trigger(map, 'resize');
};
//listen for tab changes
if (tabsCtrl != null) {
tabsCtrl.onTabShown(function (args) {
tabShown();
});
}
$element.closest('.umb-panel.tabbable').on('shown', '.nav-tabs a', tabShown);
$scope.$on('$destroy', function () {
$element.closest('.umb-panel.tabbable').off('shown', '.nav-tabs a', tabShown);
});
}
function codeLatLng(latLng, geocoder) {
geocoder.geocode({ 'latLng': latLng },
function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var location = results[0].formatted_address;
$rootScope.$apply(function () {
notificationsService.success("Peter just went to: ", location);
});
}
});
}
//here we declare a special method which will be called whenever the value has changed from the server
//this is instead of doing a watch on the model.value = faster
$scope.model.onValueChanged = function (newVal, oldVal) {
//update the display val again if it has changed from the server
initMap();
};
});

View File

@@ -1,3 +0,0 @@
<div ng-controller="Umbraco.PropertyEditors.GoogleMapsController" class="umb-editor umb-googlemaps">
<div class="" style="height: 400px;" id="{{model.alias}}_map"></div>
</div>

View File

@@ -1,27 +0,0 @@
//this controller simply tells the dialogs service to open a mediaPicker window
//with a specified callback, this callback will receive an object with a selection on it
angular.module('umbraco').controller("Umbraco.PropertyEditors.EmbeddedContentController",
function($rootScope, $scope, $log){
$scope.showForm = false;
$scope.fakeData = [];
$scope.create = function(){
$scope.showForm = true;
$scope.fakeData = angular.copy($scope.model.config.fields);
};
$scope.show = function(){
$scope.showCode = true;
};
$scope.add = function(){
$scope.showForm = false;
if ( !($scope.model.value instanceof Array)) {
$scope.model.value = [];
}
$scope.model.value.push(angular.copy($scope.fakeData));
$scope.fakeData = [];
};
});

View File

@@ -1,18 +0,0 @@
<div ng-controller="Umbraco.PropertyEditors.EmbeddedContentController">
<ul>
<li ng-repeat="item in model.value">
{{item[0].value}}...
</li>
</ul>
<div ng-show="showForm">
<umb-property ng-repeat="model in fakeData"></umb-property>
<button ng-click="add()">Save</button>
</div>
<button ng-click="create()">Add new</button><button ng-click="show()">Show json</button>
<div ng-show="showCode">
json: {{model.value|json}}
</div>
</div>