├── src ├── Gibe.LinkPicker.Umbraco │ ├── Gibe.LinkPicker.Umbraco.nuspec │ ├── .editorconfig │ ├── App_Plugins │ │ └── GibeLinkPicker │ │ │ ├── Lang │ │ │ ├── en-GB.xml │ │ │ ├── en-US.xml │ │ │ └── da-DK.xml │ │ │ ├── package.manifest │ │ │ ├── picker.css │ │ │ ├── picker.html │ │ │ ├── picker.controller.js │ │ │ └── Dialogs │ │ │ ├── linkpicker.html │ │ │ └── linkpicker.controller.js │ ├── Models │ │ └── LinkPicker.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── PropertyConverters │ │ └── LinkPickerValueConverter.cs │ ├── app.config │ ├── packages.config │ └── Gibe.LinkPicker.Umbraco.csproj └── Gibe.LinkPicker.Umbraco.sln ├── README.md.res ├── Step-1.jpg ├── Step-2.jpg ├── Step-4.jpg ├── Step-3a.jpg └── Step-3b.jpg ├── appveyor.yml ├── README.md └── .gitignore /src/Gibe.LinkPicker.Umbraco/Gibe.LinkPicker.Umbraco.nuspec: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /README.md.res/Step-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gibe/Umbraco-Link-Picker/HEAD/README.md.res/Step-1.jpg -------------------------------------------------------------------------------- /README.md.res/Step-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gibe/Umbraco-Link-Picker/HEAD/README.md.res/Step-2.jpg -------------------------------------------------------------------------------- /README.md.res/Step-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gibe/Umbraco-Link-Picker/HEAD/README.md.res/Step-4.jpg -------------------------------------------------------------------------------- /README.md.res/Step-3a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gibe/Umbraco-Link-Picker/HEAD/README.md.res/Step-3a.jpg -------------------------------------------------------------------------------- /README.md.res/Step-3b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gibe/Umbraco-Link-Picker/HEAD/README.md.res/Step-3b.jpg -------------------------------------------------------------------------------- /src/Gibe.LinkPicker.Umbraco/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.{cs,xml,scss,js,json,feature,sql,nuspec}] 4 | indent_style = tab -------------------------------------------------------------------------------- /src/Gibe.LinkPicker.Umbraco/App_Plugins/GibeLinkPicker/Lang/en-GB.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Enter a hash target 5 | Hash target 6 | Enter a class name 7 | Class name 8 | 9 | -------------------------------------------------------------------------------- /src/Gibe.LinkPicker.Umbraco/App_Plugins/GibeLinkPicker/Lang/en-US.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Enter a hash target 5 | Hash target 6 | Enter a class name 7 | Class name 8 | 9 | -------------------------------------------------------------------------------- /src/Gibe.LinkPicker.Umbraco/App_Plugins/GibeLinkPicker/Lang/da-DK.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Indtast et hash target 5 | Hash target 6 | Indtast et class name 7 | Class name 8 | 9 | -------------------------------------------------------------------------------- /src/Gibe.LinkPicker.Umbraco/Models/LinkPicker.cs: -------------------------------------------------------------------------------- 1 | using Umbraco.Core; 2 | 3 | namespace Gibe.LinkPicker.Umbraco.Models 4 | { 5 | public class LinkPicker 6 | { 7 | public int Id { get; set; } 8 | public string Udi { get; set; } 9 | public string Name { get; set; } 10 | public string Url { get; set; } 11 | public string Target { get; set; } 12 | public string Hashtarget { get; set; } 13 | public string Classname { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Gibe.LinkPicker.Umbraco/App_Plugins/GibeLinkPicker/package.manifest: -------------------------------------------------------------------------------- 1 | { 2 | propertyEditors: [ 3 | { 4 | alias: "Gibe.LinkPicker", 5 | name: "Link Picker", 6 | icon: "icon-link", 7 | group: "Pickers", 8 | editor: { 9 | view: "~/App_Plugins/GibeLinkPicker/picker.html", 10 | hideLabel: false, 11 | valueType: "JSON" 12 | } 13 | } 14 | ], 15 | javascript: [ 16 | "~/App_Plugins/GibeLinkPicker/picker.controller.js", 17 | "~/App_Plugins/GibeLinkPicker/Dialogs/linkpicker.controller.js", 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | image: Visual Studio 2017 2 | 3 | # version format 4 | version: 1.6.0.{build} 5 | 6 | cache: 7 | - src\packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified 8 | 9 | build_script: 10 | - build\build-appveyor.cmd 11 | 12 | artifacts: 13 | - path: artifacts\*.nupkg 14 | - path: artifacts\*.zip 15 | 16 | deploy: 17 | # NuGet Deployment for releases 18 | - provider: NuGet 19 | server: 20 | api_key: 21 | secure: mN9RxEEmhXOrt4qdqQbPAZO6bB21be8kBr9Q9e5nSRkPp1DJCRy/hcfCz/o0WQRk 22 | artifact: /.*\.nupkg/ 23 | on: 24 | appveyor_repo_tag: true -------------------------------------------------------------------------------- /src/Gibe.LinkPicker.Umbraco/App_Plugins/GibeLinkPicker/picker.css: -------------------------------------------------------------------------------- 1 | .gibe-link-picker 2 | { 3 | margin: 0; 4 | padding: 0; 5 | } 6 | 7 | .gibe-link-picker .internal-picker 8 | { 9 | margin: 0; 10 | padding: 0; 11 | } 12 | 13 | .gibe-link-picker .toggle 14 | { 15 | margin: 0; 16 | padding: 0; 17 | } 18 | 19 | .gibe-link-picker .new-window 20 | { 21 | margin: 0; 22 | padding: 10px 0 0 0; 23 | } 24 | 25 | .gibe-link-picker .new-window label 26 | { 27 | margin: 0; 28 | padding: 0; 29 | } 30 | 31 | .gibe-link-picker .form-row 32 | { 33 | margin: 0; 34 | padding: 0 0 5px 0; 35 | } 36 | 37 | .gibe-link-picker .form-row .umb-editor 38 | { 39 | min-width: 300px; 40 | } 41 | 42 | .gibe-link-picker .umb-node-preview 43 | { 44 | border-bottom: none 45 | } -------------------------------------------------------------------------------- /src/Gibe.LinkPicker.Umbraco/App_Plugins/GibeLinkPicker/picker.html: -------------------------------------------------------------------------------- 1 |
2 | 18 |
-------------------------------------------------------------------------------- /src/Gibe.LinkPicker.Umbraco.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27004.2005 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gibe.LinkPicker.Umbraco", "Gibe.LinkPicker.Umbraco\Gibe.LinkPicker.Umbraco.csproj", "{99D4F99D-7CB5-42F0-AD82-74B1AB947A2B}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C21355C2-F8A6-48E0-AB21-3C23B138EAD3}" 9 | ProjectSection(SolutionItems) = preProject 10 | ..\README.md = ..\README.md 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {99D4F99D-7CB5-42F0-AD82-74B1AB947A2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {99D4F99D-7CB5-42F0-AD82-74B1AB947A2B}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {99D4F99D-7CB5-42F0-AD82-74B1AB947A2B}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {99D4F99D-7CB5-42F0-AD82-74B1AB947A2B}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | GlobalSection(ExtensibilityGlobals) = postSolution 28 | SolutionGuid = {632CD188-2EDD-4642-A2C5-0AB30C2F8363} 29 | EndGlobalSection 30 | EndGlobal 31 | -------------------------------------------------------------------------------- /src/Gibe.LinkPicker.Umbraco/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Gibe.LinkPicker.Umbraco")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Gibe.LinkPicker.Umbraco")] 13 | [assembly: AssemblyCopyright("Copyright © Gibe Digital 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("99d4f99d-7cb5-42f0-ad82-74b1ab947a2b")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/Gibe.LinkPicker.Umbraco/App_Plugins/GibeLinkPicker/picker.controller.js: -------------------------------------------------------------------------------- 1 | angular.module("umbraco").controller("Gibe.LinkPickerController", function ($scope, assetsService) { 2 | 3 | var ngi = angular.element('body').injector(); 4 | var uDialogService = ngi.get('dialogService'); 5 | 6 | // choose internal link 7 | $scope.chooseLink = function () { 8 | $scope.model.value = null; 9 | uDialogService.open({ 10 | template: '../App_Plugins/GibeLinkPicker/Dialogs/linkpicker.html', 11 | show: true, 12 | dialogData: $scope.model.config, 13 | callback: function (e) { 14 | // set model 15 | $scope.model.value = { 16 | id: e.id || 0, 17 | udi: e.udi || '', 18 | name: e.name || '', 19 | icon: e.icon, 20 | url: e.url, 21 | target: e.target || '_self', 22 | hashtarget: e.hashtarget || '', 23 | classname: e.classname || '' 24 | }; 25 | // close dialog 26 | uDialogService.close(); 27 | } 28 | }); 29 | }; 30 | 31 | $scope.editLink = function () { 32 | var linkPickerModel = angular.copy($scope.model); 33 | uDialogService.open({ 34 | template: '../App_Plugins/GibeLinkPicker/Dialogs/linkpicker.html', 35 | show: true, 36 | dialogData: linkPickerModel.config, 37 | target: linkPickerModel.value, 38 | callback: function (e) { 39 | // set model 40 | $scope.model.value = { 41 | id: e.id || 0, 42 | udi: e.udi || '', 43 | name: e.name || '', 44 | icon: e.icon, 45 | url: e.url, 46 | target: e.target || '_self', 47 | hashtarget: e.hashtarget || '', 48 | classname: e.classname || '' 49 | }; 50 | // close dialog 51 | uDialogService.close(); 52 | } 53 | }); 54 | }; 55 | 56 | // remove link 57 | $scope.removeLink = function () { 58 | $scope.model.value = null; 59 | }; 60 | 61 | assetsService.loadCss("../App_Plugins/GibeLinkPicker/picker.css"); 62 | }); -------------------------------------------------------------------------------- /src/Gibe.LinkPicker.Umbraco/PropertyConverters/LinkPickerValueConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Umbraco.Core.PropertyEditors; 3 | using Umbraco.Core.Models.PublishedContent; 4 | using Umbraco.Web; 5 | using Newtonsoft.Json; 6 | using Umbraco.Core; 7 | using Umbraco.Core.Logging; 8 | 9 | namespace Gibe.LinkPicker.Umbraco.PropertyConverters 10 | { 11 | [PropertyValueType(typeof(Models.LinkPicker))] 12 | [PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)] 13 | public class LinkPickerValueConverter : PropertyValueConverterBase 14 | { 15 | /// 16 | /// Method to see if the current property type is of type 17 | /// LinkPicker editor. 18 | /// 19 | /// The current property type. 20 | /// True if the current property type of type LinkPicker editor. 21 | public override bool IsConverter(PublishedPropertyType propertyType) 22 | { 23 | return propertyType.PropertyEditorAlias.Equals("Gibe.LinkPicker"); 24 | } 25 | 26 | /// 27 | /// Method to convert a property value to an instance of the LinkPicker class. 28 | /// 29 | /// The current published property 30 | /// type to convert. 31 | /// The original property data. 32 | /// True if in preview mode. 33 | /// An instance of the LinkPicker class. 34 | public override object ConvertSourceToObject(PublishedPropertyType propertyType, object source, bool preview) 35 | { 36 | if (source == null) 37 | return null; 38 | 39 | if (UmbracoContext.Current == null) 40 | return null; 41 | 42 | var sourceString = source.ToString(); 43 | var umbracoHelper = new UmbracoHelper(UmbracoContext.Current); 44 | 45 | try 46 | { 47 | var linkPicker = JsonConvert.DeserializeObject(sourceString); 48 | 49 | if(linkPicker.Id > 0 || !string.IsNullOrWhiteSpace(linkPicker.Udi)) 50 | { 51 | var content = 52 | linkPicker.Udi != null 53 | ? umbracoHelper.TypedContent(Udi.Parse(linkPicker.Udi)) 54 | : umbracoHelper.TypedContent(linkPicker.Id); 55 | 56 | linkPicker.Url = content?.Url ?? linkPicker.Url; 57 | } 58 | 59 | return linkPicker; 60 | } 61 | catch (Exception ex) 62 | { 63 | LogHelper.Error(ex.Message, ex); 64 | 65 | return null; 66 | } 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/Gibe.LinkPicker.Umbraco/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/Gibe.LinkPicker.Umbraco/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/Gibe.LinkPicker.Umbraco/App_Plugins/GibeLinkPicker/Dialogs/linkpicker.html: -------------------------------------------------------------------------------- 1 |
2 | 72 | 73 | 90 |
-------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build status](https://ci.appveyor.com/api/projects/status/inglha3jbuojwsmt/branch/master?svg=true)](https://ci.appveyor.com/project/karltynan/umbraco-link-picker) 2 | 3 |

Umbraco Link Picker

4 | 5 | A simple internal or external link picker property editor for **Umbraco 7.x** 6 | 7 |

Quick links

8 | 9 | 17 | 18 |

About the package

19 | 20 | This package is for **Umbraco 7.x** 21 | 22 |

Features

23 | 27 | 28 |

Installation

29 | 30 |

Download

31 | 32 | Download and install the package from our.umbraco.org: our.umbraco.org/projects/backoffice-extensions/link-picker 33 | 34 |

NuGet

35 | 36 |
PM > Install-Package UmbracoLinkPicker
37 | 38 | Create a new DataType in the Developer tab in your Umbraco project, referencing "Link Picker" (alias: "Gibe.LinkPicker"). Add the new DataType to your Document Types to use the Link Picker 39 | 40 |

Usage

41 | 42 | The Link Picker returns JSON like the following example: 43 | 44 |
 45 | {
 46 | 	id: 1039,
 47 | 	udi: "umb://document/4fed18d8c5e34d5e88cfff3a5b457bf2"
 48 | 	name: "Node Name",
 49 | 	url: "/node-url",
 50 | 	target: "_blank",
 51 | 	hashtarget: "",
 52 | 	classname: ""
 53 | }
 54 | 
55 | 56 | The url can be used for external URLs and id can be used to get the URL of internal nodes in Umbraco (as URLs can change in Umbraco if the name changes). 57 | 58 | If you are using dynamic, you can access the JSON data like this: 59 | 60 |
 61 | // return an external URL
 62 | @CurrentPage.propertyName.url
 63 | 
 64 | // return an internal URL
 65 | @Umbraco.Content(CurrentPage.propertyName.id).Url
 66 | 
67 | 68 | If you want to use strongly-typed: 69 | 70 |
 71 | // Strongly typed
 72 | LinkPicker link = Model.Content.GetPropertyValue("link");
 73 | 
 74 | // ModelsBuilder
 75 | var site = Model.Content.Site().OfType();
 76 | var link = site.Link;
 77 | 
 78 | // From LeBlender grid editor
 79 | LinkPicker link = Model.Items.First().GetValue("link");
 80 | 
81 | 82 |

Screenshots

83 | 84 | **Step 1:** Click the "Choose" link 85 | 86 | ![Screenshot 1](README.md.res/Step-1.jpg) 87 | 88 | **Step 2:** In the Umbraco side menu, choose either an internal or external link 89 | 90 | ![Screenshot 2](README.md.res/Step-2.jpg) 91 | 92 | **Step 3a:** Set the options for external links (URL, title, etc.) 93 | 94 | ![Screenshot 3a](README.md.res/Step-3a.jpg) 95 | 96 | **Step 3b:** Or, set the options for internal links 97 | 98 | ![Screenshot 3b](README.md.res/Step-3b.jpg) 99 | 100 | **Step 4:** View or remove the link 101 | 102 | ![Screenshot 4](README.md.res/Step-4.jpg) 103 | 104 |

License

105 | 106 | The Umbraco Link Picker is created by Karl Tynan for Gibe Digital under the MIT License: [opensource.org/licenses/MIT](http://opensource.org/licenses/MIT) 107 | 108 |

Get involved!

109 | 110 | This project is open for collaboration, so please help improve this project. 111 | -------------------------------------------------------------------------------- /src/Gibe.LinkPicker.Umbraco/App_Plugins/GibeLinkPicker/Dialogs/linkpicker.controller.js: -------------------------------------------------------------------------------- 1 | //used for the media picker dialog 2 | angular.module("umbraco").controller("Gibe.Dialogs.LinkPickerController", 3 | function ($scope, eventsService, dialogService, entityResource, contentResource, mediaHelper, userService, localizationService) { 4 | var dialogOptions = $scope.dialogOptions; 5 | 6 | var searchText = "Search..."; 7 | localizationService.localize("general_search").then(function (value) { 8 | searchText = value + "..."; 9 | }); 10 | 11 | if (dialogOptions.target != null) { 12 | $scope.target = dialogOptions.target; 13 | } else { 14 | $scope.target = {}; 15 | } 16 | 17 | $scope.dialogTreeEventHandler = $({}); 18 | //$scope.target = {}; 19 | $scope.searchInfo = { 20 | searchFromId: null, 21 | searchFromName: null, 22 | showSearch: false, 23 | results: [], 24 | selectedSearchResults: [] 25 | } 26 | 27 | if (dialogOptions.currentTarget) { 28 | $scope.target = dialogOptions.currentTarget; 29 | 30 | //if we have a node ID, we fetch the current node to build the form data 31 | if ($scope.target.id || $scope.target.udi) { 32 | 33 | //will be either a udi or an int 34 | var id = $scope.target.udi ? $scope.target.udi : $scope.target.id; 35 | 36 | if (!$scope.target.path) { 37 | entityResource.getPath(id, "Document").then(function (path) { 38 | $scope.target.path = path; 39 | //now sync the tree to this path 40 | $scope.dialogTreeEventHandler.syncTree({ path: $scope.target.path, tree: "content" }); 41 | }); 42 | } 43 | 44 | contentResource.getNiceUrl(id).then(function (url) { 45 | $scope.target.url = url; 46 | }); 47 | } 48 | } 49 | 50 | function nodeSelectHandler(ev, args) { 51 | args.event.preventDefault(); 52 | args.event.stopPropagation(); 53 | 54 | if (args.node.metaData.listViewNode) { 55 | //check if list view 'search' node was selected 56 | 57 | $scope.searchInfo.showSearch = true; 58 | $scope.searchInfo.searchFromId = args.node.metaData.listViewNode.id; 59 | $scope.searchInfo.searchFromName = args.node.metaData.listViewNode.name; 60 | } 61 | else { 62 | eventsService.emit("dialogs.linkPicker.select", args); 63 | 64 | if ($scope.currentNode) { 65 | //un-select if there's a current one selected 66 | $scope.currentNode.selected = false; 67 | } 68 | console.log(args.node); 69 | 70 | $scope.currentNode = args.node; 71 | $scope.currentNode.selected = true; 72 | $scope.target.id = args.node.id; 73 | $scope.target.udi = args.node.udi; 74 | $scope.target.name = args.node.name; 75 | $scope.target.icon = args.node.icon; 76 | 77 | if (args.node.id < 0) { 78 | $scope.target.url = "/"; 79 | } 80 | else { 81 | contentResource.getNiceUrl(args.node.id).then(function (url) { 82 | $scope.target.url = url; 83 | }); 84 | } 85 | 86 | if (!angular.isUndefined($scope.target.isMedia)) { 87 | delete $scope.target.isMedia; 88 | } 89 | } 90 | } 91 | 92 | function nodeExpandedHandler(ev, args) { 93 | if (angular.isArray(args.children)) { 94 | 95 | //iterate children 96 | _.each(args.children, function (child) { 97 | //check if any of the items are list views, if so we need to add a custom 98 | // child: A node to activate the search 99 | if (child.metaData.isContainer) { 100 | child.hasChildren = true; 101 | child.children = [ 102 | { 103 | level: child.level + 1, 104 | hasChildren: false, 105 | name: searchText, 106 | metaData: { 107 | listViewNode: child, 108 | }, 109 | cssClass: "icon umb-tree-icon sprTree icon-search", 110 | cssClasses: ["not-published"] 111 | } 112 | ]; 113 | } 114 | }); 115 | } 116 | } 117 | 118 | $scope.switchToMediaPicker = function () { 119 | userService.getCurrentUser().then(function (userData) { 120 | dialogService.mediaPicker({ 121 | startNodeId: userData.startMediaId, 122 | callback: function (media) { 123 | $scope.target.id = media.id; 124 | $scope.target.udi = media.udi; 125 | $scope.target.isMedia = true; 126 | $scope.target.name = media.name; 127 | $scope.target.url = mediaHelper.resolveFile(media); 128 | } 129 | }); 130 | }); 131 | }; 132 | 133 | $scope.hideSearch = function () { 134 | $scope.searchInfo.showSearch = false; 135 | $scope.searchInfo.searchFromId = null; 136 | $scope.searchInfo.searchFromName = null; 137 | $scope.searchInfo.results = []; 138 | } 139 | 140 | // method to select a search result 141 | $scope.selectResult = function (evt, result) { 142 | result.selected = result.selected === true ? false : true; 143 | nodeSelectHandler(evt, { event: evt, node: result }); 144 | }; 145 | 146 | //callback when there are search results 147 | $scope.onSearchResults = function (results) { 148 | $scope.searchInfo.results = results; 149 | $scope.searchInfo.showSearch = true; 150 | }; 151 | 152 | $scope.dialogTreeEventHandler.bind("treeNodeSelect", nodeSelectHandler); 153 | $scope.dialogTreeEventHandler.bind("treeNodeExpanded", nodeExpandedHandler); 154 | 155 | $scope.$on('$destroy', function () { 156 | $scope.dialogTreeEventHandler.unbind("treeNodeSelect", nodeSelectHandler); 157 | $scope.dialogTreeEventHandler.unbind("treeNodeExpanded", nodeExpandedHandler); 158 | }); 159 | }); -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.jfm 193 | *.pfx 194 | *.publishsettings 195 | node_modules/ 196 | orleans.codegen.cs 197 | 198 | # Since there are multiple workflows, uncomment next line to ignore bower_components 199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 200 | #bower_components/ 201 | 202 | # RIA/Silverlight projects 203 | Generated_Code/ 204 | 205 | # Backup & report files from converting an old project file 206 | # to a newer Visual Studio version. Backup files are not needed, 207 | # because we have git ;-) 208 | _UpgradeReport_Files/ 209 | Backup*/ 210 | UpgradeLog*.XML 211 | UpgradeLog*.htm 212 | 213 | # SQL Server files 214 | *.mdf 215 | *.ldf 216 | 217 | # Business Intelligence projects 218 | *.rdl.data 219 | *.bim.layout 220 | *.bim_*.settings 221 | 222 | # Microsoft Fakes 223 | FakesAssemblies/ 224 | 225 | # GhostDoc plugin setting file 226 | *.GhostDoc.xml 227 | 228 | # Node.js Tools for Visual Studio 229 | .ntvs_analysis.dat 230 | 231 | # Visual Studio 6 build log 232 | *.plg 233 | 234 | # Visual Studio 6 workspace options file 235 | *.opt 236 | 237 | # Visual Studio LightSwitch build output 238 | **/*.HTMLClient/GeneratedArtifacts 239 | **/*.DesktopClient/GeneratedArtifacts 240 | **/*.DesktopClient/ModelManifest.xml 241 | **/*.Server/GeneratedArtifacts 242 | **/*.Server/ModelManifest.xml 243 | _Pvt_Extensions 244 | 245 | # Paket dependency manager 246 | .paket/paket.exe 247 | paket-files/ 248 | 249 | # FAKE - F# Make 250 | .fake/ 251 | 252 | # JetBrains Rider 253 | .idea/ 254 | *.sln.iml 255 | 256 | # CodeRush 257 | .cr/ 258 | 259 | # Python Tools for Visual Studio (PTVS) 260 | __pycache__/ 261 | *.pyc -------------------------------------------------------------------------------- /src/Gibe.LinkPicker.Umbraco/Gibe.LinkPicker.Umbraco.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {99D4F99D-7CB5-42F0-AD82-74B1AB947A2B} 8 | Library 9 | Properties 10 | Gibe.LinkPicker.Umbraco 11 | Gibe.LinkPicker.Umbraco 12 | v4.5 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | ..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.dll 36 | 37 | 38 | ..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.Net4.dll 39 | 40 | 41 | ..\packages\UmbracoCms.Core.7.6.8\lib\net45\businesslogic.dll 42 | 43 | 44 | ..\packages\ClientDependency.1.9.2\lib\net45\ClientDependency.Core.dll 45 | 46 | 47 | ..\packages\ClientDependency-Mvc5.1.8.0.0\lib\net45\ClientDependency.Core.Mvc.dll 48 | 49 | 50 | ..\packages\UmbracoCms.Core.7.6.8\lib\net45\cms.dll 51 | 52 | 53 | ..\packages\UmbracoCms.Core.7.6.8\lib\net45\controls.dll 54 | 55 | 56 | ..\packages\xmlrpcnet.2.5.0\lib\net20\CookComputing.XmlRpcV2.dll 57 | 58 | 59 | ..\packages\Examine.0.1.83\lib\net45\Examine.dll 60 | 61 | 62 | ..\packages\HtmlAgilityPack.1.4.9.5\lib\Net45\HtmlAgilityPack.dll 63 | 64 | 65 | ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll 66 | 67 | 68 | ..\packages\ImageProcessor.2.5.3\lib\net45\ImageProcessor.dll 69 | 70 | 71 | ..\packages\ImageProcessor.Web.4.8.3\lib\net45\ImageProcessor.Web.dll 72 | 73 | 74 | ..\packages\UmbracoCms.Core.7.6.8\lib\net45\interfaces.dll 75 | 76 | 77 | ..\packages\UmbracoCms.Core.7.6.8\lib\net45\log4net.dll 78 | 79 | 80 | ..\packages\Log4Net.Async.2.0.4\lib\net40\Log4Net.Async.dll 81 | 82 | 83 | ..\packages\Lucene.Net.2.9.4.1\lib\net40\Lucene.Net.dll 84 | 85 | 86 | ..\packages\Markdown.1.14.7\lib\net45\MarkdownSharp.dll 87 | 88 | 89 | ..\packages\UmbracoCms.Core.7.6.8\lib\net45\Microsoft.ApplicationBlocks.Data.dll 90 | 91 | 92 | ..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll 93 | 94 | 95 | ..\packages\Microsoft.AspNet.Identity.Owin.2.2.1\lib\net45\Microsoft.AspNet.Identity.Owin.dll 96 | 97 | 98 | ..\packages\Microsoft.AspNet.SignalR.Core.2.2.1\lib\net45\Microsoft.AspNet.SignalR.Core.dll 99 | 100 | 101 | ..\packages\Microsoft.IO.RecyclableMemoryStream.1.2.1\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll 102 | 103 | 104 | ..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll 105 | 106 | 107 | ..\packages\Microsoft.Owin.Host.SystemWeb.3.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll 108 | 109 | 110 | ..\packages\Microsoft.Owin.Security.3.0.1\lib\net45\Microsoft.Owin.Security.dll 111 | 112 | 113 | ..\packages\Microsoft.Owin.Security.Cookies.3.0.1\lib\net45\Microsoft.Owin.Security.Cookies.dll 114 | 115 | 116 | ..\packages\Microsoft.Owin.Security.OAuth.3.0.1\lib\net45\Microsoft.Owin.Security.OAuth.dll 117 | 118 | 119 | ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll 120 | True 121 | 122 | 123 | ..\packages\MiniProfiler.2.1.0\lib\net40\MiniProfiler.dll 124 | 125 | 126 | ..\packages\MySql.Data.6.9.10\lib\net45\MySql.Data.dll 127 | 128 | 129 | ..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll 130 | 131 | 132 | ..\packages\Owin.1.0\lib\net40\Owin.dll 133 | 134 | 135 | ..\packages\semver.1.1.2\lib\net45\Semver.dll 136 | 137 | 138 | ..\packages\UmbracoCms.Core.7.6.8\lib\net45\SQLCE4Umbraco.dll 139 | 140 | 141 | 142 | 143 | ..\packages\UmbracoCms.Core.7.6.8\lib\net45\System.Data.SqlServerCe.dll 144 | 145 | 146 | ..\packages\UmbracoCms.Core.7.6.8\lib\net45\System.Data.SqlServerCe.Entity.dll 147 | 148 | 149 | ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll 150 | 151 | 152 | ..\packages\System.Threading.Tasks.Dataflow.4.7.0\lib\portable-net45+win8+wpa81\System.Threading.Tasks.Dataflow.dll 153 | 154 | 155 | ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll 156 | 157 | 158 | ..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll 159 | 160 | 161 | ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll 162 | 163 | 164 | ..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll 165 | 166 | 167 | ..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll 168 | 169 | 170 | ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll 171 | 172 | 173 | ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll 174 | 175 | 176 | ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | ..\packages\UmbracoCms.Core.7.6.8\lib\net45\TidyNet.dll 186 | 187 | 188 | ..\packages\UmbracoCms.Core.7.6.8\lib\net45\umbraco.dll 189 | 190 | 191 | ..\packages\UmbracoCms.Core.7.6.8\lib\net45\Umbraco.Core.dll 192 | 193 | 194 | ..\packages\UmbracoCms.Core.7.6.8\lib\net45\umbraco.DataLayer.dll 195 | 196 | 197 | ..\packages\UmbracoCms.Core.7.6.8\lib\net45\umbraco.editorControls.dll 198 | 199 | 200 | ..\packages\UmbracoCms.Core.7.6.8\lib\net45\umbraco.MacroEngines.dll 201 | 202 | 203 | ..\packages\UmbracoCms.Core.7.6.8\lib\net45\umbraco.providers.dll 204 | 205 | 206 | ..\packages\UmbracoCms.Core.7.6.8\lib\net45\Umbraco.Web.UI.dll 207 | 208 | 209 | ..\packages\UmbracoCms.Core.7.6.8\lib\net45\UmbracoExamine.dll 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | --------------------------------------------------------------------------------