diff --git a/src/Umbraco.Web.UI.Client/src/_legacy/auth.resource.js b/src/Umbraco.Web.UI.Client/src/_legacy/auth.resource.js deleted file mode 100644 index 5a9e683317..0000000000 --- a/src/Umbraco.Web.UI.Client/src/_legacy/auth.resource.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @ngdoc service - * @name umbraco.resources.authResource - * @description Loads in data for authentication - **/ -function authResource($q, $http, umbDataFormatter, umbRequestHelper) { - - var mocked = { - name: "Per Ploug", - email: "test@test.com", - emailHash: "f9879d71855b5ff21e4963273a886bfc", - id: 0, - locale: 'da-DK' - }; - - return { - - /** Logs the user in if the credentials are good */ - performLogin: function (username, password) { - return mocked; - }, - - /** Sends a request to the server to check if the current cookie value is valid for the user */ - isAuthenticated: function () { - return mocked; - } - }; -} - -angular.module('umbraco.mocks.resources').factory('authResource', authResource); diff --git a/src/Umbraco.Web.UI.Client/src/_legacy/contenttype.resource.js b/src/Umbraco.Web.UI.Client/src/_legacy/contenttype.resource.js deleted file mode 100644 index 4d44d48f19..0000000000 --- a/src/Umbraco.Web.UI.Client/src/_legacy/contenttype.resource.js +++ /dev/null @@ -1,41 +0,0 @@ -angular.module('umbraco.mocks.resources') -.factory('contentTypeResource', function () { - return { - - //return a content type with a given ID - getContentType: function(id){ - - return { - name: "News Article", - alias: "newsArticle", - id: id, - tabs:[] - }; - - }, - //return all availabel types - all: function(){ - return []; - }, - - //return children inheriting a given type - children: function(id){ - return []; - }, - - //return all content types a type inherite from - parents: function(id){ - return []; - }, - - //return all types allowed under given document - getAllowedTypes: function(documentId){ - return [ - {name: "News Article", description: "Standard news article", alias: "newsArticle", id: 1234, cssClass:"file"}, - {name: "News Area", description: "Area to hold all news articles, there should be only one", alias: "newsArea", id: 1234, cssClass:"suitcase"}, - {name: "Employee", description: "Employee profile information page", alias: "employee", id: 1234, cssClass:"user"} - ]; - } - - }; -}); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/_legacy/directives/directives.js b/src/Umbraco.Web.UI.Client/src/_legacy/directives/directives.js deleted file mode 100644 index 9f020476f4..0000000000 --- a/src/Umbraco.Web.UI.Client/src/_legacy/directives/directives.js +++ /dev/null @@ -1,393 +0,0 @@ -angular.module('umbraco.directives', []) - - - -.directive('headline', function ($window) { - return function (scope, el, attrs) { - - var h1 = $("

").hide(); - el.parent().prepend(h1); - el.addClass("umb-headline-editor"); - - if (el.val() !== '') { - el.hide(); - h1.text(el.val()); - h1.show(); - } else { - el.focus(); - } - - el.on("blur", function () { - el.hide(); - h1.html(el.val()).show(); - }); - - h1.on("click", function () { - h1.hide(); - el.show().focus(); - }); - }; -}) - - -.directive('onKeyup', function () { - return function (scope, elm, attrs) { - elm.bind("keyup", function () { - - scope.$apply(attrs.onKeyup); - }); - }; -}) - -.directive('propertyEditor', function () { - return { - restrict: 'A', - template: '
', - //templateUrl: '/partials/template.html', - link: function (scope, iterStartElement, attr) { - - var property = scope.$eval(attr.propertyEditor); - var path = property.controller; - var editor = "views/propertyeditors/" + property.view.replace('.', '/') + "/editor.html"; - - if (path !== undefined && path !== "") { - path = "views/propertyeditors/" + path.replace('.', '/') + "/controller.js"; - require([path], function () { - scope.editorView = editor; - }); - } else { - scope.editorView = editor; - } - - - } - }; - }) - - -.directive('onKeyDown', function ($key) { - return { - link: function (scope, elm, attrs) { - $key('keydown', scope, elm, attrs); - } - }; -}) - - -.directive('onBlur', function () { - return function (scope, elm, attrs) { - elm.bind("blur", function () { - scope.$apply(attrs.onBlur); - }); - }; -}) - -.directive('onFocus', function () { - return function (scope, elm, attrs) { - elm.bind("focus", function () { - scope.$apply(attrs.onFocus); - }); - }; -}) - - -.directive('umbPanel', function(){ - return { - restrict: 'E', - replace: true, - transclude: 'true', - templateUrl: 'views/directives/umb-panel.html' - }; -}) - -.directive('umbHeader', function($parse, $timeout){ - return { - restrict: 'E', - replace: true, - transclude: 'true', - templateUrl: 'views/directives/umb-header.html', - //create a new isolated scope assigning a tabs property from the attribute 'tabs' - //which is bound to the parent scope property passed in - scope: { - tabs: "=" - }, - link: function (scope, iElement, iAttrs) { - - if (!iAttrs.tabs){ - throw "a 'tabs' attribute must be set for umbHeader which represents the collection of tabs"; - } - - var hasProcessed = false; - - //when the tabs change, we need to hack the planet a bit and force the first tab content to be active, - //unfortunately twitter bootstrap tabs is not playing perfectly with angular. - scope.$watch("tabs", function (newValue, oldValue) { - - //don't process if we cannot or have already done so - if (!newValue){return;} - if (hasProcessed || !newValue.length || newValue.length === 0){return;} - - //set the flag - hasProcessed = true; - - var $panes = $('div.tab-content'); - var activeTab = _.find(newValue, function (item) { - return item.active; - }); - //we need to do a timeout here so that the current sync operation can complete - // and update the UI, then this will fire and the UI elements will be available. - $timeout(function () { - $panes.find('.tab-pane').each(function (index) { - var $this = angular.element(this); - var _scope = $this.scope(); - if (_scope.id === activeTab.id) { - $this.addClass('active' + (iAttrs.fade ? ' in' : '')); - } - else { - $this.removeClass('active'); - } - - if (iAttrs.fade){ $this.addClass('fade'); } - - }); - }); - - }); - } - }; -}) - -.directive('umbTabView', function(){ - return { - restrict: 'E', - replace: true, - transclude: 'true', - templateUrl: 'views/directives/umb-tab-view.html' - }; -}) - -.directive('umbTab', function(){ - return { - restrict: 'E', - replace: true, - transclude: 'true', - - scope: { - title: '@', - id: '@' - }, - - templateUrl: 'views/directives/umb-tab.html' - }; -}) - - - -.directive('umbProperty', function(){ - return { - restrict: 'E', - replace: true, - transclude: 'true', - templateUrl: 'views/directives/umb-property.html', - link: function (scope, element, attrs) { - //let's make a requireJs call to try and retrieve the associated js - // for this view, only if its an absolute path, meaning its external to umbraco - if (scope.model.view && scope.model.view !== "" && scope.model.view.startsWith('/')) { - //get the js file which exists at ../Js/EditorName.js - var lastSlash = scope.model.view.lastIndexOf("/"); - var fullViewName = scope.model.view.substring(lastSlash + 1, scope.model.view.length); - var viewName = fullViewName.indexOf(".") > 0 ? fullViewName.substring(0, fullViewName.indexOf(".")) : fullViewName; - var jsPath = scope.model.view.substring(0, lastSlash + 1) + "../Js/" + viewName + ".js"; - require([jsPath], - function () { - //the script loaded so load the view - //NOTE: The use of $apply because we're operating outside of the angular scope with this callback. - scope.$apply(function () { - scope.model.editorView = scope.model.view; - }); - }, function (err) { - //an error occurred... most likely there is no JS file to load for this editor - //NOTE: The use of $apply because we're operating outside of the angular scope with this callback. - scope.$apply(function () { - scope.model.editorView = scope.model.view; - }); - }); - } - else { - scope.model.editorView = scope.model.view; - } - } - }; - -}) - - -.directive('umbTree', function ($compile, $log, treeService) { - $log.log("Adding umb-tree directive"); - - return { - restrict: 'E', - replace: true, - terminal: false, - - scope: { - section: '@', - showoptions: '@', - showheader: '@', - cachekey: '@' - }, - - compile: function (element, attrs) { - //config - var hideheader = (attrs.showheader === 'false') ? true : false; - var hideoptions = (attrs.showoptions === 'false') ? "hide-options" : ""; - - var template = ''; - - var newElem = $(template); - element.replaceWith(template); - - return function (scope, element, attrs, controller) { - function loadTree(){ - if(scope.section){ - scope.tree = treeService.getTree({section:scope.section, cachekey: scope.cachekey}); - } - } - - if(scope.node === undefined){ - scope.$watch("section",function (newVal, oldVal) { - if(!newVal){ - scope.tree = undefined; - scope.node = undefined; - }else if(newVal !== oldVal){ - loadTree(); - } - }); - } - loadTree(); - }; - } - }; - }) - -.directive('umbTreeItem', function($compile, $http, $templateCache, $interpolate, $log, treeService) { - return { - restrict: 'E', - replace: true, - - scope: { - section: '@', - cachekey: '@', - node:'=' - }, - - template: '
  • ' + - '' + - '' + - '{{node.name}}' + - '' + - '
    '+ - '
  • ', - - link: function (scope, element, attrs) { - $log.log("render item"); - - scope.options = function(e, n, ev){ - scope.$emit("treeOptionsClick", {element: e, node: n, event: ev}); - }; - - scope.select = function(e,n,ev){ - scope.$emit("treeNodeSelect", {element: e, node: n, event: ev}); - }; - - scope.load = function (node) { - if (node.expanded){ - node.expanded = false; - node.children = []; - }else { - node.children = treeService.getChildren({node: node, section: scope.section}); - node.expanded = true; - } - }; - - scope.setTreePadding = function(node) { - return { 'padding-left': (node.level * 20) + "px" }; - }; - - var template = ''; - var newElement = angular.element(template); - $compile(newElement)(scope); - element.append(newElement); - } - }; -}); - -/*** not sure why we need this, we already have ng-include which should suffice ? unless its so we can load in the error ? - The other problem with this directive is that it runs too early. If we change the ng-include on umb-property to use - this directive instead, it the template will be empty because the actual umbProperty directive hasn't executed - yet, this seems to execute before it. - - - -.directive('include', function($compile, $http, $templateCache, $interpolate, $log) { - - $log.log("loading view"); - - // Load a template, possibly from the $templateCache, and instantiate a DOM element from it - function loadTemplate(template) { - return $http.get(template, {cache:$templateCache}).then(function(response) { - return angular.element(response.data); - }, function(response) { - throw new Error('Template not found: ' + template); - }); - } - - return { - restrict:'E', - priority: 100, // We need this directive to happen before ng-model - terminal: false, // We are going to deal with this element - compile: function(element, attrs) { - // Extract the label and validation message info from the directive's original element - //var validationMessages = getValidationMessageMap(element); - //var labelContent = getLabelContent(element); - - // Clear the directive's original element now that we have extracted what we need from it - element.html(''); - - return function postLink(scope, element, attrs) { - - var path = scope.$eval(attrs.template); - - // Load up the template for this kind of field, default to the simple input if none given - loadTemplate(path || 'error.html').then(function(templateElement) { - // Set up the scope - the template will have its own scope, which is a child of the directive's scope - var childScope = scope.$new(); - - // Place our template as a child of the original element. - // This needs to be done before compilation to ensure that it picks up any containing form. - element.append(templateElement); - - // We now compile and link our template here in the postLink function - // This allows the ng-model directive on our template's element to access the ngFormController - $compile(templateElement)(childScope); - - // Now that our template has been compiled and linked we can access the element's ngModelController - //childScope.$field = inputElement.controller('ngModel'); - }); - }; - } - }; -}); -*/ \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/_legacy/localization.resource.js b/src/Umbraco.Web.UI.Client/src/_legacy/localization.resource.js deleted file mode 100644 index 6106258abb..0000000000 --- a/src/Umbraco.Web.UI.Client/src/_legacy/localization.resource.js +++ /dev/null @@ -1,39 +0,0 @@ -angular.module('umbraco.mocks.resources') -.factory('localizationResource', function () { - var localizationArray = []; - var labels = {}; - - var factory = { - _cachedItems: localizationArray, - getLabels: function (language) { - /* - Fetch from JSON object according to users language settings - $http.get('model.:language.json') ish solution - */ - labels = { - language: 'en-UK', - app: { - search: { - typeToSearch: "Type to search", - searchResult: "Search result" - }, - help: "Help" - }, - content: { - modelName: "Content", - contextMenu: { - createPageLabel: "Create a page under %name" - } - } - }; - - - - return labels; - }, - getLanguage: function() { - return labels.language; - } - }; - return factory; -}); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/_legacy/media.resource.js b/src/Umbraco.Web.UI.Client/src/_legacy/media.resource.js deleted file mode 100644 index 118af743f9..0000000000 --- a/src/Umbraco.Web.UI.Client/src/_legacy/media.resource.js +++ /dev/null @@ -1,18 +0,0 @@ -angular.module('umbraco.mocks.resources') -.factory('mediaResource', function ($q) { - var mediaArray = []; - return { - rootMedia: function(){ - - var deferred = $q.defer(); - deferred.resolve( - [ - {id: 1234, src: "/Media/boston.jpg", thumbnail: "/Media/boston.jpg" }, - {src: "/Media/bird.jpg", thumbnail: "/Media/bird.jpg" }, - {src: "/Media/frog.jpg", thumbnail: "/Media/frog.jpg" } - ]); - - return deferred.promise; - } - }; -}); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/_legacy/tags.resource.js b/src/Umbraco.Web.UI.Client/src/_legacy/tags.resource.js deleted file mode 100644 index 8a271fa0fb..0000000000 --- a/src/Umbraco.Web.UI.Client/src/_legacy/tags.resource.js +++ /dev/null @@ -1,14 +0,0 @@ -angular.module('umbraco.mocks.resources') -.factory('tagsResource', function () { - return { - getTags: function (group) { - var g = [ - {"id":1, "label":"Jordbærkage"}, - {"id":2, "label":"Banankage"}, - {"id":3, "label":"Kiwikage"}, - {"id":4, "label":"Rabarbertærte"} - ]; - return g; - } - }; -}); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/_legacy/tree.resource.js b/src/Umbraco.Web.UI.Client/src/_legacy/tree.resource.js deleted file mode 100644 index 2adaacec74..0000000000 --- a/src/Umbraco.Web.UI.Client/src/_legacy/tree.resource.js +++ /dev/null @@ -1,97 +0,0 @@ -/** -* @ngdoc service -* @name umbraco.resources.treeResource -* @description Loads in data for trees -**/ - function _getChildren(options){ - if(options === undefined){ - options = {}; - } - var section = options.section || 'content'; - var treeItem = options.node; - - var iLevel = treeItem.level + 1; - - //hack to have create as default content action - var action; - if(section === "content"){ - action = "create"; - } - - return [ - { name: "child-of-" + treeItem.name, id: iLevel + "" + 1234, icon: "icon-file-alt", view: section + "/edit/" + iLevel + "" + 1234, children: [], expanded: false, hasChildren: true, level: iLevel, defaultAction: action, menu: getMenuItems() }, - { name: "random-name-" + section, id: iLevel + "" + 1235, icon: "icon-file-alt", view: section + "/edit/" + iLevel + "" + 1235, children: [], expanded: false, hasChildren: true, level: iLevel, defaultAction: action, menu: getMenuItems() }, - { name: "random-name-" + section, id: iLevel + "" + 1236, icon: "icon-file-alt", view: section + "/edit/" + iLevel + "" + 1236, children: [], expanded: false, hasChildren: true, level: iLevel, defaultAction: action, menu: getMenuItems() }, - { name: "random-name-" + section, id: iLevel + "" + 1237, icon: "icon-file-alt", view: "common/legacy/1237?p=" + encodeURI("developer/contentType.aspx?idequal1234"), children: [], expanded: false, hasChildren: true, level: iLevel, defaultAction: action, menu: getMenuItems() } - ]; - } - - function _getMenuItems() { - return [ - { name: "Create", cssclass: "plus", alias: "create" }, - - { seperator: true, name: "Delete", cssclass: "remove", alias: "delete" }, - { name: "Move", cssclass: "move", alias: "move" }, - { name: "Copy", cssclass: "copy", alias: "copy" }, - { name: "Sort", cssclass: "sort", alias: "sort" }, - - { seperator: true, name: "Publish", cssclass: "globe", alias: "publish" }, - { name: "Rollback", cssclass: "undo", alias: "rollback" }, - - { seperator: true, name: "Permissions", cssclass: "lock", alias: "permissions" }, - { name: "Audit Trail", cssclass: "time", alias: "audittrail" }, - { name: "Notifications", cssclass: "envelope", alias: "notifications" }, - - { seperator: true, name: "Hostnames", cssclass: "home", alias: "hostnames" }, - { name: "Public Access", cssclass: "group", alias: "publicaccess" }, - - { seperator: true, name: "Reload", cssclass: "refresh", alias: "users" } - ]; - } - - var treeArray = []; - function _getApplication(section){ - - var t; - switch(section){ - - case "content": - t = [ - { name: "My website", id: 1234, icon: "icon-home", view: section + "/edit/" + 1234, children: [], expanded: false, hasChildren: true, level: 1, defaultAction: "create", menu: getMenuItems() }, - { name: "Components", id: 1235, icon: "icon-cogs", view: section + "/edit/" + 1235, children: [], expanded: false, hasChildren: true, level: 1, defaultAction: "create", menu: getMenuItems() }, - { name: "Archieve", id: 1236, icon: "icon-folder-close", view: section + "/edit/" + 1236, children: [], expanded: false, hasChildren: true, level: 1, defaultAction: "create", menu: getMenuItems() }, - { name: "Recycle Bin", id: 1237, icon: "icon-trash", view: section + "/trash/view/", children: [], expanded: false, hasChildren: true, level: 1, defaultAction: "create", menu: getMenuItems() } - ]; - break; - - case "developer": - t = [ - { name: "Data types", id: 1234, icon: "icon-folder-close", view: section + "/edit/" + 1234, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() }, - { name: "Macros", id: 1235, icon: "icon-folder-close", view: section + "/edit/" + 1235, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() }, - { name: "Pacakges", id: 1236, icon: "icon-folder-close", view: section + "/edit/" + 1236, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() }, - { name: "XSLT Files", id: 1237, icon: "icon-folder-close", view: section + "/edit/" + 1237, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() }, - { name: "Razor Files", id: 1237, icon: "icon-folder-close", view: section + "/edit/" + 1237, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() } - ]; - break; - case "settings": - t = [ - { name: "Stylesheets", id: 1234, icon: "icon-folder-close", view: section + "/edit/" + 1234, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() }, - { name: "Templates", id: 1235, icon: "icon-folder-close", view: section + "/edit/" + 1235, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() }, - { name: "Dictionary", id: 1236, icon: "icon-folder-close", view: section + "/edit/" + 1236, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() }, - { name: "Media types", id: 1237, icon: "icon-folder-close", view: section + "/edit/" + 1237, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() }, - { name: "Document types", id: 1237, icon: "icon-folder-close", view: section + "/edit/" + 1237, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() } - ]; - break; - default: - t = [ - { name: "random-name-" + section, id: 1234, icon: "icon-home", defaultAction: "create", view: section + "/edit/" + 1234, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() }, - { name: "random-name-" + section, id: 1235, icon: "icon-folder-close", defaultAction: "create", view: section + "/edit/" + 1235, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() }, - { name: "random-name-" + section, id: 1236, icon: "icon-folder-close", defaultAction: "create", view: section + "/edit/" + 1236, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() }, - { name: "random-name-" + section, id: 1237, icon: "icon-folder-close", defaultAction: "create", view: section + "/edit/" + 1237, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() } - ]; - break; - } - - //treeArray[cacheKey] = t; - return t; - } \ No newline at end of file