v8: Add package contributors (#4385)

This commit is contained in:
Bjarne Fyrstenborg
2019-02-14 16:00:58 +01:00
committed by Sebastiaan Janssen
parent a8f4cf73d8
commit 280a6d79b4
14 changed files with 150 additions and 41 deletions
@@ -22,6 +22,7 @@ namespace Umbraco.Core.Models.Packaging
public RequirementsType UmbracoVersionRequirementsType { get; set; }
public string Author { get; set; }
public string AuthorUrl { get; set; }
public IList<string> Contributors { get; set; }
public string Readme { get; set; }
public string PackageView { get; set; }
public string IconUrl { get; set; }
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
namespace Umbraco.Core.Models.Packaging
{
@@ -12,6 +13,7 @@ namespace Umbraco.Core.Models.Packaging
Version UmbracoVersion { get; }
string Author { get; }
string AuthorUrl { get; }
IList<string> Contributors { get; }
string Readme { get; }
/// <summary>
@@ -25,6 +25,7 @@ namespace Umbraco.Core.Models.Packaging
Actions = compiled.Actions,
Author = compiled.Author,
AuthorUrl = compiled.AuthorUrl,
Contributors = compiled.Contributors,
PackageView = compiled.PackageView,
IconUrl = compiled.IconUrl,
License = compiled.License,
@@ -79,6 +80,9 @@ namespace Umbraco.Core.Models.Packaging
[Url]
public string AuthorUrl { get; set; } = string.Empty;
[DataMember(Name = "contributors")]
public IList<string> Contributors { get; set; } = new List<string>();
[DataMember(Name = "license")]
public string License { get; set; } = "MIT License";
@@ -43,6 +43,7 @@ namespace Umbraco.Core.Packaging
Name = package.Element("name")?.Value,
Author = author.Element("name")?.Value,
AuthorUrl = author.Element("website")?.Value,
Contributors = info.Element("contributors")?.Elements("contributor").Select(x => x.Value).ToList() ?? new List<string>(),
Version = package.Element("version")?.Value,
Readme = info.Element("readme")?.Value,
License = package.Element("license")?.Value,
@@ -39,6 +39,7 @@ namespace Umbraco.Core.Packaging
LicenseUrl = xml.Element("license")?.AttributeValue<string>("url") ?? string.Empty,
Author = xml.Element("author")?.Value ?? string.Empty,
AuthorUrl = xml.Element("author")?.AttributeValue<string>("url") ?? string.Empty,
Contributors = xml.Element("contributors")?.Elements("contributor").Select(x => x.Value).ToList() ?? new List<string>(),
Readme = xml.Element("readme")?.Value ?? string.Empty,
Actions = xml.Element("actions")?.ToString(SaveOptions.None) ?? "<actions></actions>", //take the entire outer xml value
ContentNodeId = xml.Element("content")?.AttributeValue<string>("nodeId") ?? string.Empty,
@@ -87,6 +88,8 @@ namespace Umbraco.Core.Packaging
new XCData(def.Author ?? string.Empty),
new XAttribute("url", def.AuthorUrl ?? string.Empty)),
new XElement("contributors", (def.Contributors ?? Array.Empty<string>()).Where(x => !x.IsNullOrWhiteSpace()).Select(x => new XElement("contributor", x))),
new XElement("readme", new XCData(def.Readme ?? string.Empty)),
actionsXml,
new XElement("datatypes", string.Join(",", def.DataTypes ?? Array.Empty<string>())),
@@ -573,12 +573,25 @@ namespace Umbraco.Core.Packaging
package.Add(requirements);
info.Add(package);
//Author
// Author
var author = new XElement("author", "");
author.Add(new XElement("name", definition.Author));
author.Add(new XElement("website", definition.AuthorUrl));
info.Add(author);
// Contributors
var contributors = new XElement("contributors", "");
if (definition.Contributors != null && definition.Contributors.Any())
{
foreach (var contributor in definition.Contributors)
{
contributors.Add(new XElement("contributor", contributor));
}
}
info.Add(contributors);
info.Add(new XElement("readme", new XCData(definition.Readme)));
return info;
@@ -608,10 +621,5 @@ namespace Umbraco.Core.Packaging
var packagesXml = XDocument.Load(packagesFile);
return packagesXml;
}
}
}
@@ -22,6 +22,7 @@
vm.openViewPicker = openViewPicker;
vm.removePackageView = removePackageView;
vm.downloadFile = downloadFile;
vm.contributorsEditor = null;
vm.buttonLabel = "";
@@ -34,6 +35,9 @@
//pre populate package with some values
packageResource.getEmpty().then(scaffold => {
vm.package = scaffold;
buildContributorsEditor(vm.package);
vm.loading = false;
});
@@ -44,6 +48,9 @@
// load package
packageResource.getCreatedById(packageId).then(createdPackage => {
vm.package = createdPackage;
buildContributorsEditor(vm.package);
vm.loading = false;
// get render model for content node
if(vm.package.contentNodeId) {
@@ -143,6 +150,10 @@
function createOrUpdatePackage(editPackageForm) {
let contributors = vm.contributorsEditor.value.map(o => o.value);
vm.package.contributors = contributors;
if (formHelper.submitForm({ formCtrl: editPackageForm, scope: $scope })) {
vm.buttonState = "busy";
@@ -251,6 +262,35 @@
vm.package.packageView = null;
}
function buildContributorsEditor(pkg) {
vm.contributorsEditor = {
alias: "contributors",
editor: "Umbraco.MultipleTextstring",
label: "Contributors",
description: "",
hideLabel: true,
view: "views/propertyeditors/multipletextbox/multipletextbox.html",
value: getVals(pkg.contributors),
validation: {
mandatory: false,
pattern: null
},
config: {
min: 0,
max: 0
}
};
}
function getVals(array) {
var vals = [];
for (var i = 0; i < array.length; i++) {
vals.push({ value: array[i] });
}
return vals;
}
onInit();
}
@@ -20,7 +20,7 @@
<div class="umb-expansion-panel">
<div class="umb-expansion-panel__header" ng-click="vm.propertiesOpen = !vm.propertiesOpen">
<div>Package Properties</div>
<div><localize key="packager_packageProperties">Package Properties</localize></div>
<ins class="umb-expansion-panel__expand" ng-class="{'icon-navigation-down': !vm.propertiesOpen, 'icon-navigation-up': vm.propertiesOpen}">&nbsp;</ins>
</div>
@@ -44,7 +44,7 @@
</span>
</umb-control-group>
<umb-control-group label="Icon URL">
<umb-control-group label="@packager_packageIconUrl">
<input class="umb-property-editor" name="iconUrl" type="text" ng-model="vm.package.iconUrl" />
</umb-control-group>
@@ -61,7 +61,7 @@
</span>
</umb-control-group>
<umb-control-group label="Author name" required="true">
<umb-control-group label="@packager_packageAuthor" required="true">
<input class="umb-property-editor" name="author" type="text" ng-model="vm.package.author" val-server-field="model.Author" required />
<span ng-messages="editPackageForm.author.$error" show-validation-on-submit >
@@ -70,7 +70,7 @@
</span>
</umb-control-group>
<umb-control-group label="Author URL" required="true">
<umb-control-group label="@packager_packageAuthorUrl" required="true">
<input class="umb-property-editor" name="authorUrl" type="text" ng-model="vm.package.authorUrl" val-server-field="model.AuthorUrl" required />
<span ng-messages="editPackageForm.authorUrl.$error" show-validation-on-submit >
@@ -79,15 +79,21 @@
</span>
</umb-control-group>
<umb-control-group label="License">
<umb-control-group label="@packager_packageContrib" ng-if="vm.contributorsEditor">
<umb-property property="vm.contributorsEditor">
<umb-property-editor model="vm.contributorsEditor"></umb-property-editor>
</umb-property>
</umb-control-group>
<umb-control-group label="@packager_packageLicense">
<input class="umb-property-editor" name="license" type="text" ng-model="vm.package.license" />
</umb-control-group>
<umb-control-group label="License URL">
<umb-control-group label="@packager_packageLicenseUrl">
<input class="umb-property-editor" name="licenseUrl" type="text" ng-model="vm.package.licenseUrl" />
</umb-control-group>
<umb-control-group label="Readme">
<umb-control-group label="@packager_packageReadme">
<textarea class="umb-property-editor" name="readme" rows="10" ng-model="vm.package.readme"></textarea>
</umb-control-group>
@@ -98,13 +104,13 @@
<div class="umb-expansion-panel">
<div class="umb-expansion-panel__header" ng-click="vm.contentOpen = !vm.contentOpen">
<div>Package Content</div>
<div><localize key="packager_packageContent">Package Content</localize></div>
<ins class="umb-expansion-panel__expand" ng-class="{'icon-navigation-down': !vm.contentOpen, 'icon-navigation-up': vm.contentOpen}">&nbsp;</ins>
</div>
<div class="umb-expansion-panel__content" ng-show="vm.contentOpen">
<umb-control-group label="Content">
<umb-control-group label="@general_content">
<umb-node-preview
ng-if="vm.package.contentNodeId"
@@ -127,12 +133,12 @@
<label style="padding-left: 0;">
<input type="checkbox" ng-model="vm.package.contentLoadChildNodes" ng-disabled="!vm.package.contentNodeId" />
Include all child nodes
<localize key="packager_includeAllChildNodes">Include all child nodes</localize>
</label>
</umb-control-group>
<umb-control-group label="Document Types">
<umb-control-group label="@treeHeaders_documentTypes">
<div ng-repeat="doctype in ::vm.documentTypes | orderBy:'name'">
<label>
<input
@@ -145,7 +151,7 @@
</div>
</umb-control-group>
<umb-control-group label="Templates">
<umb-control-group label="@treeHeaders_templates">
<div ng-repeat="template in ::vm.templates | orderBy:'name'">
<label>
<input
@@ -157,7 +163,7 @@
</div>
</umb-control-group>
<umb-control-group label="Stylesheets">
<umb-control-group label="@treeHeaders_stylesheets">
<div ng-repeat="stylesheet in ::vm.stylesheets | orderBy:'name'">
<label>
<input
@@ -169,7 +175,7 @@
</div>
</umb-control-group>
<umb-control-group label="Macros">
<umb-control-group label="@treeHeaders_macros">
<div ng-repeat="macro in ::vm.macros | orderBy:'name'">
<label>
<input type="checkbox"
@@ -181,7 +187,7 @@
</umb-control-group>
<umb-control-group label="Languages">
<umb-control-group label="@treeHeaders_languages">
<div ng-repeat="language in ::vm.languages | orderBy:'name'">
<label>
<input
@@ -193,7 +199,7 @@
</div>
</umb-control-group>
<umb-control-group label="Dictionary Items">
<umb-control-group label="@treeHeaders_dictionary">
<div ng-repeat="dictionaryItem in ::vm.dictionaryItems | orderBy:'name'">
<label>
<input
@@ -205,7 +211,7 @@
</div>
</umb-control-group>
<umb-control-group label="Data Types">
<umb-control-group label="@treeHeaders_dataTypes">
<div ng-repeat="dataType in ::vm.dataTypes | orderBy:'name'">
<label>
<input
@@ -224,7 +230,7 @@
<div class="umb-expansion-panel">
<div class="umb-expansion-panel__header" ng-click="vm.filesOpen = !vm.filesOpen">
<div>Package Files</div>
<div><localize key="packager_packageFiles">Package Files</localize></div>
<ins class="umb-expansion-panel__expand" ng-class="{'icon-navigation-down': !vm.filesOpen, 'icon-navigation-up': vm.filesOpen}">&nbsp;</ins>
</div>
@@ -233,8 +239,8 @@
<p>Remember: .xslt and .ascx files for your macros will be added automaticly, but you will still need to add assemblies, images and script files manually to the list below.</p>
-->
<umb-control-group
label="Path to file"
description="Absolute path to file (ie: /bin/umbraco.bin)">
label="@packager_pathToFile"
description="@packager_pathToFileDescription">
<umb-node-preview
ng-if="vm.package.files"
@@ -283,12 +289,12 @@
<div class="umb-expansion-panel">
<div class="umb-expansion-panel__header" ng-click="vm.actionsOpen = !vm.actionsOpen">
<div>Package Actions</div>
<div><localize key="packager_packageActions">Package Actions</localize></div>
<ins class="umb-expansion-panel__expand" ng-class="{'icon-navigation-down': !vm.actionsOpen, 'icon-navigation-up': vm.actionsOpen}">&nbsp;</ins>
</div>
<div class="umb-expansion-panel__content" ng-show="vm.actionsOpen">
<umb-control-group
label="Actions"
label="@packager_actions"
description="Here you can add custom installer / uninstaller events to perform certain tasks during installation and uninstallation.
All actions are formed as a xml node, containing data for the action to be performed.">
<div>
@@ -105,17 +105,21 @@
<img ng-if="vm.localPackage.iconUrl" ng-src="{{vm.localPackage.iconUrl}}" alt="" />
</div>
<div class="umb-package-info">
<h4 class="umb-info-local-item"><strong>{{ vm.localPackage.name }}</strong></h4>
<div class="umb-info-local-item">
<strong><localize key="packager_packageAuthor">Author</localize></strong>
<strong><localize key="packager_packageAuthor">Author</localize></strong><br>
<a href="{{ vm.localPackage.authorUrl }}" target="_blank">{{ vm.localPackage.author }}</a>
</div>
<div class="umb-info-local-item" ng-if="vm.localPackage.contributors && vm.localPackage.contributors.length > 0">
<strong><localize key="packager_packageContrib">Contributors</localize></strong><br>
<span>{{ vm.localPackage.contributors.join(', ')}}</span>
</div>
<div class="umb-info-local-item">
<strong><localize key="packager_packageVersion">Version</localize></strong>
<strong><localize key="packager_packageVersion">Version</localize></strong><br>
{{ vm.localPackage.version }}
<p ng-if="vm.localPackage.originalVersion">
<small>
@@ -128,13 +132,12 @@
</div>
<div class="umb-info-local-item">
<strong><localize key="packager_packageLicense">License</localize></strong>
<strong><localize key="packager_packageLicense">License</localize></strong><br>
<a href="{{ vm.localPackage.licenseUrl }}" target="_blank">{{ vm.localPackage.license }}</a>
</div>
<div class="umb-info-local-item">
<strong><localize key="packager_packageReadme">Read me</localize></strong>
<br>
<strong><localize key="packager_packageReadme">Read me</localize></strong><br>
<small ng-bind-html="vm.localPackage.readme"></small>
</div>
+14 -2
View File
@@ -555,6 +555,7 @@
<key alias="comment">Kommentar</key>
<key alias="confirm">Bekræft</key>
<key alias="constrainProportions">Behold proportioner</key>
<key alias="content">Indhold</key>
<key alias="continue">Fortsæt</key>
<key alias="copy">Kopiér</key>
<key alias="create">Opret</key>
@@ -840,20 +841,22 @@ Mange hilsner fra Umbraco robotten
<key alias="notifications">Notificeringer</key>
</area>
<area alias="packager">
<key alias="actions">Handlinger</key>
<key alias="created">Oprettet</key>
<key alias="createPackage">Opret pakke</key>
<key alias="chooseLocalPackageText">Vælg pakken fra din computer. Umbraco pakker er oftest en ".zip" fil</key>
<key alias="deletewarning">Dette vil slette pakken</key>
<key alias="dropHere">Slip her for at uploade</key>
<key alias="includeAllChildNodes">Inkludér alle underliggende sider</key>
<key alias="orClickHereToUpload">eller klik her for at vælge pakkefil</key>
<key alias="uploadPackage">Upload pakke</key>
<key alias="localPackageDescription">Installer en lokal pakke ved at vælge den fra din computer. Installer kun pakker fra kilder, du kender og stoler på</key>
<key alias="uploadAnother">Upload en anden pakke</key>
<key alias="cancelAndUploadAnother">Annuller og upload en anden pakke</key>
<key alias="packageLicense">Licens</key>
<key alias="accept">Jeg accepterer</key>
<key alias="termsOfUse">betingelser for anvendelse</key>
<key alias="packageInstall">Installér pakke</key>
<key alias="pathToFile">Sti til fil</key>
<key alias="pathToFileDescription">Absolut sti til fil (f.eks.: /bin/umbraco.bin)</key>
<key alias="installed">Installeret</key>
<key alias="installedPackages">Installeret pakker</key>
<key alias="installLocal">Installér lokal</key>
@@ -862,6 +865,15 @@ Mange hilsner fra Umbraco robotten
<key alias="noPackagesCreated">Der er ikke blevet oprettet nogle pakker endnu</key>
<key alias="noPackages">Du har ingen pakker installeret</key>
<key alias="noPackagesDescription"><![CDATA[Du har ikke nogen pakker installeret. Du kan enten installere en lokal pakke ved at vælge den fra din computer eller gennemse de tilgængelige pakker ved hjælp af ikonet <strong>'Pakker'</strong> øverst til højre på din skærm]]></key>
<key alias="packageActions">Pakkehandlinger</key>
<key alias="packageAuthorUrl">Forfatter URL</key>
<key alias="packageContent">Pakkeindhold</key>
<key alias="packageFiles">Pakkefiler</key>
<key alias="packageIconUrl">Ikon URL</key>
<key alias="packageInstall">Installér pakke</key>
<key alias="packageLicense">Licens</key>
<key alias="packageLicenseUrl">Licens URL</key>
<key alias="packageProperties">Pakkeegenskaber</key>
<key alias="packageSearch">Søg efter pakker</key>
<key alias="packageSearchResults">Resultater for</key>
<key alias="packageNoResults">Vi kunne ikke finde resultater for</key>
+16 -3
View File
@@ -559,7 +559,6 @@
<key alias="tableSplitNotSplittable">You cannot split a cell that hasn't been merged.</key>
</area>
<area alias="general">
<key alias="options">Options</key>
<key alias="about">About</key>
<key alias="action">Action</key>
<key alias="actions">Actions</key>
@@ -579,6 +578,7 @@
<key alias="confirm">Confirm</key>
<key alias="constrain">Constrain</key>
<key alias="constrainProportions">Constrain proportions</key>
<key alias="content">Content</key>
<key alias="continue">Continue</key>
<key alias="copy">Copy</key>
<key alias="create">Create</key>
@@ -637,6 +637,7 @@
<key alias="off">Off</key>
<key alias="ok">OK</key>
<key alias="open">Open</key>
<key alias="options">Options</key>
<key alias="on">On</key>
<key alias="or">or</key>
<key alias="orderBy">Order by</key>
@@ -1078,6 +1079,7 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="notifications">Notifications</key>
</area>
<area alias="packager">
<key alias="actions">Actions</key>
<key alias="created">Created</key>
<key alias="createPackage">Create package</key>
<key alias="chooseLocalPackageText"><![CDATA[
@@ -1086,15 +1088,17 @@ To manage your website, simply open the Umbraco back office and start adding con
]]></key>
<key alias="deletewarning">This will delete the package</key>
<key alias="dropHere">Drop to upload</key>
<key alias="includeAllChildNodes">Include all child nodes</key>
<key alias="orClickHereToUpload">or click here to choose package file</key>
<key alias="uploadPackage">Upload package</key>
<key alias="localPackageDescription">Install a local package by selecting it from your machine. Only install packages from sources you know and trust</key>
<key alias="uploadAnother">Upload another package</key>
<key alias="cancelAndUploadAnother">Cancel and upload another package</key>
<key alias="packageLicense">License</key>
<key alias="accept">I accept</key>
<key alias="termsOfUse">terms of use</key>
<key alias="packageInstall">Install package</key>
<key alias="pathToFile">Path to file</key>
<key alias="pathToFileDescription">Absolute path to file (ie: /bin/umbraco.bin)</key>
<key alias="installed">Installed</key>
<key alias="installedPackages">Installed packages</key>
<key alias="installLocal">Install local</key>
@@ -1103,6 +1107,15 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="noPackagesCreated">No packages have been created yet</key>
<key alias="noPackages">You dont have any packages installed</key>
<key alias="noPackagesDescription"><![CDATA[You dont have any packages installed. Either install a local package by selecting it from your machine, or browse through available packages using the <strong>'Packages'</strong> icon in the top right of your screen]]></key>
<key alias="packageActions">Package Actions</key>
<key alias="packageAuthorUrl">Author URL</key>
<key alias="packageContent">Package Content</key>
<key alias="packageFiles">Package Files</key>
<key alias="packageIconUrl">Icon URL</key>
<key alias="packageInstall">Install package</key>
<key alias="packageLicense">License</key>
<key alias="packageLicenseUrl">License URL</key>
<key alias="packageProperties">Package Properties</key>
<key alias="packageSearch">Search for packages</key>
<key alias="packageSearchResults">Results for</key>
<key alias="packageNoResults">We couldnt find anything for</key>
@@ -582,6 +582,7 @@
<key alias="confirm">Confirm</key>
<key alias="constrain">Constrain</key>
<key alias="constrainProportions">Constrain proportions</key>
<key alias="content">Content</key>
<key alias="continue">Continue</key>
<key alias="copy">Copy</key>
<key alias="create">Create</key>
@@ -1079,6 +1080,7 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="notifications">Notifications</key>
</area>
<area alias="packager">
<key alias="actions">Actions</key>
<key alias="created">Created</key>
<key alias="createPackage">Create package</key>
<key alias="chooseLocalPackageText"><![CDATA[
@@ -1087,15 +1089,16 @@ To manage your website, simply open the Umbraco back office and start adding con
]]></key>
<key alias="deletewarning">This will delete the package</key>
<key alias="dropHere">Drop to upload</key>
<key alias="includeAllChildNodes">Include all child nodes</key>
<key alias="orClickHereToUpload">or click here to choose package file</key>
<key alias="uploadPackage">Upload package</key>
<key alias="localPackageDescription">Install a local package by selecting it from your machine. Only install packages from sources you know and trust</key>
<key alias="uploadAnother">Upload another package</key>
<key alias="cancelAndUploadAnother">Cancel and upload another package</key>
<key alias="packageLicense">License</key>
<key alias="accept">I accept</key>
<key alias="termsOfUse">terms of use</key>
<key alias="packageInstall">Install package</key>
<key alias="pathToFile">Path to file</key>
<key alias="pathToFileDescription">Absolute path to file (ie: /bin/umbraco.bin)</key>
<key alias="installed">Installed</key>
<key alias="installedPackages">Installed packages</key>
<key alias="installLocal">Install local</key>
@@ -1104,6 +1107,15 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="noPackagesCreated">No packages have been created yet</key>
<key alias="noPackages">You dont have any packages installed</key>
<key alias="noPackagesDescription"><![CDATA[You dont have any packages installed. Either install a local package by selecting it from your machine, or browse through available packages using the <strong>'Packages'</strong> icon in the top right of your screen]]></key>
<key alias="packageActions">Package Actions</key>
<key alias="packageAuthorUrl">Author URL</key>
<key alias="packageContent">Package Content</key>
<key alias="packageFiles">Package Files</key>
<key alias="packageIconUrl">Icon URL</key>
<key alias="packageInstall">Install package</key>
<key alias="packageLicense">License</key>
<key alias="packageLicenseUrl">License URL</key>
<key alias="packageProperties">Package Properties</key>
<key alias="packageSearch">Search for packages</key>
<key alias="packageSearchResults">Results for</key>
<key alias="packageNoResults">We couldnt find anything for</key>
@@ -96,6 +96,7 @@ namespace Umbraco.Web.Editors
model.Name = ins.Name;
model.Author = ins.Author;
model.AuthorUrl = ins.AuthorUrl;
model.Contributors = ins.Contributors;
model.IconUrl = ins.IconUrl;
model.License = ins.License;
model.LicenseUrl = ins.LicenseUrl;
@@ -88,6 +88,9 @@ namespace Umbraco.Web.Models
[DataMember(Name = "author")]
public string Author { get; set; }
[DataMember(Name = "contributors")]
public IList<string> Contributors { get; set; }
[DataMember(Name = "iconUrl")]
public string IconUrl { get; set; }
}