Compare commits

...

125 Commits

Author SHA1 Message Date
kgiszewski f541b50b82 Merge branch 'master' into pr/356
Conflicts:
	app/Umbraco/Umbraco.Archetype/Models/ArchetypePreValue.cs
	app/controllers/config.controller.js
	app/views/archetype.config.fieldset.dialog.html
2016-05-13 10:07:18 -04:00
Nicholas-Westby 5767ea97d1 Workaround for .sortable("instance") not working on older versions of Umbraco. 2016-05-11 21:19:09 -07:00
Nicholas-Westby e1fa7a3271 Fixed recursion error and tidied up validation logic. 2016-05-07 15:48:39 -07:00
Nicholas-Westby c2e97e28ce Disable sortables for Archetypes that can't have the currently dragged fieldset dropped onto them. 2016-05-07 14:54:30 -07:00
Nicholas-Westby eda9bab02f Ensure the property alias is unique when dragging between Archetypes. 2016-05-07 12:45:34 -07:00
Nicholas-Westby ce3cecbec9 Fix for incorrect validation errors. 2016-05-05 21:52:03 -07:00
Nicholas-Westby ef5faae254 Allow the last fieldset to be dropped back to its origin list. 2016-05-05 21:18:08 -07:00
Nicholas-Westby 547473e92c Account for the possibility that the "tinyMCE" variable may not exist. 2016-05-05 20:20:44 -07:00
Nicholas-Westby 9857059906 Ensured the temporary ID is unique when cloning fieldsets. 2016-05-05 20:05:20 -07:00
Nicholas-Westby 7f7b054c14 Clear errors on the target Archetype too. 2016-05-04 21:28:16 -07:00
Nicholas-Westby a40d95250e Clear out errors of nested Archetypes on drop. 2016-05-04 21:15:36 -07:00
Nicholas-Westby 1e6004d3fa Another RTE fix.
Improved handling of validations when moving fieldsets (recursively mark Archetypes as valid).
2016-05-04 20:58:26 -07:00
Nicholas-Westby 0671403732 Fix for rich text editors when dragging between Archetypes. 2016-05-03 21:59:04 -07:00
kjac 8e00914370 More code style fixes 2016-05-03 20:17:45 +02:00
kjac 104c369bcc Fix some code style issues 2016-05-03 20:15:23 +02:00
kjac 4c02cf2921 Merge remote-tracking branch 'refs/remotes/origin/master' into allowed-member-groups 2016-05-03 19:44:59 +02:00
kjac 74470b8e8f Merge remote-tracking branch 'refs/remotes/imulus/master' 2016-05-03 19:44:23 +02:00
Nicholas-Westby de92147ec0 WIP: Attempting to fix RTE when dragging between fieldsets (still needs some work). 2016-05-01 21:23:02 -07:00
Nicholas-Westby c2b7d2c89d Allowed rich text editors to be dragged between Archetypes. 2016-05-01 18:27:01 -07:00
Nicholas-Westby d0fe30f08b WIP: Better handling of validation errors when dragging fieldsets between Archetypes.
Added "jsonSnapshot" (utility function for troubleshooting).
Added "tolerance" (my hope is that will help drag operations act nicer with expanded fieldsets).
2016-05-01 17:33:32 -07:00
Nicholas-Westby d22ae1244e Merge remote-tracking branch 'origin/master' into feature/355-nested-dragging 2016-04-30 18:18:14 -07:00
Nicholas-Westby fa48d73630 Only allow cross-Archetype sorting of a single fieldset if it can be removed. 2016-04-28 20:32:07 -07:00
kgiszewski fb305c9d0e Fix label padding in the config 2016-04-28 11:35:05 -04:00
Nicholas-Westby be332d310f Add a top margin of 5px to empty Archetype drop zone. 2016-04-28 08:24:06 -07:00
kjac d97bbb59dc Merge remote-tracking branch 'refs/remotes/origin/master' into allowed-member-groups 2016-04-27 21:00:11 +02:00
kjac 3702ec484b Merge remote-tracking branch 'refs/remotes/imulus/master' 2016-04-27 20:59:42 +02:00
Nicholas-Westby d8d4ec1a73 Improved terminology (fieldsets are dragged across Archetypes, not across fieldsets). 2016-04-27 08:21:16 -07:00
Nicholas-Westby 32cb89bba1 Made cross-field dragging opt-in. 2016-04-26 21:40:19 -07:00
Nicholas-Westby 863f041fc9 Fixed issue when dragging newly created fieldset between Archetypes.
Ensured that fieldset aliases are compared when judging compatibility during drag.
2016-04-26 21:14:33 -07:00
Nicholas-Westby 5a83719dfc Performance optimization via short-circuiting. 2016-04-26 05:57:08 -07:00
Nicholas-Westby 1b1940fe6a Tamed a rogue comment. 2016-04-26 05:54:56 -07:00
kgiszewski b71564bfb5 Merge branch 'pr/351' 2016-04-26 07:51:50 -04:00
kgiszewski ba8a6cf65c Merge branch 'master' into pr/351 2016-04-26 07:37:33 -04:00
Nicholas-Westby 7dd07b9f9c When dragging between Archetypes, only allow the operation when a configured fieldset matches the dragged fieldset. 2016-04-25 21:05:36 -07:00
Nicholas-Westby 29652bb880 Removed a parameter I never ended up using. 2016-04-24 21:54:05 -07:00
Nicholas-Westby 62b7420eaa Prevent dragging when can't add to or remove from list of fieldsets.
Allow dragging into an empty list of fieldsets.
2016-04-24 21:38:59 -07:00
Nicholas-Westby 333f17976b Enable nested dragging. 2016-04-24 17:57:36 -07:00
kjac 45981b0431 Handle lazy load of moment.js 2016-04-23 15:30:14 +02:00
kjac 531ff0aab4 Merge remote-tracking branch 'refs/remotes/origin/fix-publishing-for-collapsed-fieldsets' into allowed-member-groups
# Conflicts:
#	app/views/archetype.default.html
2016-04-23 15:25:33 +02:00
kjac 394572a8fc Yet another stab at fixing it
By tracking the fieldsets that have been expanded (loaded), we can make
sure the submit watchers fire appropriately, even when the fieldsets are
collapsed down again.

Apart from hopefully fixing the publishing issues for collapsed
fieldsets, this also adds a performance gain if the users expand and
collapse the same fieldsets more than once, since the fieldsets now only
load the first time they're expanded (instead of every time).

This also - at least partially - fixes the validation issue #325
introduced by #301
2016-04-23 10:14:56 +02:00
kgiszewski c7114b63f5 Merge branch 'master' of github.com:imulus/Archetype 2016-04-18 11:02:10 -04:00
kgiszewski 9704a8b591 Merge branch 'pr/345' 2016-04-18 11:02:00 -04:00
kjac 0b6af3b4e1 Another stab at fixing publishing for collapsed fieldsets
Make sure we've loaded moment.js before attempting to use it.

Also a small update to styles to accommodate 7.4
2016-04-10 19:23:31 +02:00
kjac 4b874dc5b5 Another stab at fixing publishing for collapsed fieldsets 2016-04-06 20:40:29 +02:00
Kevin Giszewski a081d97546 Update README.md 2016-04-06 09:31:13 -04:00
kjac ebf3fd1135 Clean up duplicate code after merge 2016-04-04 21:32:24 +02:00
kjac 85157612f4 Merge remote-tracking branch 'refs/remotes/origin/fix-publishing-for-collapsed-fieldsets' into allowed-member-groups 2016-04-04 21:31:38 +02:00
kjac 6b79a508bb Fix publishing when all fieldsets are collapsed
Because of the lazy loading of property editors, the
submitWatcherOnSubmit method is not necessarily called when an Archetype
is saved. This is indeed the case when all fieldsets are collapsed.
2016-04-04 21:28:19 +02:00
kjac f57205dab9 More member groups implementation 2016-04-04 21:21:02 +02:00
kjac b6ccab10b3 Merge remote-tracking branch 'refs/remotes/imulus/master' into allowed-member-groups
# Conflicts:
#	app/less/archetype.less
2016-04-04 20:37:15 +02:00
kjac e1f67a738b Merge remote-tracking branch 'refs/remotes/imulus/master' 2016-04-04 20:34:37 +02:00
kgiszewski 4410f1bb81 Bump version to v1.13 2016-04-04 13:08:58 -04:00
kgiszewski 5c2a99987a Fix style so text won't overflow out. 2016-04-04 12:47:39 -04:00
kgiszewski 715a2bf6d5 Fixed missing dialogData from enablePublishing 2016-04-04 12:03:52 -04:00
kjac d9ffb4b097 Merge remote-tracking branch 'refs/remotes/origin/master' into publishing
# Conflicts:
#	app/less/archetype.less
2016-04-03 12:53:30 +02:00
kjac c409922469 Merge remote-tracking branch 'refs/remotes/imulus/master' 2016-04-03 12:43:03 +02:00
kgiszewski 6b40d1e20b Merge branch 'pr/348' 2016-04-02 19:17:51 -04:00
kgiszewski 3e91b1c2c3 Why do I have to keep committing this? 2016-04-02 19:14:30 -04:00
kgiszewski 38eafc0063 Merge branch 'pr/350' 2016-04-02 19:11:43 -04:00
kgiszewski 89aeca9bf0 Add version to json config 2016-04-02 19:11:39 -04:00
kgiszewski 2b6d87d97c Bump version to v1.12.4 2016-04-02 19:10:54 -04:00
kjac 1ca113b455 Fix issue 342 2016-03-31 23:44:52 +02:00
kjac 8228b2dae5 Scope icon styles to fieldset controls only 2016-03-31 08:17:43 +02:00
kjac 22f24ec882 Merge remote-tracking branch 'refs/remotes/imulus/master' 2016-03-31 08:02:33 +02:00
kjac e33eb863e6 #326 - support tags (and other built-in datatypes) 2016-03-29 16:01:14 +02:00
Kevin Giszewski 6bcf291c99 Update README.md 2016-03-29 09:41:05 -04:00
kjac b0f614c891 Allowed member groups PoC 2016-03-23 15:08:07 +01:00
kjac a424a7e4f3 Revert addDefaultProperties to master and adjust addCustomProperties accordingly 2016-03-23 08:38:07 +01:00
kjac 75fa2bb1bb Fix formatting 2016-03-22 19:58:48 +01:00
kjac 5585244d32 Merge remote-tracking branch 'refs/remotes/origin/master' into publishing 2016-03-22 19:40:59 +01:00
kjac 41fa8fa40d Merge remote-tracking branch 'refs/remotes/imulus/master' 2016-03-22 19:38:10 +01:00
kjac 9336f4508a Handle publishing in UTC 2016-03-22 19:35:40 +01:00
kgiszewski f9e5012b4e Merge branch 'master' into pr/338 2016-03-22 11:59:44 -04:00
kgiszewski 61d215e16c Merge branch 'master' of github.com:imulus/Archetype 2016-03-22 11:53:21 -04:00
kgiszewski e1e34be10d Merge branch 'master' into pr/311 2016-03-22 11:36:37 -04:00
Kevin Giszewski 796be76d94 Merge pull request #339 from imulus/feature/74-style
Update style for 7.4
2016-03-21 14:57:49 -04:00
kjac 8f7024c32a Comments 2016-03-20 14:05:31 +01:00
kjac dea307ff8e Filter out fieldsets based on publishing 2016-03-20 13:51:14 +01:00
kjac d69a10de48 Clean up 2016-03-20 13:37:34 +01:00
kjac b93df7a4c0 Add custom properties to new fieldsets 2016-03-20 13:28:22 +01:00
kjac 48dbdebec5 Create expandable settings group and fix icon activation 2016-03-20 13:21:43 +01:00
kjac 65837fa74c Undo a few things 2016-03-20 12:08:23 +01:00
kjac 29a73336e3 Merge remote-tracking branch 'refs/remotes/imulus/master' into publishing 2016-03-20 12:04:52 +01:00
kjac 0dfa8edc95 Merge remote-tracking branch 'refs/remotes/imulus/master' 2016-03-20 12:03:54 +01:00
kjac 0584c4eda5 Prototype (work in progress) 2016-03-20 12:02:21 +01:00
kgiszewski 4eb901fbba Fix #318 2016-03-15 10:04:59 -04:00
Greg Fyans b7875dd850 Added native label for RJP.MultiUrlPicker data type 2016-03-15 10:28:14 +00:00
Kevin Giszewski 19989e556e Update README.md 2016-03-10 12:10:30 -05:00
Kevin Giszewski 9250d66953 Update README.md 2016-03-10 12:07:53 -05:00
kgiszewski fa0b1a4b3b Add a ref required 2016-03-10 11:27:44 -05:00
kgiszewski 73e875e67c Merge branch 'master' into pr/330 2016-03-10 11:19:05 -05:00
kgiszewski e061311689 Add overloads for single partial render and cleanup stuffs 2016-03-10 11:16:27 -05:00
kjac b36f83eaf6 Merge remote-tracking branch 'refs/remotes/imulus/master' 2016-03-05 21:14:47 +01:00
Jamie Gilbert d63f7a6a34 updated angular controller to find view when umbraco is in virtual directory (using relative path) 2016-02-24 17:00:32 +00:00
leekelleher 68c2f55111 Added support to ArchetypePublishedContent for Umbraco extension methods
For the `IPublishedContent` implementation, added support for `GetIndex()`, so that extension methods, such as `IsFirst()`, `IsLast()`, etc will work as expected.

Unfortunately we wont be able to support the `Siblings()`, (or `FollowingSibling`, `PrecedingSibling`) extension methods, as these perform an internal query to the node's parent's children - which in the context of Archetype data is not possible access.

Added unit-tests to support this enhancement.
2016-02-17 13:30:43 +00:00
Jamie Gilbert f22d3cdef3 Modified HTML helper to allow you to render a single fieldset from an Archtype model.
(I Needed to render the first review in a list of review blocks)
2016-02-05 14:33:02 +00:00
kgiszewski 13b59d0d61 Bump version to v1.12.3 2016-02-04 11:20:44 -05:00
kjac 188c09d3c1 Fix issue #323
Made the config dialogs do "live editing" instead of working on a copy
of the config model.
2016-01-23 14:56:28 +01:00
kjac 6d8770907c Fix path to courier project
The gruntfile had a wrong path to the Courier project, which messed up
the grunt setup.
2016-01-23 14:55:11 +01:00
kjac efbed9606d Merge remote-tracking branch 'refs/remotes/imulus/master' 2016-01-23 10:31:06 +01:00
leekelleher c862ecc36f Fixes #319 - Grunt/MSBuild
Sets the MSBuild project config from "Debug" to "Release".
2016-01-13 12:26:19 +00:00
bjarnef 523630416f Correct for attribute to match id of input
... futhermore add title tooltip with value of property alias like in
Umbraco core.
2016-01-05 22:19:08 +01:00
kgiszewski 990836bc37 Fix #315 2016-01-05 08:39:09 -05:00
kgiszewski bb194fff76 Fix #314 2016-01-05 08:35:35 -05:00
kgiszewski 16351df692 Fix #312 2016-01-04 15:02:02 -05:00
kgiszewski 213d3940ca Merge branch 'pr/310' 2015-12-15 11:26:52 -05:00
kgiszewski 8dfe1f3ca4 Keepin it DRY 2015-12-15 11:26:40 -05:00
kgiszewski 3291998171 Merge branch 'master' into pr/308 2015-12-15 11:04:18 -05:00
kgiszewski e640a9b4f4 This depends on a core PR. 2015-12-14 09:53:01 -05:00
Martin Abrahams 7df4d4cfcd Fix for issue #258, same issue as fileupload datatype, need to add empty validation property 2015-12-10 16:03:14 +11:00
kgiszewski bb056a01dd Update dll to v1.12.1 2015-12-03 08:44:40 -05:00
kgiszewski 608b12aa10 Revert "Fix #304"
This reverts commit f4e449f030.

Conflicts:
	app/Umbraco/Umbraco.Archetype/Models/ArchetypeModel.cs
2015-12-03 08:43:23 -05:00
kjac 6494327c77 Merge remote-tracking branch 'refs/remotes/imulus/master' 2015-11-29 17:04:39 +01:00
Tom Fulton 293aa7f6f3 Update grunt-umbraco-package to v1.0 2015-11-24 21:54:01 -08:00
kgiszewski 7e76e98c0f Bump version to 1.12.0 2015-11-16 13:25:54 -05:00
kgiszewski f4e449f030 Fix #304 2015-11-16 13:24:36 -05:00
kgiszewski 1e97caa7e8 Merge branch 'pr/303' 2015-11-16 12:50:11 -05:00
leekelleher b0dcefaf06 Refactored the PublishedContent/Property classes.
Streamlines how the properties are stored and retrieved internally, (dictionary is faster than linq loops).
Removed the `Initialize` method, as we can do the set-up within the constructor.
2015-11-05 11:58:45 +00:00
kgiszewski 716972bc17 Merge branch 'pr/301' 2015-11-04 15:34:11 -05:00
leekelleher 4d4eab39e8 ArchetypeModel to IPublishedContent
Adds extension methods for `ArchetypeModel` and `ArchetypeFieldsetModel` for converting to Umbraco's `IPublishedContent`.
Included unit-tests to support the deserialization and verify property-value retrieval.

Modifies `ArchetypePropertyModelExtensions.CreateDummyPropertyType` extension method, to test if the `PropertyValueConvertersResolver` is available, (otherwise the unit-tests throw an exception from Umbraco's `PublishedPropertyType`).
2015-11-04 15:43:39 +00:00
kgiszewski 6acaf65ec3 Add missing XML docs. 2015-11-02 11:35:37 -05:00
kgiszewski a2b2567350 Fix unit tests. 2015-11-02 10:55:02 -05:00
Mark f5f4e80800 Added "lazy loading" for fieldset properties
I've had a big performance problem when loading big child archetypes in
an archetype, by adding a ng-if the digest cycle isn't called directly
when loading the directive
2015-10-26 10:52:27 +01:00
Mark b42695bd0d Merge remote-tracking branch 'imulus/master' 2015-10-26 10:46:19 +01:00
kgiszewski f405239115 Fixed goofed up packages, bump to v1.11.1 2015-10-08 13:42:19 -04:00
62 changed files with 2064 additions and 727 deletions
+69 -34
View File
@@ -18,8 +18,7 @@ module.exports = function(grunt) {
"app/views/archetype.config.fieldset.dialog_versioned.html": "app/views/archetype.config.fieldset.dialog.html",
"app/views/archetype.config_versioned.html": "app/views/archetype.config.html",
"app/views/archetype_versioned.html": "app/views/archetype.html",
"app/views/archetype.default_versioned.html": "app/views/archetype.default.html",
"app/views/archetype.default_versioned.html": "app/views/archetype.default.html"
},
options: {
replacements: [{
@@ -126,7 +125,7 @@ module.exports = function(grunt) {
expand: true
},
dll: {
cwd: 'app/Umbraco/Umbraco.Archetype/bin/Debug/',
cwd: 'app/Umbraco/Umbraco.Archetype/bin/Release/',
src: 'Archetype.dll',
dest: '<%= dest %>/bin/',
expand: true
@@ -152,7 +151,13 @@ module.exports = function(grunt) {
{
cwd: '<%= dest %>/bin',
src: ['*.dll'],
dest: 'tmp/nuget/lib/net40',
dest: 'tmp/nuget_binaries/lib/net40',
expand: true
},
{
cwd: 'app/Umbraco/Archetype.Courier/bin/Release/',
src: ['Archetype.Courier.dll'],
dest: 'tmp/nuget_courier/lib/net40',
expand: true
}
]
@@ -169,6 +174,14 @@ module.exports = function(grunt) {
dist: {
src: 'tmp/nuget/package.nuspec',
dest: 'pkg'
},
dist_binaries: {
src: 'tmp/nuget_binaries/package_binaries.nuspec',
dest: 'pkg'
},
dist_courier: {
src: 'tmp/nuget_courier/package_courier.nuspec',
dest: 'pkg'
}
},
@@ -182,29 +195,61 @@ module.exports = function(grunt) {
license: '<%= pkgMeta.license %>',
licenseUrl: '<%= pkgMeta.licenseUrl %>',
author: '<%= pkgMeta.author %>',
authorUrl: '<%= pkgMeta.authorUrl %>',
files: [{ path: 'tmp/nuget/**', target: 'content/App_Plugins/Archetype'}]
authorUrl: '<%= pkgMeta.authorUrl %>'
}
},
'files': {
'tmp/nuget/package.nuspec': ['config/package.nuspec']
}
},
'nuspec_binaries': {
'options': {
'data': {
name: '<%= pkgMeta.name %>.Binaries',
version: '<%= pkgMeta.version %>',
url: '<%= pkgMeta.url %>',
license: '<%= pkgMeta.license %>',
licenseUrl: '<%= pkgMeta.licenseUrl %>',
author: '<%= pkgMeta.author %>',
authorUrl: '<%= pkgMeta.authorUrl %>'
}
},
'files': {
'tmp/nuget_binaries/package_binaries.nuspec': ['config/package_binaries.nuspec']
}
},
'nuspec_courier': {
'options': {
'data': {
name: '<%= pkgMeta.name %>.Courier',
version: '<%= pkgMeta.version %>',
url: '<%= pkgMeta.url %>',
license: '<%= pkgMeta.license %>',
licenseUrl: '<%= pkgMeta.licenseUrl %>',
author: '<%= pkgMeta.author %>',
authorUrl: '<%= pkgMeta.authorUrl %>'
}
},
'files': {
'tmp/nuget_courier/package_courier.nuspec': ['config/package_courier.nuspec']
}
}
},
umbracoPackage: {
options: {
name: "<%= pkgMeta.name %>",
version: '<%= pkgMeta.version %>',
url: '<%= pkgMeta.url %>',
license: '<%= pkgMeta.license %>',
licenseUrl: '<%= pkgMeta.licenseUrl %>',
author: '<%= pkgMeta.author %>',
authorUrl: '<%= pkgMeta.authorUrl %>',
manifest: 'config/package.xml',
readme: 'config/readme.txt',
sourceDir: 'tmp/umbraco',
outputDir: 'pkg',
dist: {
src: 'tmp/umbraco',
dest: 'pkg',
options: {
name: "<%= pkgMeta.name %>",
version: '<%= pkgMeta.version %>',
url: '<%= pkgMeta.url %>',
license: '<%= pkgMeta.license %>',
licenseUrl: '<%= pkgMeta.licenseUrl %>',
author: '<%= pkgMeta.author %>',
authorUrl: '<%= pkgMeta.authorUrl %>',
readme: '<%= grunt.file.read("config/readme.txt") %>'
}
}
},
@@ -234,7 +279,7 @@ module.exports = function(grunt) {
assemblyinfo: {
options: {
files: ['app/Umbraco/Umbraco.Archetype/Archetype.Umbraco.csproj', 'app/Umbraco/Umbraco.Archetype/Archetype.Courier.csproj'],
files: ['app/Umbraco/Umbraco.Archetype/Archetype.Umbraco.csproj', 'app/Umbraco/Archetype.Courier/Archetype.Courier.csproj'],
filename: 'VersionInfo.cs',
info: {
version: '<%= (pkgMeta.version.indexOf("-") > 0 ? pkgMeta.version.substring(0, pkgMeta.version.indexOf("-")) : pkgMeta.version) %>',
@@ -248,15 +293,6 @@ module.exports = function(grunt) {
src: ['<%= grunt.option("target") %>\\Web.config']
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
src: {
src: ['app/**/*.js', 'lib/**/*.js']
}
},
msbuild: {
options: {
@@ -272,16 +308,15 @@ module.exports = function(grunt) {
dist: {
src: ['app/Umbraco/Umbraco.Archetype/Archetype.Umbraco.csproj','app/Umbraco/Archetype.Courier/Archetype.Courier.csproj'],
options: {
projectConfiguration: 'Debug',
projectConfiguration: 'Release',
targets: ['Clean', 'Rebuild'],
}
}
}
});
grunt.registerTask('default', ['clean', 'string-replace', 'less', 'concat', 'assemblyinfo', 'msbuild:dist', 'copy:dll', 'copy:assets', 'copy:config', 'clean:html', 'clean:js', 'clean:less']);
grunt.registerTask('nuget', ['clean:tmp', 'default', 'copy:nuget', 'template:nuspec', 'nugetpack', 'clean:tmp']);
grunt.registerTask('umbraco', ['clean:tmp', 'default', 'copy:umbraco', 'umbracoPackage', 'clean:tmp']);
grunt.registerTask('package', ['clean:tmp', 'default', 'copy:nuget', 'template:nuspec', 'nugetpack', 'copy:umbraco', 'umbracoPackage', 'clean:tmp']);
grunt.registerTask('default', ['clean', 'string-replace', 'less', 'concat', 'assemblyinfo', 'msbuild:dist', 'copy:dll', 'copy:assets', 'copy:html', 'copy:config', 'clean:html', 'clean:js', 'clean:less']);
grunt.registerTask('nuget', ['copy:nuget', 'template:nuspec', 'template:nuspec_binaries', 'template:nuspec_courier', 'nugetpack']);
grunt.registerTask('umbraco', ['copy:umbraco', 'umbracoPackage']);
grunt.registerTask('package', ['clean:tmp', 'default', 'nuget', 'copy:umbraco', 'umbracoPackage', 'clean:tmp']);
};
+9 -1
View File
@@ -7,12 +7,20 @@ Archetype
## Installation
Install the selected <a href='https://github.com/imulus/Archetype/releases'>release</a> through the Umbraco package installer or via <a href='http://www.nuget.org/packages/Archetype/'>NuGet</a>.
## Official Docs ##
https://github.com/kgiszewski/ArchetypeManual
##News and Updates##
Follow us on Twitter https://twitter.com/ArchetypeKit
##Core Team##
* Kevin Giszewski (founder/project lead) - University of Notre Dame - https://kevin.giszewski.com/
* Tom Fulton (founder) - Tonic - http://hellotonic.com/
* Lee Kelleher - Umbrella - http://www.umbrellainc.co.uk/
* Matt Brailsford - The Outfield - http://www.theoutfield.co.uk/
* Kenn Jacobsen - Vertica - http://kennjacobsen.dk/
## Contribute ##
Want to contribute to Archetype? You'll want to use Grunt (our task runner) to help you integrate with a local copy of Umbraco.
@@ -13,6 +13,9 @@ using Umbraco.Courier.ItemProviders;
namespace Archetype.Courier.DataResolvers
{
/// <summary>
/// Lee Kelleher's implementation of Courier's PropertyDataResolverProvider for Archetype.
/// </summary>
public class ArchetypeDataResolver : PropertyDataResolverProvider
{
private enum Direction
@@ -21,6 +24,12 @@ namespace Archetype.Courier.DataResolvers
Packaging
}
/// <summary>
/// Gets the editor alias.
/// </summary>
/// <value>
/// The editor alias.
/// </value>
public override string EditorAlias
{
get
@@ -29,26 +38,48 @@ namespace Archetype.Courier.DataResolvers
}
}
/// <summary>
/// Extractings the type of the data.
/// </summary>
/// <param name="item">The item.</param>
public override void ExtractingDataType(DataType item)
{
// No longer need to extract the DataType (int) Ids as Archetype now references the Guid [LK]
}
/// <summary>
/// Extractings the property.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="propertyData">The property data.</param>
public override void ExtractingProperty(Item item, ContentProperty propertyData)
{
ReplacePropertyDataIds(item, propertyData, Direction.Extracting);
}
/// <summary>
/// Packagings the type of the data.
/// </summary>
/// <param name="item">The item.</param>
public override void PackagingDataType(DataType item)
{
AddDataTypeDependencies(item);
}
/// <summary>
/// Packages the property.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="propertyData">The property data.</param>
public override void PackagingProperty(Item item, ContentProperty propertyData)
{
ReplacePropertyDataIds(item, propertyData, Direction.Packaging);
}
/// <summary>
/// Adds the datatype dependencies.
/// </summary>
/// <param name="item">The item.</param>
private void AddDataTypeDependencies(DataType item)
{
if (item.Prevalues != null && item.Prevalues.Count > 0)
@@ -71,6 +102,12 @@ namespace Archetype.Courier.DataResolvers
}
}
/// <summary>
/// Replaces the property data Ids.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="propertyData">The property data.</param>
/// <param name="direction">The direction.</param>
private void ReplacePropertyDataIds(Item item, ContentProperty propertyData, Direction direction)
{
if (propertyData != null && propertyData.Value != null)
@@ -168,6 +205,10 @@ namespace Archetype.Courier.DataResolvers
}
}
/// <summary>
/// Retrieves the additional properties.
/// </summary>
/// <param name="preValue">The pre value.</param>
private void RetrieveAdditionalProperties(ref ArchetypePreValue preValue)
{
if (preValue == null)
@@ -189,6 +230,11 @@ namespace Archetype.Courier.DataResolvers
}
}
/// <summary>
/// Retrieves the additional properties.
/// </summary>
/// <param name="archetype">The archetype.</param>
/// <param name="preValue">The pre value.</param>
private void RetrieveAdditionalProperties(ref ArchetypeModel archetype, ArchetypePreValue preValue)
{
foreach (var fieldset in preValue.Fieldsets)
@@ -33,167 +33,168 @@
<ItemGroup>
<Reference Include="AutoMapper">
<HintPath>..\packages\AutoMapper.3.0.0\lib\net40\AutoMapper.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="AutoMapper.Net4">
<HintPath>..\packages\AutoMapper.3.0.0\lib\net40\AutoMapper.Net4.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="businesslogic, Version=1.0.5242.22740, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\businesslogic.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="ClientDependency.Core">
<HintPath>..\packages\ClientDependency.1.7.1.2\lib\ClientDependency.Core.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="ClientDependency.Core.Mvc">
<HintPath>..\packages\ClientDependency-Mvc.1.7.0.4\lib\ClientDependency.Core.Mvc.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="cms, Version=1.0.5242.22741, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\cms.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="controls, Version=1.0.5242.22742, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\controls.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="CookComputing.XmlRpcV2">
<HintPath>..\packages\xmlrpcnet.2.5.0\lib\net20\CookComputing.XmlRpcV2.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="Examine, Version=0.1.55.2941, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\Examine.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="HtmlAgilityPack">
<HintPath>..\packages\HtmlAgilityPack.1.4.6\lib\Net45\HtmlAgilityPack.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="ImageProcessor, Version=1.9.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\ImageProcessor.1.9.0.0\lib\ImageProcessor.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="ImageProcessor.Web, Version=3.2.3.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\ImageProcessor.Web.3.2.3.0\lib\net45\ImageProcessor.Web.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="interfaces, Version=1.0.5242.22737, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\interfaces.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="log4net, Version=1.2.11.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\log4net.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="Lucene.Net">
<HintPath>..\packages\Lucene.Net.2.9.4.1\lib\net40\Lucene.Net.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.ApplicationBlocks.Data, Version=1.0.1559.20655, Culture=neutral">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\Microsoft.ApplicationBlocks.Data.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\Microsoft.Web.Helpers.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<Private>True</Private>
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.Mvc.FixedDisplayModes">
<HintPath>..\packages\Microsoft.AspNet.Mvc.FixedDisplayModes.1.0.1\lib\net40\Microsoft.Web.Mvc.FixedDisplayModes.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="MiniProfiler">
<HintPath>..\packages\MiniProfiler.2.1.0\lib\net40\MiniProfiler.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="Moq">
<HintPath>..\packages\Moq.4.2.1312.1622\lib\net40\Moq.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="MySql.Data">
<HintPath>..\packages\MySql.Data.6.6.5\lib\net40\MySql.Data.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.6.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
<Private>False</Private>
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SQLCE4Umbraco, Version=1.0.5242.22741, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\SQLCE4Umbraco.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<Private>False</Private>
<Private>True</Private>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\System.Data.SqlServerCe.dll</HintPath>
</Reference>
<Reference Include="System.Data.SqlServerCe.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<Private>False</Private>
<Private>True</Private>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\System.Data.SqlServerCe.Entity.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<Private>True</Private>
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.4.0.30506.0\lib\net40\System.Web.Http.WebHost.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<Private>True</Private>
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.AspNet.Razor.2.0.30506.0\lib\net40\System.Web.Razor.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<Private>True</Private>
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<Private>True</Private>
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<Private>True</Private>
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
@@ -204,63 +205,64 @@
<Reference Include="TidyNet, Version=1.0.0.0, Culture=neutral">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\TidyNet.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="umbraco, Version=1.0.5242.22743, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\umbraco.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="Umbraco.Core, Version=1.0.5242.22738, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\Umbraco.Core.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="umbraco.DataLayer, Version=1.0.5242.22740, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\umbraco.DataLayer.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="umbraco.editorControls, Version=1.0.5242.22746, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\umbraco.editorControls.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="umbraco.MacroEngines, Version=1.0.5242.22747, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\umbraco.MacroEngines.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="umbraco.providers, Version=1.0.5242.22742, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\umbraco.providers.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="Umbraco.Web.UI, Version=1.0.5242.22748, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\Umbraco.Web.UI.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="umbraco.XmlSerializers, Version=1.0.5242.22743, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\umbraco.XmlSerializers.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="UmbracoExamine, Version=0.6.0.22741, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\UmbracoExamine.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="UrlRewritingNet.UrlRewriter, Version=2.0.60829.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\UrlRewritingNet.UrlRewriter.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Models\FieldsetTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="PropertyValueConverter\PropertyValueConverterTests.cs" />
<Compile Include="PublishedContent\ArchetypePublishedContentTests.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
@@ -274,7 +276,9 @@
<Private>True</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<PropertyGroup>
@@ -1,21 +1,21 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Archetype.PropertyConverters;
using NUnit.Framework;
namespace Archetype.Tests.Models
{
/// <summary>
/// Tests designed for the fieldsets.
/// </summary>
[TestFixture]
public class FieldsetTests
{
private string _sampleJson;
/// <summary>
/// Sets up the test to use sample JSON data.
/// </summary>
[SetUp]
public void SetUp()
{
@@ -1,22 +1,21 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Archetype.PropertyConverters;
using Moq;
using NUnit.Framework;
using Umbraco.Core.Models.PublishedContent;
namespace Archetype.Tests.PropertyValueConverter
{
/// <summary>
/// Tests designed to test the PVC.
/// </summary>
[TestFixture]
public class PropertyValueConverterTests
{
private string _sampleJson;
/// <summary>
/// Sets up the test to use JSON data.
/// </summary>
[SetUp]
public void SetUp()
{
@@ -0,0 +1,156 @@
using System;
using System.Linq;
using Archetype.Extensions;
using Archetype.Models;
using Archetype.PropertyConverters;
using NUnit.Framework;
using Umbraco.Core.Models;
using Umbraco.Web;
namespace Archetype.Tests.PublishedContent
{
[TestFixture]
public class ArchetypePublishedContentTests
{
private ArchetypeModel _archetype;
[TestFixtureSetUp]
public void Init()
{
var archetypeJson = System.IO.File.ReadAllText("..\\..\\Data\\sample-1.json");
var converter = new ArchetypeValueConverter();
_archetype = (ArchetypeModel)converter.ConvertDataToSource(null, archetypeJson, false);
}
[Test]
public void ArchetypeModel_Initialized()
{
Assert.IsNotNull(_archetype);
Assert.IsNotEmpty(_archetype.Fieldsets);
}
[Test]
public void ArchetypeModel_To_PublishedContentSet()
{
var contentSet = _archetype.ToPublishedContentSet();
Assert.That(contentSet, Is.Not.Null);
Assert.That(contentSet, Is.Not.Empty);
Assert.That(contentSet, Is.All.InstanceOf<IPublishedContent>());
}
[Test]
public void ArchetypeFieldsetModel_To_PublishedContent()
{
var fieldset = _archetype.Fieldsets.FirstOrDefault();
var content = fieldset.ToPublishedContent();
Assert.That(content, Is.Not.Null);
Assert.That(content, Is.InstanceOf<IPublishedContent>());
Assert.That(content.Properties, Is.Not.Empty);
Assert.That(content.Properties, Is.All.InstanceOf<IPublishedProperty>());
}
[TestCase("boxHeadline", "Box 1 Title")]
[TestCase("link", "3175")]
[TestCase("link", 3175)]
[TestCase("show", "1")]
[TestCase("show", true)]
[TestCase("show", 1)]
public void ArchetypePublishedContent_Typed_Properties<T>(string propertyAlias, T expected)
{
var fieldset = _archetype.Fieldsets.FirstOrDefault();
var content = fieldset.ToPublishedContent();
var actual = content.GetPropertyValue<T>(propertyAlias);
Assert.AreEqual(actual, expected);
}
[Test]
public void Null_ArchetypeModel_Throws_Exception()
{
TestDelegate code = () =>
{
ArchetypeModel archetype = null;
archetype.ToPublishedContentSet();
};
Assert.Throws<ArgumentNullException>(code);
}
[Test]
public void Null_ArchetypeFieldsetModel_Throws_Exception()
{
TestDelegate code = () =>
{
ArchetypeFieldsetModel fieldset = null;
fieldset.ToPublishedContent();
};
Assert.Throws<ArgumentNullException>(code);
}
[Test]
public void ArchetypePublishedContent_GetIndex()
{
var contentSet = _archetype.ToPublishedContentSet();
var i = 0;
foreach (var content in contentSet)
{
Assert.AreEqual(content.GetIndex(), i);
i++;
}
}
[Test]
public void ArchetypePublishedContentSet_IsFirstIsLast()
{
var contentSet = _archetype.ToPublishedContentSet();
foreach (var content in contentSet)
{
var value = content.GetPropertyValue<string>("boxHeadline");
Assert.That(value == "Box 1 Title", Is.EqualTo(content.IsFirst()));
Assert.That(value == "Another Box", Is.EqualTo(content.IsLast()));
}
}
[Test]
public void ArchetypePublishedContentSet_PreviousNext()
{
var contentSet = _archetype.ToPublishedContentSet();
var list = contentSet.ToList();
Assert.That(list.Count, Is.EqualTo(2));
var first = list[0];
var last = list[1];
var next = first.Next();
Assert.AreEqual(next, last);
var prev = last.Previous();
Assert.AreEqual(prev, first);
}
[Test, ExpectedException(typeof(NullReferenceException))]
public void ArchetypePublishedContentSet_Siblings()
{
var contentSet = _archetype.ToPublishedContentSet();
var content = contentSet.FirstOrDefault();
var siblings = content.Siblings();
Assert.That(siblings, Is.Not.Null);
var following = content.FollowingSibling();
Assert.That(following, Is.Not.Null);
var preceding = content.PrecedingSibling();
Assert.That(preceding, Is.Not.Null);
}
}
}
+1 -1
View File
@@ -21,7 +21,7 @@
<package id="Moq" version="4.2.1312.1622" targetFramework="net45" />
<package id="MySql.Data" version="6.6.5" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.2" targetFramework="net45" />
<package id="NUnit" version="2.6.3" targetFramework="net45" />
<package id="NUnit" version="2.6.4" targetFramework="net45" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net45" />
<package id="UmbracoCms.Core" version="7.1.2" targetFramework="net45" />
<package id="xmlrpcnet" version="2.5.0" targetFramework="net45" />
-49
View File
@@ -1,49 +0,0 @@
using System;
using Umbraco.Core;
using Umbraco.Core.Logging;
namespace DatabaseSizer
{
public class Application : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
base.ApplicationStarted(umbracoApplication, applicationContext);
ExpandPrevalueValueColumnSize();
}
protected void ExpandPrevalueValueColumnSize()
{
try
{
var dbContext = ApplicationContext.Current.DatabaseContext;
var colCount =
dbContext.Database.ExecuteScalar<int>(
"SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE DATA_TYPE = 'nvarchar' AND COLUMN_NAME = 'value' AND CHARACTER_MAXIMUM_LENGTH = 2500 AND TABLE_NAME = 'cmsDataTypePreValues'");
// Check column
if (colCount != 0)
{
using (var trans = dbContext.Database.GetTransaction())
{
// Change column
dbContext.Database.Execute("ALTER TABLE [cmsDataTypePreValues] ALTER COLUMN [value] ntext NULL;");
trans.Complete();
}
LogHelper.Debug(typeof(Application), "Successfully expanded Prevalue table Value column");
}
else
{
LogHelper.Debug(typeof(Application), "Prevalue table Value column is already expanded");
}
}
catch (Exception ex)
{
LogHelper.Error(typeof(Application), "Error expanding Prevalue table Value column", ex);
}
}
}
}
@@ -1,250 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{0114C963-C514-49C1-B7AB-DCB1825F498C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DatabaseSizer</RootNamespace>
<AssemblyName>DatabaseSizer</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoMapper">
<HintPath>..\packages\AutoMapper.3.0.0\lib\net40\AutoMapper.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="AutoMapper.Net4">
<HintPath>..\packages\AutoMapper.3.0.0\lib\net40\AutoMapper.Net4.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="businesslogic">
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\businesslogic.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ClientDependency.Core">
<HintPath>..\packages\ClientDependency.1.7.1.2\lib\ClientDependency.Core.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ClientDependency.Core.Mvc">
<HintPath>..\packages\ClientDependency-Mvc.1.7.0.4\lib\ClientDependency.Core.Mvc.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="cms">
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\cms.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="controls">
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\controls.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="CookComputing.XmlRpcV2">
<HintPath>..\packages\xmlrpcnet.2.5.0\lib\net20\CookComputing.XmlRpcV2.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Examine">
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\Examine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="HtmlAgilityPack">
<HintPath>..\packages\HtmlAgilityPack.1.4.6\lib\Net45\HtmlAgilityPack.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ImageProcessor">
<HintPath>..\packages\ImageProcessor.1.9.0.0\lib\ImageProcessor.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ImageProcessor.Web">
<HintPath>..\packages\ImageProcessor.Web.3.2.3.0\lib\net45\ImageProcessor.Web.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="interfaces">
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\interfaces.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="log4net">
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\log4net.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Lucene.Net">
<HintPath>..\packages\Lucene.Net.2.9.4.1\lib\net40\Lucene.Net.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.ApplicationBlocks.Data">
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\Microsoft.ApplicationBlocks.Data.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Web.Helpers">
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\Microsoft.Web.Helpers.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.Mvc.FixedDisplayModes">
<HintPath>..\packages\Microsoft.AspNet.Mvc.FixedDisplayModes.1.0.0\lib\net40\Microsoft.Web.Mvc.FixedDisplayModes.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="MiniProfiler">
<HintPath>..\packages\MiniProfiler.2.1.0\lib\net40\MiniProfiler.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="MySql.Data">
<HintPath>..\packages\MySql.Data.6.6.5\lib\net40\MySql.Data.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.6.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="SQLCE4Umbraco">
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\SQLCE4Umbraco.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<Private>False</Private>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\System.Data.SqlServerCe.dll</HintPath>
</Reference>
<Reference Include="System.Data.SqlServerCe.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<Private>False</Private>
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\System.Data.SqlServerCe.Entity.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.4.0.20710.0\lib\net40\System.Web.Http.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.4.0.20710.0\lib\net40\System.Web.Http.WebHost.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.20710.0\lib\net40\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<HintPath>..\packages\Microsoft.AspNet.Razor.2.0.20710.0\lib\net40\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="TidyNet">
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\TidyNet.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="umbraco">
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\umbraco.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Umbraco.Core">
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\Umbraco.Core.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="umbraco.DataLayer">
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\umbraco.DataLayer.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="umbraco.editorControls">
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\umbraco.editorControls.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="umbraco.MacroEngines">
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\umbraco.MacroEngines.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="umbraco.providers">
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\umbraco.providers.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Umbraco.Web.UI">
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\Umbraco.Web.UI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="umbraco.XmlSerializers">
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\umbraco.XmlSerializers.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UmbracoExamine">
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\UmbracoExamine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UrlRewritingNet.UrlRewriter">
<HintPath>..\packages\UmbracoCms.Core.7.1.2\lib\UrlRewritingNet.UrlRewriter.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Application.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DatabaseSizer.cs")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DatabaseSizer.cs")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("28dc35d2-3dfb-40b4-9093-bc47c91127ea")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
-27
View File
@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
-25
View File
@@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AutoMapper" version="3.0.0" targetFramework="net45" />
<package id="ClientDependency" version="1.7.1.2" targetFramework="net45" />
<package id="ClientDependency-Mvc" version="1.7.0.4" targetFramework="net45" />
<package id="HtmlAgilityPack" version="1.4.6" targetFramework="net45" />
<package id="ImageProcessor" version="1.9.0.0" targetFramework="net45" />
<package id="ImageProcessor.Web" version="3.2.3.0" targetFramework="net45" />
<package id="Lucene.Net" version="2.9.4.1" targetFramework="net45" />
<package id="Microsoft.AspNet.Mvc" version="4.0.20710.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Mvc.FixedDisplayModes" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor" version="2.0.20710.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi" version="4.0.30506.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Core" version="4.0.20710.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="4.0.20710.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="2.0.20710.0" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
<package id="MiniProfiler" version="2.1.0" targetFramework="net45" />
<package id="MySql.Data" version="6.6.5" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.2" targetFramework="net45" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net45" />
<package id="UmbracoCms.Core" version="7.1.2" targetFramework="net45" />
<package id="xmlrpcnet" version="2.5.0" targetFramework="net45" />
</packages>
+3 -7
View File
@@ -1,6 +1,8 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Archetype.Umbraco", "Umbraco.Archetype\Archetype.Umbraco.csproj", "{7D185D41-4228-4978-ACB8-83F9A48AD94F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{D84AA4ED-85A6-484F-9E72-BE7AC9835821}"
@@ -12,8 +14,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{D84AA4
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Archetype.Tests", "Archetype.Tests\Archetype.Tests.csproj", "{21F3E6CF-B76F-4059-9474-1AF1CE63CD6B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DatabaseSizer", "DatabaseSizer\DatabaseSizer.csproj", "{0114C963-C514-49C1-B7AB-DCB1825F498C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Archetype.Courier", "Archetype.Courier\Archetype.Courier.csproj", "{FE8BE437-8B11-4E49-9B02-F45994E6D723}"
EndProject
Global
@@ -30,10 +30,6 @@ Global
{21F3E6CF-B76F-4059-9474-1AF1CE63CD6B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{21F3E6CF-B76F-4059-9474-1AF1CE63CD6B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{21F3E6CF-B76F-4059-9474-1AF1CE63CD6B}.Release|Any CPU.Build.0 = Release|Any CPU
{0114C963-C514-49C1-B7AB-DCB1825F498C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0114C963-C514-49C1-B7AB-DCB1825F498C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0114C963-C514-49C1-B7AB-DCB1825F498C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0114C963-C514-49C1-B7AB-DCB1825F498C}.Release|Any CPU.Build.0 = Release|Any CPU
{FE8BE437-8B11-4E49-9B02-F45994E6D723}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FE8BE437-8B11-4E49-9B02-F45994E6D723}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE8BE437-8B11-4E49-9B02-F45994E6D723}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -14,10 +14,12 @@ using Archetype.Extensions;
namespace Archetype.Api
{
/// <summary>
/// Controller that handles datatype related interactions.
/// </summary>
[PluginController("ArchetypeApi")]
public class ArchetypeDataTypeController : UmbracoAuthorizedJsonController
{
public IEnumerable<object> GetAllPropertyEditors()
{
return
@@ -25,12 +27,22 @@ namespace Archetype.Api
.Select(x => new {defaultPreValues = x.DefaultPreValuesForArchetype(), alias = x.Alias, view = x.ValueEditor.View});
}
/// <summary>
/// Gets all datatypes.
/// </summary>
/// <returns></returns>
public object GetAll()
{
var dataTypes = Services.DataTypeService.GetAllDataTypeDefinitions();
return dataTypes.Select(t => new { guid = t.Key, name = t.Name });
}
/// <summary>
/// Gets the datatype by GUID.
/// </summary>
/// <param name="guid">The unique identifier.</param>
/// <returns></returns>
/// <exception cref="System.Web.Http.HttpResponseException"></exception>
public object GetByGuid(Guid guid)
{
var dataType = Services.DataTypeService.GetDataTypeDefinitionById(guid);
@@ -43,6 +55,16 @@ namespace Archetype.Api
return new { selectedEditor = dataTypeDisplay.SelectedEditor, preValues = dataTypeDisplay.PreValues };
}
/// <summary>
/// Gets the datatype by GUID.
/// </summary>
/// <param name="guid">The unique identifier.</param>
/// <param name="contentTypeAlias">The content type alias.</param>
/// <param name="propertyTypeAlias">The property type alias.</param>
/// <param name="archetypeAlias">The archetype alias.</param>
/// <param name="nodeId">The node identifier.</param>
/// <returns></returns>
/// <exception cref="System.Web.Http.HttpResponseException"></exception>
public object GetByGuid(Guid guid, string contentTypeAlias, string propertyTypeAlias, string archetypeAlias, int nodeId)
{
var dataType = Services.DataTypeService.GetDataTypeDefinitionById(guid);
@@ -54,11 +76,19 @@ namespace Archetype.Api
return new { selectedEditor = dataTypeDisplay.SelectedEditor, preValues = dataTypeDisplay.PreValues, contentTypeAlias = contentTypeAlias, propertyTypeAlias = propertyTypeAlias, archetypeAlias = archetypeAlias, nodeId = nodeId };
}
/// <summary>
/// Returns the DLL version from the file.
/// </summary>
/// <returns></returns>
public object GetDllVersion()
{
return new {dllVersion = _version()};
}
/// <summary>
/// Gets the DLL version from the file.
/// </summary>
/// <returns></returns>
private string _version()
{
var asm = Assembly.GetExecutingAssembly();
@@ -231,7 +231,9 @@
<Compile Include="Api\ArchetypeDataTypeController.cs" />
<Compile Include="Constants.cs" />
<Compile Include="Events\ExpireCache.cs" />
<Compile Include="Extensions\ArchetypeFieldsetModelExtensions.cs" />
<Compile Include="Extensions\ArchetypeHelper.cs" />
<Compile Include="Extensions\ArchetypeModelExtensions.cs" />
<Compile Include="Extensions\HtmlHelperExtensions.cs" />
<Compile Include="Extensions\ArchetypePropertyModelExtensions.cs" />
<Compile Include="Extensions\PropertyEditorExtensions.cs" />
@@ -243,6 +245,9 @@
<Compile Include="Models\ArchetypePreValueProperty.cs" />
<Compile Include="Models\ArchetypeFieldsetModel.cs" />
<Compile Include="Models\ArchetypePropertyModel.cs" />
<Compile Include="Models\ArchetypePublishedContent.cs" />
<Compile Include="Models\ArchetypePublishedContentSet.cs" />
<Compile Include="Models\ArchetypePublishedProperty.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\VersionInfo.cs" />
<Compile Include="PropertyConverters\ArchetypeValueConverter.cs" />
@@ -1,5 +1,8 @@
namespace Archetype
{
/// <summary>
/// Archetype constants.
/// </summary>
public static class Constants
{
public const string PropertyEditorAlias = "Imulus.Archetype";
@@ -1,18 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Umbraco.Core;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Services;
using Umbraco.Web;
namespace Archetype.Events
{
public class ExpireCache : ApplicationEventHandler
{
/// <summary>
/// Registers our ExpirePreValueCache handler on app starting.
/// </summary>
/// <param name="umbracoApplication"></param>
/// <param name="applicationContext"></param>
protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
base.ApplicationStarting(umbracoApplication, applicationContext);
@@ -20,6 +18,11 @@ namespace Archetype.Events
DataTypeService.Saved += ExpirePreValueCache;
}
/// <summary>
/// Expires the pre value cache when a datatype is saved.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="Umbraco.Core.Events.SaveEventArgs{IDataTypeDefinition}"/> instance containing the event data.</param>
void ExpirePreValueCache(IDataTypeService sender, global::Umbraco.Core.Events.SaveEventArgs<IDataTypeDefinition> e)
{
foreach (var dataType in e.SavedEntities)
@@ -0,0 +1,25 @@
using System.Linq;
using Archetype.Models;
using Umbraco.Core.Models;
namespace Archetype.Extensions
{
public static class ArchetypeFieldsetModelExtensions
{
public static IPublishedContent ToPublishedContent(this ArchetypeFieldsetModel fieldset)
{
return new ArchetypePublishedContent(fieldset);
}
public static IPublishedContent ToPublishedContent(this ArchetypeFieldsetModel fieldset, ArchetypeModel archetype)
{
var contentSet = archetype.ToPublishedContentSet();
var first = contentSet
.Cast<ArchetypePublishedContent>()
.FirstOrDefault(x => x.ArchetypeFieldset == fieldset);
return first ?? new ArchetypePublishedContent(fieldset);
}
}
}
@@ -9,6 +9,9 @@ using Umbraco.Core.Models.PublishedContent;
namespace Archetype.Extensions
{
/// <summary>
/// Helper class that handles several Archetype related interactions.
/// </summary>
public class ArchetypeHelper
{
protected JsonSerializerSettings _jsonSettings;
@@ -18,6 +21,9 @@ namespace Archetype.Extensions
internal static ArchetypeHelper Instance { get { return _instance; } }
/// <summary>
/// Initializes a new instance of the <see cref="ArchetypeHelper"/> class.
/// </summary>
internal ArchetypeHelper()
{
var dcr = new Newtonsoft.Json.Serialization.DefaultContractResolver();
@@ -27,8 +33,20 @@ namespace Archetype.Extensions
_app = ApplicationContext.Current;
}
/// <summary>
/// Gets the json serializer settings.
/// </summary>
/// <value>
/// The json serializer settings.
/// </value>
internal JsonSerializerSettings JsonSerializerSettings { get { return _jsonSettings; } }
/// <summary>
/// Deserializes the JSON to archetype.
/// </summary>
/// <param name="sourceJson">The source JSON.</param>
/// <param name="dataTypePreValues">The data type pre values.</param>
/// <returns></returns>
internal ArchetypeModel DeserializeJsonToArchetype(string sourceJson, PreValueCollection dataTypePreValues)
{
try
@@ -54,6 +72,13 @@ namespace Archetype.Extensions
}
}
/// <summary>
/// Deserializes the JSON to archetype.
/// </summary>
/// <param name="sourceJson">The source JSON.</param>
/// <param name="dataTypeId">The data type identifier.</param>
/// <param name="hostContentType">Type of the host content.</param>
/// <returns></returns>
internal ArchetypeModel DeserializeJsonToArchetype(string sourceJson, int dataTypeId, PublishedContentType hostContentType = null)
{
try
@@ -79,6 +104,11 @@ namespace Archetype.Extensions
}
}
/// <summary>
/// Determines whether datatypeId has had it's PVC overridden.
/// </summary>
/// <param name="dataTypeId">The data type identifier.</param>
/// <returns></returns>
internal bool IsPropertyValueConverterOverridden(int dataTypeId)
{
var prevalues = GetArchetypePreValueFromDataTypeId(dataTypeId);
@@ -88,6 +118,11 @@ namespace Archetype.Extensions
return prevalues.OverrideDefaultPropertyValueConverter;
}
/// <summary>
/// Gets the archetype pre value from data type identifier.
/// </summary>
/// <param name="dataTypeId">The data type identifier.</param>
/// <returns></returns>
private ArchetypePreValue GetArchetypePreValueFromDataTypeId(int dataTypeId)
{
return _app.ApplicationCache.RuntimeCache.GetCacheItem(
@@ -108,6 +143,11 @@ namespace Archetype.Extensions
}) as ArchetypePreValue;
}
/// <summary>
/// Gets the archetype pre value from pre values collection.
/// </summary>
/// <param name="dataTypePreValues">The data type pre values.</param>
/// <returns></returns>
private ArchetypePreValue GetArchetypePreValueFromPreValuesCollection(PreValueCollection dataTypePreValues)
{
var preValueAsString = dataTypePreValues.PreValuesAsDictionary.First().Value.Value;
@@ -115,6 +155,11 @@ namespace Archetype.Extensions
return preValue;
}
/// <summary>
/// Gets the data type by unique identifier.
/// </summary>
/// <param name="guid">The unique identifier.</param>
/// <returns></returns>
internal IDataTypeDefinition GetDataTypeByGuid(Guid guid)
{
return (IDataTypeDefinition)ApplicationContext.Current.ApplicationCache.RuntimeCache.GetCacheItem(
@@ -0,0 +1,14 @@
using System.Collections.Generic;
using Archetype.Models;
using Umbraco.Core.Models;
namespace Archetype.Extensions
{
public static class ArchetypeModelExtensions
{
public static IEnumerable<IPublishedContent> ToPublishedContentSet(this ArchetypeModel archetype)
{
return new ArchetypePublishedContentSet(archetype);
}
}
}
@@ -2,18 +2,37 @@ using Archetype.Models;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
namespace Archetype.Extensions
{
/// <summary>
/// ArchetypePropertyModel extensions.
/// </summary>
public static class ArchetypePropertyModelExtensions
{
/// <summary>
/// Determines whether this instance is an archetype.
/// </summary>
/// <param name="prop">The property.</param>
/// <returns></returns>
public static bool IsArchetype(this ArchetypePropertyModel prop)
{
return prop.PropertyEditorAlias.InvariantEquals(Constants.PropertyEditorAlias);
}
/// <summary>
/// Creates dummy property type.
/// </summary>
/// <param name="prop">The property.</param>
/// <returns></returns>
internal static PublishedPropertyType CreateDummyPropertyType(this ArchetypePropertyModel prop)
{
// We need to check if `PropertyValueConvertersResolver` exists,
// otherwise `PublishedPropertyType` will throw an exception outside of the Umbraco context.; e.g. unit-tests.
if (!PropertyValueConvertersResolver.HasCurrent)
return null;
return new PublishedPropertyType(prop.HostContentType, new PropertyType(new DataTypeDefinition(-1, prop.PropertyEditorAlias) { Id = prop.DataTypeId }));
}
}
@@ -7,60 +7,154 @@ using Umbraco.Core.Logging;
namespace Archetype.Extensions
{
/// <summary>
/// HtmlHelper extenions used for rendering an Archetype.
/// </summary>
public static class HtmlHelperExtensions
{
public static IHtmlString RenderArchetypePartials(this HtmlHelper htmlHelper, ArchetypeModel archetypeModel)
/// <summary>
/// Renders the partials based on the model, partial path and given viewdata dictionary.
/// </summary>
/// <param name="htmlHelper">The HTML helper.</param>
/// <param name="archetypeModel">The archetype model.</param>
/// <param name="partialPath">The partial path.</param>
/// <param name="viewDataDictionary">The view data dictionary.</param>
/// <returns></returns>
private static IHtmlString _renderPartials(this HtmlHelper htmlHelper, ArchetypeModel archetypeModel, string partialPath, ViewDataDictionary viewDataDictionary)
{
return RenderPartials(htmlHelper, archetypeModel, null, null);
var sb = new StringBuilder();
foreach (var fieldsetModel in archetypeModel)
{
sb.AppendLine(_renderPartial(htmlHelper, fieldsetModel, partialPath, viewDataDictionary).ToString());
}
return new HtmlString(sb.ToString());
}
public static IHtmlString RenderArchetypePartials(this HtmlHelper htmlHelper, ArchetypeModel archetypeModel, string partialPath)
{
return RenderPartials(htmlHelper, archetypeModel, partialPath, null);
}
public static IHtmlString RenderArchetypePartials(this HtmlHelper htmlHelper, ArchetypeModel archetypeModel, ViewDataDictionary viewDataDictionary)
{
return RenderPartials(htmlHelper, archetypeModel, null, viewDataDictionary);
}
public static IHtmlString RenderArchetypePartials(this HtmlHelper htmlHelper, ArchetypeModel archetypeModel, string partialPath, ViewDataDictionary viewDataDictionary)
{
return htmlHelper.RenderPartials(archetypeModel, partialPath, viewDataDictionary);
}
private static IHtmlString RenderPartials(this HtmlHelper htmlHelper, ArchetypeModel archetypeModel, string partialPath, ViewDataDictionary viewDataDictionary)
/// <summary>
/// Renders the fieldset partial
/// </summary>
/// <param name="htmlHelper">The HTML helper.</param>
/// <param name="fieldsetModel"></param>
/// <param name="partialPath">The partial path.</param>
/// <param name="viewDataDictionary">The view data dictionary.</param>
/// <returns></returns>
private static IHtmlString _renderPartial(HtmlHelper htmlHelper, ArchetypeFieldsetModel fieldsetModel, string partialPath, ViewDataDictionary viewDataDictionary)
{
var context = HttpContext.Current;
if (archetypeModel == null || context == null)
if (fieldsetModel == null || context == null)
{
return new HtmlString("");
}
var sb = new StringBuilder();
//default
var pathToPartials = "~/Views/Partials/Archetype/";
if (!string.IsNullOrEmpty(partialPath))
{
pathToPartials = partialPath;
}
foreach (var fieldsetModel in archetypeModel)
{
var partial = pathToPartials + fieldsetModel.Alias + ".cshtml";
var partial = string.Format("{0}{1}.cshtml", pathToPartials, fieldsetModel.Alias);
if (System.IO.File.Exists(context.Server.MapPath(partial)))
{
sb.AppendLine(htmlHelper.Partial(partial, fieldsetModel, viewDataDictionary).ToString());
}
else
{
LogHelper.Info<ArchetypeModel>(string.Format("The partial for {0} could not be found. Please create a partial with that name or rename your alias.", context.Server.MapPath(partial)));
}
if (System.IO.File.Exists(context.Server.MapPath(partial)))
{
sb.AppendLine(htmlHelper.Partial(partial, fieldsetModel, viewDataDictionary).ToString());
}
else
{
LogHelper.Info<ArchetypeModel>(string.Format("The partial for {0} could not be found. Please create a partial with that name or rename your alias.", context.Server.MapPath(partial)));
}
return new HtmlString(sb.ToString());
}
/// <summary>
/// Renders a single archtype partial from a fieldset
/// </summary>
/// <param name="htmlHelper">The HTML helper.</param>
/// <param name="fieldsetModel">The fieldset model.</param>
/// <returns></returns>
public static IHtmlString RenderArchetypePartial(this HtmlHelper htmlHelper, ArchetypeFieldsetModel fieldsetModel)
{
return _renderPartial(htmlHelper, fieldsetModel, null, null);
}
/// <summary>
/// Renders the archetype partial.
/// </summary>
/// <param name="htmlHelper">The HTML helper.</param>
/// <param name="fieldsetModel">The fieldset model.</param>
/// <param name="partialView">The partial view.</param>
/// <returns></returns>
public static IHtmlString RenderArchetypePartial(this HtmlHelper htmlHelper, ArchetypeFieldsetModel fieldsetModel, string partialView)
{
return _renderPartial(htmlHelper, fieldsetModel, partialView, null);
}
/// <summary>
/// Renders the archetype partial.
/// </summary>
/// <param name="htmlHelper">The HTML helper.</param>
/// <param name="fieldsetModel">The fieldset model.</param>
/// <param name="partialView">The partial view.</param>
/// <param name="viewDataDictionary">The view data dictionary.</param>
/// <returns></returns>
public static IHtmlString RenderArchetypePartial(this HtmlHelper htmlHelper, ArchetypeFieldsetModel fieldsetModel, string partialView, ViewDataDictionary viewDataDictionary)
{
return _renderPartial(htmlHelper, fieldsetModel, partialView, viewDataDictionary);
}
/// <summary>
/// Renders the archetype partials.
/// </summary>
/// <param name="htmlHelper">The HTML helper.</param>
/// <param name="archetypeModel">The archetype model.</param>
/// <returns></returns>
public static IHtmlString RenderArchetypePartials(this HtmlHelper htmlHelper, ArchetypeModel archetypeModel)
{
return _renderPartials(htmlHelper, archetypeModel, null, null);
}
/// <summary>
/// Renders the archetype partials.
/// </summary>
/// <param name="htmlHelper">The HTML helper.</param>
/// <param name="archetypeModel">The archetype model.</param>
/// <param name="partialPath">The partial path.</param>
/// <returns></returns>
public static IHtmlString RenderArchetypePartials(this HtmlHelper htmlHelper, ArchetypeModel archetypeModel, string partialPath)
{
return _renderPartials(htmlHelper, archetypeModel, partialPath, null);
}
/// <summary>
/// Renders the archetype partials.
/// </summary>
/// <param name="htmlHelper">The HTML helper.</param>
/// <param name="archetypeModel">The archetype model.</param>
/// <param name="viewDataDictionary">The view data dictionary.</param>
/// <returns></returns>
public static IHtmlString RenderArchetypePartials(this HtmlHelper htmlHelper, ArchetypeModel archetypeModel, ViewDataDictionary viewDataDictionary)
{
return _renderPartials(htmlHelper, archetypeModel, null, viewDataDictionary);
}
/// <summary>
/// Renders the archetype partials.
/// </summary>
/// <param name="htmlHelper">The HTML helper.</param>
/// <param name="archetypeModel">The archetype model.</param>
/// <param name="partialPath">The partial path.</param>
/// <param name="viewDataDictionary">The view data dictionary.</param>
/// <returns></returns>
public static IHtmlString RenderArchetypePartials(this HtmlHelper htmlHelper, ArchetypeModel archetypeModel, string partialPath, ViewDataDictionary viewDataDictionary)
{
return htmlHelper._renderPartials(archetypeModel, partialPath, viewDataDictionary);
}
}
}
@@ -5,6 +5,9 @@ using Umbraco.Core.PropertyEditors;
namespace Archetype.Extensions
{
/// <summary>
/// PropertyEditor extensions.
/// </summary>
public static class PropertyEditorExtensions
{
/// <summary>
@@ -1,8 +1,15 @@
namespace Archetype.Extensions
{
/// <summary>
/// String extensions.
/// </summary>
public static class StringExtensions
{
//lifted from the core as it is marked 'internal'
/// <summary>
/// Detects if the input string is JSON.
/// </summary>
/// <param name="input">The input.</param>
/// <returns></returns>
public static bool DetectIsJson(this string input)
{
input = input.Trim();
@@ -1,11 +1,15 @@
using System.Collections.Generic;
using System.Linq;
using System.Web.Security;
using Newtonsoft.Json;
using Umbraco.Core;
using System;
namespace Archetype.Models
{
/// <summary>
/// Model that represents a fieldset stored as content JSON.
/// </summary>
public class ArchetypeFieldsetModel
{
[JsonProperty("alias")]
@@ -20,6 +24,18 @@ namespace Archetype.Models
[JsonProperty("id")]
public Guid Id { get; set; }
[JsonProperty("releaseDate")]
public DateTime? ReleaseDate { get; set; }
[JsonProperty("expireDate")]
public DateTime? ExpireDate { get; set; }
[JsonProperty("allowedMemberGroups")]
public string AllowedMemberGroups { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ArchetypeFieldsetModel"/> class.
/// </summary>
public ArchetypeFieldsetModel()
{
Properties = new List<ArchetypePropertyModel>();
@@ -27,11 +43,22 @@ namespace Archetype.Models
#region Helper Methods
/// <summary>
/// Gets the value and returns as string.
/// </summary>
/// <param name="propertyAlias">The property alias.</param>
/// <returns></returns>
public string GetValue(string propertyAlias)
{
return GetValue<string>(propertyAlias);
}
/// <summary>
/// Gets the value based on the type passed in as a generic.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="propertyAlias">The property alias.</param>
/// <returns></returns>
public T GetValue<T>(string propertyAlias)
{
var property = GetProperty(propertyAlias);
@@ -49,6 +76,13 @@ namespace Archetype.Models
// however, this would require GetValue<T>(string propertyAlias) to call the common implementation
// with a default(T) value, which could in theory result in a performance hit, if T for some reason
// is costly to instantiate.
/// <summary>
/// Gets the value.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="propertyAlias">The property alias.</param>
/// <param name="defaultValue">The default value.</param>
/// <returns></returns>
public T GetValue<T>(string propertyAlias, T defaultValue)
{
var property = GetProperty(propertyAlias);
@@ -61,16 +95,31 @@ namespace Archetype.Models
return property.GetValue<T>();
}
/// <summary>
/// Determines whether the property is empty.
/// </summary>
/// <param name="property">The property.</param>
/// <returns></returns>
private bool IsEmptyProperty(ArchetypePropertyModel property)
{
return (property == null || property.Value == null || string.IsNullOrEmpty(property.Value.ToString()));
}
/// <summary>
/// Determines whether the specified property alias has property.
/// </summary>
/// <param name="propertyAlias">The property alias.</param>
/// <returns></returns>
public bool HasProperty(string propertyAlias)
{
return GetProperty(propertyAlias) != null;
}
/// <summary>
/// Determines whether the specified property alias has value.
/// </summary>
/// <param name="propertyAlias">The property alias.</param>
/// <returns></returns>
public bool HasValue(string propertyAlias)
{
var property = GetProperty(propertyAlias);
@@ -80,12 +129,42 @@ namespace Archetype.Models
return !string.IsNullOrEmpty(property.Value.ToString());
}
/// <summary>
/// Gets the property.
/// </summary>
/// <param name="propertyAlias">The property alias.</param>
/// <returns></returns>
private ArchetypePropertyModel GetProperty(string propertyAlias)
{
return Properties.FirstOrDefault(p => p.Alias.InvariantEquals(propertyAlias));
}
#endregion
/// <summary>
/// Is this fieldset disabled, either explicitly or by other means?
/// </summary>
/// <returns>true if this fieldset is disabled, false otherwise</returns>
internal bool IsAvailable()
{
// explicitly disabled or implicitly disabled through publishing?
var disabled = Disabled
|| (ReleaseDate.HasValue && ReleaseDate > DateTime.UtcNow)
|| (ExpireDate.HasValue && DateTime.UtcNow > ExpireDate);
if(disabled)
{
// yes - the fieldset is not available
return false;
}
// limitation on member group access?
if(string.IsNullOrEmpty(AllowedMemberGroups))
{
// no - the fieldset is available
return true;
}
// maybe - the fieldset is available if the current member is a member of the configured member groups
var currentUserGroups = Roles.GetRolesForUser() ?? new string[0];
return currentUserGroups.ContainsAny(AllowedMemberGroups.Split(','));
}
#endregion
}
}
@@ -7,27 +7,44 @@ using Newtonsoft.Json.Linq;
namespace Archetype.Models
{
/// <summary>
/// Model that represents an entire Archetype.
/// </summary>
[JsonObject]
public class ArchetypeModel : IEnumerable<ArchetypeFieldsetModel>
{
[JsonProperty("fieldsets")]
public IEnumerable<ArchetypeFieldsetModel> Fieldsets { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ArchetypeModel"/> class.
/// </summary>
public ArchetypeModel()
{
Fieldsets = new List<ArchetypeFieldsetModel>();
}
/// <summary>
/// Returns an enumerator that iterates through the collection of fieldsets.
/// </summary>
/// <returns>
/// An enumerator that can be used to iterate through the collection.
/// </returns>
public IEnumerator<ArchetypeFieldsetModel> GetEnumerator()
{
return this.Fieldsets.Where(f => f.Disabled == false).GetEnumerator();
return this.Fieldsets.Where(f => f.IsAvailable()).GetEnumerator();
}
//possibly obsolete?
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
/// <summary>
/// Serializes for persistence. This should be used for serialization as it cleans up the JSON before saving.
/// </summary>
/// <returns></returns>
public string SerializeForPersistence()
{
var json = JObject.Parse(JsonConvert.SerializeObject(this, new JsonSerializerSettings() { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }));
@@ -1,9 +1,12 @@
using System;
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Archetype.Models
{
/// <summary>
/// Model that represents the configured Archetype options.
/// </summary>
public class ArchetypePreValue
{
[JsonProperty("showAdvancedOptions")]
@@ -28,6 +31,15 @@ namespace Archetype.Models
[JsonProperty("enableDisabling")]
public bool EnableDisabling { get; set; }
[JsonProperty("enablePublishing")]
public bool EnablePublishing { get; set; }
[JsonProperty("enableCrossDragging")]
public bool EnableCrossDragging { get; set; }
[JsonProperty("enableMemberGroups")]
public bool EnableMemberGroups { get; set; }
[JsonProperty("hideFieldsetControls")]
public bool HideFieldsetControls { get; set; }
@@ -3,6 +3,9 @@ using Newtonsoft.Json;
namespace Archetype.Models
{
/// <summary>
/// Model that represents configured Archetype fieldsets.
/// </summary>
public class ArchetypePreValueFieldset
{
[JsonProperty("alias")]
@@ -2,6 +2,9 @@ using Newtonsoft.Json;
namespace Archetype.Models
{
/// <summary>
/// Model that represents configured groupings of Archetype fieldsets.
/// </summary>
public class ArchetypePreValueFieldsetGroup
{
[JsonProperty("name")]
@@ -3,6 +3,9 @@ using Newtonsoft.Json;
namespace Archetype.Models
{
/// <summary>
/// Model that represents a configured property on an Archetype fieldset.
/// </summary>
public class ArchetypePreValueProperty
{
[JsonProperty("alias")]
@@ -9,6 +9,9 @@ using Umbraco.Web;
namespace Archetype.Models
{
/// <summary>
/// Model that represents a stored property in Archetype.
/// </summary>
public class ArchetypePropertyModel
{
[JsonProperty("alias")]
@@ -33,6 +36,11 @@ namespace Archetype.Models
[JsonProperty("hostContentType")]
internal PublishedContentType HostContentType { get; set; }
/// <summary>
/// Gets the value based on the type given.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public T GetValue<T>()
{
// Try Umbraco's PropertyValueConverters
@@ -56,6 +64,13 @@ namespace Archetype.Models
return default(T);
}
/// <summary>
/// Tries to convert the value with property value converters.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="value">The value.</param>
/// <param name="converters">The converters.</param>
/// <returns></returns>
private Attempt<T> TryConvertWithPropertyValueConverters<T>(object value, IEnumerable<IPropertyValueConverter> converters)
{
var properyType = this.CreateDummyPropertyType();
@@ -92,6 +107,9 @@ namespace Archetype.Models
return Attempt<T>.Fail();
}
/// <summary>
/// Model that represents the current UmbracoEditorState
/// </summary>
internal class UmbracoEditorState
{
// container for the names of any files selected for a property in the Umbraco backend
@@ -0,0 +1,186 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
namespace Archetype.Models
{
public class ArchetypePublishedContent : IPublishedContent
{
private ArchetypeFieldsetModel _fieldset;
private IEnumerable<IPublishedContent> _parent;
private readonly Dictionary<string, IPublishedProperty> _properties;
public ArchetypePublishedContent(ArchetypeFieldsetModel fieldset, ArchetypePublishedContentSet parent = null)
{
if (fieldset == null)
throw new ArgumentNullException("fieldset");
_fieldset = fieldset;
_parent = parent ?? Enumerable.Empty<IPublishedContent>();
_properties = fieldset.Properties
.ToDictionary(
x => x.Alias,
x => new ArchetypePublishedProperty(x) as IPublishedProperty,
StringComparer.InvariantCultureIgnoreCase);
}
internal ArchetypeFieldsetModel ArchetypeFieldset
{
get { return _fieldset; }
}
public IEnumerable<IPublishedContent> Children
{
get { return Enumerable.Empty<IPublishedContent>(); }
}
public IEnumerable<IPublishedContent> ContentSet
{
get { return _parent; }
}
public PublishedContentType ContentType
{
get { return default(PublishedContentType); }
}
public DateTime CreateDate
{
get { return DateTime.MinValue; }
}
public int CreatorId
{
get { return default(int); }
}
public string CreatorName
{
get { return default(string); }
}
public string DocumentTypeAlias
{
get { return _fieldset.Alias; }
}
public int DocumentTypeId
{
get { return default(int); }
}
public int GetIndex()
{
return _parent.IndexOf(this);
}
public IPublishedProperty GetProperty(string alias, bool recurse)
{
IPublishedProperty property;
return _properties.TryGetValue(alias, out property) ? property : null;
}
public IPublishedProperty GetProperty(string alias)
{
return this.GetProperty(alias, false);
}
public int Id
{
get { return default(int); }
}
public bool IsDraft
{
get { return _fieldset.IsAvailable() == false; }
}
public PublishedItemType ItemType
{
get { return PublishedItemType.Content; }
}
public int Level
{
get { return default(int); }
}
public string Name
{
get { return default(string); }
}
public IPublishedContent Parent
{
get { return default(IPublishedContent); }
}
public string Path
{
get { return default(string); }
}
public ICollection<IPublishedProperty> Properties
{
get { return _properties.Values; }
}
public int SortOrder
{
get { return default(int); }
}
public int TemplateId
{
get { return default(int); }
}
public DateTime UpdateDate
{
get { return default(DateTime); }
}
public string Url
{
get { return default(string); }
}
public string UrlName
{
get { return default(string); }
}
public Guid Version
{
get { return Guid.Empty; }
}
public int WriterId
{
get { return default(int); }
}
public string WriterName
{
get { return default(string); }
}
public object this[string alias]
{
get
{
var property = this.GetProperty(alias);
return property == null
? null
: property.Value;
}
}
}
}
@@ -0,0 +1,39 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace Archetype.Models
{
public class ArchetypePublishedContentSet : IEnumerable<ArchetypePublishedContent>
{
private IEnumerable<ArchetypePublishedContent> _items { get; set; }
public ArchetypePublishedContentSet(ArchetypeModel archetype)
{
if (archetype == null)
throw new ArgumentNullException("archetype");
this.ArchetypeModel = archetype;
var count = archetype.Fieldsets.Count();
_items = archetype.Fieldsets
.Where(x => x.IsAvailable())
.Select(x => new ArchetypePublishedContent(x, this))
.ToArray();
}
internal ArchetypeModel ArchetypeModel { get; private set; }
public IEnumerator<ArchetypePublishedContent> GetEnumerator()
{
return _items.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
}
}
@@ -0,0 +1,85 @@
using System;
using Archetype.Extensions;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
namespace Archetype.Models
{
public class ArchetypePublishedProperty : IPublishedProperty
{
private readonly object _rawValue;
private readonly Lazy<object> _sourceValue;
private readonly Lazy<object> _objectValue;
private readonly Lazy<object> _xpathValue;
private readonly ArchetypePropertyModel _property;
private readonly PublishedPropertyType _propertyType;
public ArchetypePublishedProperty(ArchetypePropertyModel property)
{
if (property == null)
throw new ArgumentNullException("property");
var preview = false;
_property = property;
_rawValue = property.Value;
_propertyType = property.CreateDummyPropertyType();
if (_propertyType != null)
{
_sourceValue = new Lazy<object>(() => _propertyType.ConvertDataToSource(_rawValue, preview));
_objectValue = new Lazy<object>(() => _propertyType.ConvertSourceToObject(_sourceValue.Value, preview));
_xpathValue = new Lazy<object>(() => _propertyType.ConvertSourceToXPath(_sourceValue.Value, preview));
}
}
internal ArchetypePropertyModel ArchetypeProperty
{
get { return _property; }
}
public object DataValue
{
get
{
return _sourceValue != null
? _sourceValue.Value
: _rawValue;
}
}
public bool HasValue
{
get
{
return _rawValue != null && !string.IsNullOrEmpty(_rawValue.ToString());
}
}
public string PropertyTypeAlias
{
get { return _property.Alias; }
}
public object Value
{
get
{
return _objectValue != null
? _objectValue.Value
: _rawValue;
}
}
public object XPathValue
{
get
{
return _xpathValue != null
? _xpathValue.Value
: _rawValue;
}
}
}
}
@@ -1,4 +1,4 @@
using System.Reflection;
[assembly: AssemblyVersion("1.11")]
[assembly: AssemblyFileVersion("1.11")]
[assembly: AssemblyVersion("1.13.0")]
[assembly: AssemblyFileVersion("1.13.0")]
@@ -8,15 +8,29 @@ using Umbraco.Core.Services;
namespace Archetype.PropertyConverters
{
/// <summary>
/// Default property value converter that models the JSON to a C# object.
/// </summary>
[PropertyValueType(typeof(Models.ArchetypeModel))]
[PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)]
public class ArchetypeValueConverter : PropertyValueConverterBase
{
/// <summary>
/// Gets the services.
/// </summary>
/// <value>
/// The services.
/// </value>
public ServiceContext Services
{
get { return ApplicationContext.Current.Services; }
}
/// <summary>
/// Determines whether the specified property type is converter for Archetype.
/// </summary>
/// <param name="propertyType">Type of the property.</param>
/// <returns></returns>
public override bool IsConverter(PublishedPropertyType propertyType)
{
var isArcheTypePropertyEditor = !String.IsNullOrEmpty(propertyType.PropertyEditorAlias)
@@ -27,6 +41,13 @@ namespace Archetype.PropertyConverters
return !ArchetypeHelper.Instance.IsPropertyValueConverterOverridden(propertyType.DataTypeId);
}
/// <summary>
/// Converts the data to source.
/// </summary>
/// <param name="propertyType">Type of the property.</param>
/// <param name="source">The source.</param>
/// <param name="preview">if set to <c>true</c> [preview].</param>
/// <returns></returns>
public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
{
var defaultValue = new ArchetypeModel();
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Archetype.Extensions;
using Archetype.Models;
using ClientDependency.Core;
using Newtonsoft.Json;
using Umbraco.Core;
@@ -15,17 +16,27 @@ using Umbraco.Web.Models.ContentEditing;
namespace Archetype.PropertyEditors
{
/// <summary>
/// C# representation of the property editor. This is often done with package manifest instead.
/// </summary>
[PropertyEditorAsset(ClientDependencyType.Javascript, "../App_Plugins/Archetype/js/archetype.js")]
[PropertyEditor(Constants.PropertyEditorAlias, "Archetype", "../App_Plugins/Archetype/views/archetype.html", ValueType = "JSON")]
public class ArchetypePropertyEditor : PropertyEditor
{
#region Pre Value Editor
/// <summary>
/// Creates a pre value editor instance
/// </summary>
/// <returns></returns>
protected override PreValueEditor CreatePreValueEditor()
{
return new ArchetypePreValueEditor();
}
/// <summary>
/// Class that represents the prevalue editor. This is often done with a package manifest instead.
/// </summary>
internal class ArchetypePreValueEditor : PreValueEditor
{
[PreValueField("archetypeConfig", "Config", "../App_Plugins/Archetype/views/archetype.config.html",
@@ -41,11 +52,18 @@ namespace Archetype.PropertyEditors
#region Value Editor
/// <summary>
/// Creates a value editor instance
/// </summary>
/// <returns></returns>
protected override PropertyValueEditor CreateValueEditor()
{
return new ArchetypePropertyValueEditor(base.CreateValueEditor());
}
/// <summary>
/// Class that represents the actual data editor. This is often done with a package manifest instead.
/// </summary>
internal class ArchetypePropertyValueEditor : PropertyValueEditorWrapper
{
protected JsonSerializerSettings _jsonSettings;
@@ -55,6 +73,13 @@ namespace Archetype.PropertyEditors
{
}
/// <summary>
/// Converts the property value for use in the front-end cache
/// </summary>
/// <param name="property"></param>
/// <param name="propertyType"></param>
/// <param name="dataTypeService"></param>
/// <returns></returns>
public override string ConvertDbToString(Property property, PropertyType propertyType, IDataTypeService dataTypeService)
{
if(property.Value == null || property.Value.ToString() == "")
@@ -85,6 +110,17 @@ namespace Archetype.PropertyEditors
return archetype.SerializeForPersistence();
}
/// <summary>
/// A method used to format the database value to a value that can be used by the editor
/// </summary>
/// <param name="property"></param>
/// <param name="propertyType"></param>
/// <param name="dataTypeService"></param>
/// <returns></returns>
/// <remarks>
/// The object returned will automatically be serialized into json notation. For most property editors
/// the value returned is probably just a string but in some cases a json structure will be returned.
/// </remarks>
public override object ConvertDbToEditor(Property property, PropertyType propertyType, IDataTypeService dataTypeService)
{
if(property.Value == null || property.Value.ToString() == "")
@@ -114,6 +150,19 @@ namespace Archetype.PropertyEditors
return archetype;
}
/// <summary>
/// A method to deserialize the string value that has been saved in the content editor
/// to an object to be stored in the database.
/// </summary>
/// <param name="editorValue"></param>
/// <param name="currentValue">The current value that has been persisted to the database for this editor. This value may be usesful for
/// how the value then get's deserialized again to be re-persisted. In most cases it will probably not be used.</param>
/// <returns></returns>
/// <remarks>
/// By default this will attempt to automatically convert the string value to the value type supplied by ValueType.
/// If overridden then the object returned must match the type supplied in the ValueType, otherwise persisting the
/// value to the DB will fail when it tries to validate the value type.
/// </remarks>
public override object ConvertEditorToDb(ContentPropertyData editorValue, object currentValue)
{
if(editorValue.Value == null || editorValue.Value.ToString() == "")
@@ -127,6 +176,10 @@ namespace Archetype.PropertyEditors
var uploadedFiles = editorValue.AdditionalData.ContainsKey("files") ? editorValue.AdditionalData["files"] as IEnumerable<ContentItemFile> : null;
foreach (var fieldset in archetype.Fieldsets)
{
// make sure the publishing dates are in UTC
fieldset.ReleaseDate = EnsureUtcDate(fieldset.ReleaseDate);
fieldset.ExpireDate = EnsureUtcDate(fieldset.ExpireDate);
// assign an id to the fieldset if it has none (e.g. newly created fieldset)
fieldset.Id = fieldset.Id == Guid.Empty ? Guid.NewGuid() : fieldset.Id;
// find the corresponding fieldset in the current Archetype value (if any)
@@ -175,6 +228,11 @@ namespace Archetype.PropertyEditors
return archetype.SerializeForPersistence();
}
/// <summary>
/// Gets the property editor.
/// </summary>
/// <param name="dtd">The DTD.</param>
/// <returns></returns>
internal virtual PropertyEditor GetPropertyEditor(IDataTypeDefinition dtd)
{
if(dtd.Id != 0)
@@ -184,6 +242,20 @@ namespace Archetype.PropertyEditors
? new ArchetypePropertyEditor()
: (PropertyEditor) new TextboxPropertyEditor();
}
/// <summary>
/// Ensures that a datetime is in UTC
/// </summary>
/// <param name="dateTime">The datetime</param>
/// <returns>The datetime in UTC (or null if it's not set)</returns>
private DateTime? EnsureUtcDate(DateTime? dateTime)
{
if(dateTime.HasValue == false || dateTime.Value.Kind == DateTimeKind.Utc)
{
return dateTime;
}
return new DateTime(dateTime.Value.Ticks, DateTimeKind.Utc);
}
}
#endregion
+7 -4
View File
@@ -6,7 +6,7 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio
//define empty items
var newPropertyModel = '{"alias": "", "remove": false, "collapse": false, "label": "", "helpText": "", "dataTypeGuid": "0cc0eba1-9960-42c9-bf9b-60e150b429ae", "value": ""}';
var newFieldsetModel = '{"alias": "", "remove": false, "collapse": false, "labelTemplate": "", "icon": "", "label": "", "properties": [' + newPropertyModel + '], "group": null}';
var defaultFieldsetConfigModel = JSON.parse('{"showAdvancedOptions": false, "startWithAddButton": false, "hideFieldsetToolbar": false, "enableMultipleFieldsets": false, "hideFieldsetControls": false, "hidePropertyLabel": false, "maxFieldsets": null, "enableCollapsing": true, "enableCloning": false, "enableDisabling": true, "enableDeepDatatypeRequests": false, "fieldsets": [' + newFieldsetModel + '], "fieldsetGroups": []}');
var defaultFieldsetConfigModel = JSON.parse('{"showAdvancedOptions": false, "startWithAddButton": false, "hideFieldsetToolbar": false, "enableMultipleFieldsets": false, "hideFieldsetControls": false, "hidePropertyLabel": false, "maxFieldsets": null, "enableCollapsing": true, "enableCloning": false, "enableDisabling": true, "enableDeepDatatypeRequests": false, "enablePublishing": false, "enableMemberGroups": false, "enableCrossDragging": false, "fieldsets": [' + newFieldsetModel + '], "fieldsetGroups": []}');
//ini the model
$scope.model.value = $scope.model.value || defaultFieldsetConfigModel;
@@ -313,10 +313,13 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio
dialogService.open({
template: template,
show: true,
callback: function(data) {
$scope.archetypeConfigRenderModel = data;
callback: function (data) {
// replace the entire render model if it was changed (in developer options)
if (data.model && data.modelChanged) {
$scope.archetypeConfigRenderModel = data.model;
}
},
dialogData: $scope.archetypeConfigRenderModel
dialogData: { model: $scope.archetypeConfigRenderModel }
});
}
+3 -5
View File
@@ -1,17 +1,15 @@
angular.module('umbraco').controller('ArchetypeConfigOptionsController', function ($scope) {
$scope.model = angular.copy($scope.dialogData);
//handles a fieldset group add
$scope.addFieldsetGroup = function () {
$scope.model.fieldsetGroups.push({ name: "" });
$scope.dialogData.model.fieldsetGroups.push({ name: "" });
}
//handles a fieldset group removal
$scope.removeFieldsetGroup = function ($index) {
$scope.model.fieldsetGroups.splice($index, 1);
$scope.dialogData.model.fieldsetGroups.splice($index, 1);
}
$scope.apply = function(index) {
$scope.submit($scope.model);
$scope.submit($scope.dialogData);
}
});
+426 -37
View File
@@ -1,6 +1,9 @@
{{VERSION}}
angular.module("umbraco").controller("Imulus.ArchetypeController", function ($scope, $http, $filter, assetsService, angularHelper, notificationsService, $timeout, fileManager, entityResource, archetypeService, archetypeLabelService, archetypeCacheService, archetypePropertyEditorResource) {
// Variables.
var draggedParent;
//$scope.model.value = "";
$scope.model.hideLabel = $scope.model.config.hideLabel == 1;
@@ -15,6 +18,8 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
// store the umbraco property alias to help generate unique IDs. Hopefully there's a better way to get this in the future :)
$scope.umbracoHostPropertyAlias = $scope.$parent.$parent.model.alias;
$scope.isDebuggingEnabled = Umbraco.Sys.ServerVariables.isDebuggingEnabled;
$scope.overlayMenu = {
show: false,
@@ -41,36 +46,201 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
return archetypeLabelService.getFieldsetTitle($scope, fieldsetConfigModel, fieldsetIndex);
}
var draggedRteSettings;
var rteClass = ".umb-rte textarea";
//sort config
$scope.sortableOptions = {
axis: 'y',
cursor: "move",
handle: ".handle",
tolerance: "pointer",
activate: function(ev, ui) {
// Variables.
var parentItem = ui.item.parent();
var thisElement = parentItem[0];
var targetElement = ev.target;
var targetItem = angular.element(targetElement);
// The source of the drag can always be dropped back onto.
if (targetElement === thisElement) {
return;
}
// Variables.
var sourceScope = ui.item.scope();
var targetScope = targetItem.scope();
var valid = canMove(sourceScope, targetScope);
// If the sortable can't be moved to the target Archetype, disable
// the target Archetype's sortable temporarily.
if (!valid) {
var targetSortable = getSortableWidgetInstance(targetItem);
targetSortable.disable();
parentItem.sortable("refresh");
archetypeService.rememberDisabledSortable(targetSortable);
}
},
start: function(ev, ui) {
draggedRteSettings = {};
$(rteClass, ui.item.parent()).each(function () {
var id = $(this).attr("id");
draggedRteSettings[id] = _.findWhere(tinyMCE.editors, { id: id }).settings;
tinymce.execCommand('mceRemoveEditor', false, id);
$(this).css("visibility", "hidden");
archetypeService.storeEditors(ui.item.parent());
$scope.$apply(function() {
draggedParent = ui.item.parent();
draggedParent.scope().doingSort = true;
});
},
update: function (ev, ui) {
// Variables.
var targetScope = ui.item.sortable.droptarget.scope();
var sourceScope = ui.item.scope();
var sameScope = sourceScope === targetScope;
var sourceIndex = ui.item.sortable.index;
// Special constraints for when moving between Archetypes.
// If sourceScope is populated, we are in the first of the two updates (when
// moving between lists, ui-sortable calls the update function twice).
if (sourceScope && !sameScope) {
// Variables.
var valid = canMove(sourceScope, targetScope);
// If update isn't allowed, cancel the drag operation.
if (!valid) {
ui.item.sortable.cancel();
return;
}
// Clear the validations for this item.
clearValidations(ui.item.parent());
clearValidations(ui.item.sortable.droptarget);
// Reset "isValid" on the properties and fieldsets.
var fieldsetGroups = [
$scope.model.value.fieldsets,
targetScope.model.value.fieldsets
];
_.each(fieldsetGroups, function(fieldsets) {
recurseProperties(function(property, fieldset) {
property.isValid = true;
fieldset.isValid = true;
}, fieldsets);
});
// Move the activated fieldset to the target Archetype.
var movedFieldset = $scope.model.value.fieldsets[sourceIndex];
var loadedIndex = $scope.loadedFieldsets.indexOf(movedFieldset);
if (loadedIndex >= 0) {
$scope.loadedFieldsets.splice(loadedIndex, 1);
if (targetScope.loadedFieldsets.indexOf(movedFieldset) < 0) {
targetScope.loadedFieldsets.push(movedFieldset);
}
}
}
// Set scope dirty.
$scope.setDirty();
},
stop: function (ev, ui) {
$(rteClass, ui.item.parent()).each(function () {
var id = $(this).attr("id");
draggedRteSettings[id] = draggedRteSettings[id] || _.findWhere(tinyMCE.editors, { id: id }).settings;
tinyMCE.execCommand("mceRemoveEditor", false, id);
tinyMCE.init(draggedRteSettings[id]);
});
// Done sorting.
draggedParent.scope().doingSort = false;
// Enable disabled sortables.
archetypeService.enableSortables();
// Restore rich text editors.
var parent = null;
var target = ui.item.sortable.droptarget;
if (target) {
parent = target.parent();
}
archetypeService.restoreEditors(parent);
}
};
// Clears the Angular validations in an Archetype.
function clearValidations(el) {
var combined = $(".archetypeSortable", el).add(el);
combined.each(function(index, item) {
var $item = angular.element(item);
var cont = $item.controller("ngModel");
var err = cont.$error;
var keys = Object.keys(err);
for (var i = 0; i < keys.length; i++) {
cont.$setValidity(keys[i], true);
}
});
}
// Enable cross-archetype dragging?
if ($scope.model.config.enableCrossDragging) {
$scope.sortableOptions.connectWith = ".archetypeSortable:not(.invalid)";
}
// Checks if the specified model's properties match all of the properties in any of
// the specified fieldsets, while also checking if the fieldset aliases match.
// This is an indicator of the compatibility of a fieldset model with a collection
// of fieldset configurations.
function modelMatchesAnyFieldset(model, fieldsets) {
// Loop through fieldsets to find a match.
for (var i = 0; i < fieldsets.length; i++) {
var fieldset = fieldsets[i];
// Confirm that this configured fielset contains exactly
// the same properties as those that were supplied.
var valid =
// Does the alias match?
model.alias === fieldset.alias &&
// Does this fieldset have all the properties?
arePropertiesSubset(model.properties, fieldset.properties) &&
// Does the property array have all the fieldset properties?
arePropertiesSubset(fieldset.properties, model.properties);
// Match found?
if (valid) {
return true;
}
}
// No match found.
return false;
}
// Confirms that an array of properties is a subset of another array of properties.
function arePropertiesSubset(subset, superset) {
// Loop through the subset of properties.
for (var j = 0; j < subset.length; j++) {
var subProperty = subset[j];
var matchedProp = false;
// Loop through the superset to find a matching property from the subset.
for (var k = 0; k < superset.length; k++) {
var superProperty = superset[k];
if (superProperty.alias === subProperty.alias &&
superProperty.dataTypeGuid === subProperty.dataTypeGuid) {
matchedProp = true;
break;
}
}
// If no matching property could be found, the array is not a subset.
if (!matchedProp) {
return false;
}
}
// The array is a subset.
return true;
}
//handles a fieldset add
$scope.openFieldsetPicker = function ($index, event) {
if ($scope.canAdd() == false) {
@@ -146,6 +316,8 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
}
}
addCustomPropertiesToFieldset(newFieldset);
$scope.setDirty();
$scope.$broadcast("archetypeAddFieldset", {index: $index, visible: countVisible()});
@@ -172,6 +344,13 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
if(newFieldset) {
// Regenerate the temporary ID on each nested fieldset.
// This is done because no two fieldsets should have the same
// temporary ID.
recurseProperties(function(property) {
archetypeService.ensureTemporaryId(property, true);
}, [newFieldset]);
$scope.model.value.fieldsets.splice($index + 1, 0, newFieldset);
$scope.setDirty();
@@ -192,18 +371,20 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
$scope.canAdd = function () {
if ($scope.model.config.maxFieldsets)
{
return countVisible() < $scope.model.config.maxFieldsets;
var visibleCount = countVisible();
var maxFieldsets = $scope.model.config.maxFieldsets;
return visibleCount < maxFieldsets;
}
return true;
}
};
//helper that returns if an item can be removed
$scope.canRemove = function () {
return countVisible() > 1
|| ($scope.model.config.maxFieldsets == 1 && $scope.model.config.fieldsets.length > 1)
|| $scope.model.config.startWithAddButton;
}
};
$scope.canClone = function () {
@@ -222,8 +403,16 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
//helper that returns if an item can be sorted
$scope.canSort = function ()
{
return countVisible() > 1;
}
// Sorting can occur if there are multiple fieldsets, or if there is only one
// fieldset that can be removed (in which case it can be sorted into an entirely
// different Archetype).
return countVisible() > 1 || $scope.canRemove();
};
//helper that returns if an item is the last and it's being sorted.
$scope.sortingLastItem = function() {
return $scope.doingSort && $scope.model.value.fieldsets.length <= 1;
};
//helper that returns if an item can be disabled
$scope.canDisable = function () {
@@ -237,6 +426,70 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
///&& $scope.model.config.fieldsets.length == 1;
}
//helper that returns if an item can use publishing
$scope.canPublish = function () {
return $scope.model.config.enablePublishing;
}
$scope.canUseMemberGroups = function() {
return $scope.model.config.enableMemberGroups;
}
//helper that returns if the "misc fieldset configuration" section should be visible
$scope.canConfigure = function () {
// currently the "misc fieldset configuration" section contains the publishing and the member groups setup
return $scope.canPublish() || $scope.canUseMemberGroups();
}
$scope.showDisableIcon = function (fieldset) {
if ($scope.canDisable() == false) {
return false;
}
// disabled state takes precedence over publishing
if (fieldset.disabled) {
return true;
}
return $scope.isDisabledByPublishing(fieldset) == false;
}
$scope.showPublishingIcon = function (fieldset) {
if ($scope.canPublish() == false) {
return false;
}
if ($scope.canDisable()) {
// disabled state takes precedence over publishing
if (fieldset.disabled) {
return false;
}
return $scope.isDisabledByPublishing(fieldset);
}
return true;
}
$scope.isDisabledByPublishing = function(fieldset) {
if ($scope.canPublish() === false) {
return false;
}
// NOTE: all comparison is done in local datetime
// - that's fine because the selected local datetimes will be converted to UTC datetimes when submitted
if (fieldset.expireDateModel && fieldset.expireDateModel.value && (moment() > moment(fieldset.expireDateModel.value))) {
// an expired release affects the fieldset
return true;
}
if (fieldset.releaseDateModel && fieldset.releaseDateModel.value && (moment(fieldset.releaseDateModel.value) > moment())) {
// a pending release affects the fieldset
return true;
}
return false;
}
$scope.isDisabled = function(fieldset) {
if (fieldset.disabled) {
return true;
}
return $scope.isDisabledByPublishing(fieldset);
}
//helper, ini the render model from the server (model.value)
function init() {
$scope.model.value = removeNulls($scope.model.value);
@@ -252,6 +505,36 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
});
}
function addCustomProperties(fieldsets) {
// make sure we have loaded moment.js before using it
assetsService.loadJs("lib/moment/moment-with-locales.js").then(function() {
_.each(fieldsets, function(fieldset) {
addCustomPropertiesToFieldset(fieldset);
});
});
}
function addCustomPropertiesToFieldset(fieldset) {
// create models for publish configuration (utilizing the built-in datepicker data type)
// NOTE: all datetimes must be converted from UTC to local
fieldset.releaseDateModel = {
alias: _.uniqueId("archetypeReleaseDate_"),
view: "datepicker",
value: fromUtc(fieldset.releaseDate)
};
fieldset.expireDateModel = {
alias: _.uniqueId("archetypeExpireDate_"),
view: "datepicker",
value: fromUtc(fieldset.expireDate)
};
// create model for allowed member groups
fieldset.allowedMemberGroupsModel = {
alias: _.uniqueId("archetypeAllowedMemberGroups_"),
view: "membergrouppicker",
value: fieldset.allowedMemberGroups
};
}
//helper to get the correct fieldset from config
$scope.getConfigFieldsetByAlias = function(alias) {
return _.find($scope.model.config.fieldsets, function(fieldset){
@@ -276,6 +559,12 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
return fieldset.collapse;
}
// added to track loaded fieldsets
$scope.loadedFieldsets = [];
$scope.isLoaded = function (fieldset) {
return $scope.loadedFieldsets.indexOf(fieldset) >= 0;
}
//helper for expanding/collapsing fieldsets
$scope.focusFieldset = function(fieldset){
fixDisableSelection();
@@ -298,12 +587,14 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
if(!fieldset && $scope.model.value.fieldsets.length == 1)
{
$scope.model.value.fieldsets[0].collapse = false;
$scope.loadedFieldsets.push($scope.model.value.fieldsets[0]);
return;
}
if(iniState && fieldset)
{
fieldset.collapse = !iniState;
$scope.loadedFieldsets.push(fieldset);
}
}
@@ -359,6 +650,12 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
// reset submit watcher counter on save
$scope.activeSubmitWatcher = 0;
// init loaded fieldsets tracking
$scope.loadedFieldsets = _.where($scope.model.value.fieldsets, { collapse: false });
// create properties needed for the backoffice to work (data that is not serialized to DB)
addCustomProperties($scope.model.value.fieldsets);
});
//helper to count what is visible
@@ -419,24 +716,21 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
//helper to lookup validity when given a fieldset
$scope.getFieldsetValidity = function (fieldset) {
if (fieldset.isValid == false) {
return false;
}
// recursive validation of nested fieldsets
var nestedFieldsetsValid = true;
_.each(fieldset.properties, function (property) {
if (property != null && property.value != null && property.propertyEditorAlias == "Imulus.Archetype") {
_.each(property.value.fieldsets, function (inner) {
if ($scope.getFieldsetValidity(inner) == false) {
nestedFieldsetsValid = false;
}
});
// Variables.
var valid = true;
// Recursive validation of nested fieldsets.
recurseFieldsets(function(item) {
if (item.isValid === false) {
valid = false;
}
});
}, [fieldset]);
return nestedFieldsetsValid;
}
// Were all the nested fieldsets valid?
return valid;
};
// helper to force the current form into the dirty state
$scope.setDirty = function () {
@@ -468,7 +762,102 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
$scope.activeSubmitWatcher++;
return $scope.activeSubmitWatcher;
}
$scope.submitWatcherOnSubmit = function () {
$scope.$broadcast("archetypeFormSubmitting");
$scope.submitWatcherOnSubmit = function (args) {
$scope.$broadcast("archetypeFormSubmitting", args);
}
// we'll use our own "archetypeFormSubmitting" event to save custom properties, as at least some
// of the editors store their values back to the model on the core "formSubmitting" event
$scope.$on("archetypeFormSubmitting", function (ev, args) {
_.each($scope.model.value.fieldsets, function (fieldset) {
// extract the publish configuration from the fieldsets (and convert local datetimes to UTC)
fieldset.releaseDate = toUtc(fieldset.releaseDateModel.value);
fieldset.expireDate = toUtc(fieldset.expireDateModel.value);
// extract the allowed member groups
fieldset.allowedMemberGroups = fieldset.allowedMemberGroupsModel.value;
});
});
function toUtc(date) {
if (!date) {
return null;
}
return moment(date, "YYYY-MM-DD HH:mm:ss").utc().toDate();
}
function fromUtc(date) {
if (!date) {
return null;
}
return moment(moment.utc(date).toDate()).format("YYYY-MM-DD HH:mm:ss")
}
// Serializes and deserializes an item to return a snapshot of that item (e.g., so it is not
// changed before being inspected). Useful when troubleshooting.
// Modified from: http://stackoverflow.com/a/11616993/2052963
function jsonSnapshot(item) {
var cache = [];
var stringItem = JSON.stringify(item, function(key, value) {
if (typeof value === "object" && value !== null) {
if (cache.indexOf(value) !== -1) {
return "[Removed Circular Reference Item]";
}
cache.push(value);
}
return value;
});
return JSON.parse(stringItem);
}
// Recursively processes each Archetype fieldset.
function recurseFieldsets(fn, fieldsets) {
if (!fieldsets || !fieldsets.length) {
return;
}
_.each(fieldsets, function(fieldset) {
fn(fieldset);
_.each(fieldset.properties, function (property) {
if (property != null && property.value != null && property.propertyEditorAlias === "Imulus.Archetype") {
recurseFieldsets(fn, property.value.fieldsets);
}
});
});
}
// Recursively processes each Archetype fieldset property.
function recurseProperties(fn, fieldsets) {
recurseFieldsets(function(fieldset) {
_.each(fieldset.properties, function (property) {
fn(property, fieldset);
});
}, fieldsets);
}
// Indicates whether or not the fieldset can be moved between the source and target scope.
// The source scope is the scope of the fieldset being dragged.
// The target scope is the scope of the Archetype to drop into.
function canMove(sourceScope, targetScope) {
var targetFieldsets = targetScope.model.config.fieldsets;
var model = sourceScope.fieldsetConfigModel;
var canRemove = sourceScope.canRemove();
var canAdd = targetScope.canAdd();
var valid = canRemove && canAdd;
valid = valid && modelMatchesAnyFieldset(model, targetFieldsets);
return valid;
}
// This is an alternative to: element.sortable("instance")
// Workaround for this issue: https://github.com/imulus/Archetype/pull/356#issuecomment-218527910
// Snagged from this pull request: https://github.com/angular-ui/ui-sortable/pull/319
// More technical details here: https://github.com/angular-ui/ui-sortable/issues/316
function getSortableWidgetInstance(element) {
// this is a fix to support jquery-ui prior to v1.11.x
// otherwise we should be using `element.sortable('instance')`
var data = element.data('ui-sortable');
if (data && typeof data === 'object' && data.widgetFullName === 'ui-sortable') {
return data;
}
return null;
}
});
+1 -1
View File
@@ -1,7 +1,7 @@
angular.module("umbraco.directives").directive('archetypeCustomView', function ($compile, $http) {
var linker = function (scope, element, attrs) {
var view = "/App_plugins/Archetype/views/archetype.default.html";
var view = "../App_plugins/Archetype/views/archetype.default.html";
if(scope.model.config.customViewPath) {
view = scope.model.config.customViewPath;
}
+20 -10
View File
@@ -72,8 +72,14 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c
scope.renderModel = {};
scope.model.value = archetypeService.getFieldsetProperty(scope).value;
//init the property editor state
archetypeService.getFieldsetProperty(scope).editorState = {};
// init the property editor state (while ensuring the temporary ID is retained
// from any prior initializations).
var fieldsetProperty = archetypeService.getFieldsetProperty(scope);
var oldState = fieldsetProperty.editorState;
archetypeService.ensureTemporaryId(fieldsetProperty);
if (oldState) {
fieldsetProperty.editorState.temporaryId = oldState.temporaryId;
}
//set the config from the prevalues
scope.model.config = config;
@@ -93,9 +99,11 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c
}
}
//upload datatype hack
if(view.indexOf('fileupload.html') != -1) {
//hacks for various built-in datatyps including upload, colorpicker and tags
if (!scope.propertyForm) {
scope.propertyForm = scope.form;
}
if (!scope.model.validation) {
scope.model.validation = {};
scope.model.validation.mandatory = 0;
}
@@ -115,14 +123,16 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c
});
scope.$on('archetypeFormSubmitting', function (ev, args) {
// validate all fieldset properties
_.each(scope.fieldset.properties, function (property) {
archetypeService.validateProperty(scope.fieldset, property, configFieldsetModel);
});
if(args.action !== 'save') {
// validate all fieldset properties
_.each(scope.fieldset.properties, function (property) {
archetypeService.validateProperty(scope.fieldset, property, configFieldsetModel);
});
var validationKey = "validation-f" + scope.fieldsetIndex;
var validationKey = "validation-f" + scope.fieldsetIndex;
ngModelCtrl.$setValidity(validationKey, scope.fieldset.isValid);
ngModelCtrl.$setValidity(validationKey, scope.fieldset.isValid);
}
// did the value change (if it did, it most likely did so during the "formSubmitting" event)
var property = archetypeService.getFieldsetProperty(scope);
+4 -3
View File
@@ -1,11 +1,12 @@
angular.module("umbraco.directives").directive('archetypeSubmitWatcher', function ($rootScope) {
var linker = function (scope, element, attrs, ngModelCtrl) {
// call the load callback on scope to obtain the ID of this submit watcher
var id = scope.loadCallback();
var id = scope.loadCallback ? scope.loadCallback() : 0;
scope.$on("formSubmitting", function (ev, args) {
// on the "formSubmitting" event, call the submit callback on scope to notify the Archetype controller to do it's magic
if (id == scope.activeSubmitWatcher) {
scope.submitCallback();
scope.submitCallback(args);
}
});
}
@@ -21,4 +22,4 @@ angular.module("umbraco.directives").directive('archetypeSubmitWatcher', functio
activeSubmitWatcher: '='
}
}
});
});
+12 -1
View File
@@ -44,5 +44,16 @@
"fieldsetGroups":"Fieldset-grupper",
"fieldsetGroupsDescription":"Hvis du har mange fieldsets, skal du måske overveje at gruppere dem i fieldset-vælgeren. Når du først har defineret dine grupper her, vil en gruppe-vælger dukke op i fieldset-editoren, og du kan derefter vælge grupper for alle dine fieldsets.",
"fieldsetGroupName":"Navn",
"addFieldsetGroup":"Tilføj gruppe"
"addFieldsetGroup":"Tilføj gruppe",
"enablePublishing": "Aktivér fieldset-publicering?",
"enablePublishingDescription": "Tillad automatisk udgivelse og udløb for fieldsets",
"publish": "Publicering",
"publishHelpText": "Konfigurér udgivelses- og udløbsdato for dette element",
"publishReleaseDate": "Udgivelsesdato",
"publishExpireDate": "Udløbsdato",
"settings": "Indstillinger",
"enableMemberGroups": "Aktivér medlems-grupper",
"enableMemerGroupsDescription": "Tillad at fieldsets kun vises for specifikke medlems-grupper",
"allowedMemberGroups": "Tilladte medlems-grupper",
"allowedMemberGroupsHelpText": "Vælg de medlems-grupper, der skal kunne se dette element. Hvis der ikke er valgt nogen, kan alle se elementet."
}
+12 -1
View File
@@ -44,5 +44,16 @@
"fieldsetGroups":"Fieldset-grupper",
"fieldsetGroupsDescription":"Hvis du har mange fieldsets, skal du måske overveje at gruppere dem i fieldset-vælgeren. Når du først har defineret dine grupper her, vil en gruppe-vælger dukke op i fieldset-editoren, og du kan derefter vælge grupper for alle dine fieldsets.",
"fieldsetGroupName":"Navn",
"addFieldsetGroup":"Tilføj gruppe"
"addFieldsetGroup":"Tilføj gruppe",
"enablePublishing": "Aktivér fieldset-publicering?",
"enablePublishingDescription": "Tillad automatisk udgivelse og udløb for fieldsets",
"publish": "Publicering",
"publishHelpText": "Konfigurér udgivelses- og udløbsdato for dette element",
"publishReleaseDate": "Udgivelsesdato",
"publishExpireDate": "Udløbsdato",
"settings": "Indstillinger",
"enableMemberGroups": "Aktivér medlems-grupper",
"enableMemerGroupsDescription": "Tillad at fieldsets kun vises for specifikke medlems-grupper",
"allowedMemberGroups": "Tilladte medlems-grupper",
"allowedMemberGroupsHelpText": "Vælg de medlems-grupper, der skal kunne se dette element. Hvis der ikke er valgt nogen, kan alle se elementet."
}
+2
View File
@@ -41,6 +41,8 @@
"overrideDefaultConverter":"Override Default Property Value Converter?",
"enableCloning":"Enable Cloning?",
"enableCloningDescription":"Enable Fieldset Cloning.",
"enableCrossDragging":"Enable Cross-Archetype Dragging?",
"enableCrossDraggingDescription":"Allows fieldsets to be dragged into other Archetypes.",
"fieldsetGroups":"Fieldset groups",
"fieldsetGroupsDescription":"If you have a lot of fieldsets to choose from, you may want to consider grouping them in the fieldset picker. Once you have created your groups here, a group picker will be displayed in the fieldset editor and you can assign your fieldsets to their respective groups.",
"fieldsetGroupName":"Name",
+2
View File
@@ -41,6 +41,8 @@
"overrideDefaultConverter":"Override Default Property Value Converter?",
"enableCloning":"Enable Cloning?",
"enableCloningDescription":"Enable Fieldset Cloning.",
"enableCrossDragging":"Enable Cross-Archetype Dragging?",
"enableCrossDraggingDescription":"Allows fieldsets to be dragged into other Archetypes.",
"fieldsetGroups":"Fieldset groups",
"fieldsetGroupsDescription":"If you have a lot of fieldsets to choose from, you may want to consider grouping them in the fieldset picker. Once you have created your groups here, a group picker will be displayed in the fieldset editor and you can assign your fieldsets to their respective groups.",
"fieldsetGroupName":"Name",
+2
View File
@@ -41,6 +41,8 @@
"overrideDefaultConverter":"Override Default Property Value Converter?",
"enableCloning":"Enable Cloning?",
"enableCloningDescription":"Enable Fieldset Cloning.",
"enableCrossDragging":"Enable Cross-Archetype Dragging?",
"enableCrossDraggingDescription":"Allows fieldsets to be dragged into other Archetypes.",
"fieldsetGroups":"Fieldset groups",
"fieldsetGroupsDescription":"If you have a lot of fieldsets to choose from, you may want to consider grouping them in the fieldset picker. Once you have created your groups here, a group picker will be displayed in the fieldset editor and you can assign your fieldsets to their respective groups.",
"fieldsetGroupName":"Name",
+118 -28
View File
@@ -33,18 +33,6 @@
margin-left: 0;
}
.icon {
color: #ddd;
padding: 2px;
font-size: 16px;
&:hover {
color: #333;
}
&.icon-delete:hover {
color: #b94a48;
}
}
.fieldsetIcon {
float: left;
padding: 0 4px 0 0;
@@ -52,6 +40,17 @@
vertical-align: text-bottom;
}
.caret {
margin: 8px 1px 0 2px;
&.caret-right {
border-bottom: 4px solid transparent;
border-top: 4px solid transparent;
border-left: 4px solid #ddd;
content: "";
margin-top: 6px;
}
}
fieldset {
border-bottom: 1px dashed #dddddd;
padding: 0;
@@ -76,6 +75,19 @@
}
}
.publishOptions {
.publishDate {
display: inline-block;
vertical-align: top;
margin-right: 20px;
label {
padding: 0 !important;
margin: 0 !important;
}
}
}
}
.archetypeFieldsetLabel {
@@ -127,16 +139,7 @@
}
.caret {
margin: 8px 1px 0 2px;
position: absolute;
&.caret-right {
border-bottom: 4px solid transparent;
border-top: 4px solid transparent;
border-left: 4px solid #ddd;
content: "";
margin-top: 6px;
}
}
label {
@@ -163,6 +166,30 @@
position: absolute;
right: 15px;
top: 0;
.icon {
color: #ddd;
padding: 2px;
font-size: 16px;
&:hover {
color: #333;
}
&.icon-delete:hover {
color: #b94a48;
}
&.icon-disabled {
cursor: default;
&:hover {
color: #ddd;
}
}
&.icon-active {
color: #333;
&:hover {
color: #333;
}
}
}
}
&:hover {
@@ -284,6 +311,54 @@
}
}
}
.settingsWrapper {
&:hover {
caret {
background-color: #333;
}
}
.settingsHeader {
label {
display: inline-block;
}
&:hover {
cursor: pointer;
label {
text-decoration: underline;
}
.caret-right {
border-left-color: #333;
}
}
}
.settings {
padding: 14px;
background-color: #f8f8f8;
overflow: hidden;
.allowedGroups {
.umb-membergrouppicker a {
i {
padding-right: 0;
font-size: inherit;
}
&:hover i {
color: #333;
}
}
}
}
}
// Necessary to ensure empty lists can be dropped onto when sorting nested fieldsets.
.archetypeSortable.archetypeEmpty {
min-height: 42px;
border: 1px dashed #dddddd;
margin-top: 5px;
}
}
.archetypeEditor, .archetypeConfig {
@@ -339,6 +414,7 @@
label {
width: 120px;
padding-left: 0;
}
.archetypeEditorControls {
@@ -362,8 +438,10 @@
.archetypeFieldsetOption {
margin-bottom: 15px;
margin-right: 15px;
input[type=text]{
max-width: 300px;
max-width: 100%;
width: 100%;
}
}
@@ -374,15 +452,20 @@
height: 130px;
}
.archetypeOptions label{
width: 400px;
.archetypeOptions {
.btn {
margin-bottom: 5px;
}
label{
width: 400px;
}
}
.archetypePropertiesWrapper {
border: 1px solid #ddd;
padding: 8px;
margin: -40px 10px 10px 140px;
max-width: 475px;
ul {
padding: 0;
@@ -395,12 +478,13 @@
background-color: #eee;
input[type=text] {
max-width: 190px;
width: auto;
max-width: 100%;
width: 100%;
}
select {
max-width: 160px;
max-width: 100%;
width: 100%;
}
}
@@ -413,6 +497,10 @@
label {
width: 100%;
}
input[type=text] {
width: 100%;
}
input[type=checkbox] {
margin-top: 0;
@@ -460,8 +548,10 @@
.archetypePropertyCollapser {
margin-top: 10px;
div {
margin-bottom: 10px;
margin-right: 15px;
}
}
+14
View File
@@ -31,6 +31,8 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
return coreMediaPicker(value, scope, datatype);
case "Umbraco.DropDown":
return coreDropdown(value, scope, datatype);
case "RJP.MultiUrlPicker":
return rjpMultiUrlPicker(value, scope, {});
default:
return "";
}
@@ -149,6 +151,18 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
return strippedText.substring(0, args.contentLength) + suffix;
}
function rjpMultiUrlPicker(values, scope, args) {
var names = [];
_.each(values, function (value) {
if (value.name) {
names.push(value.name);
}
});
return names.join(", ");
}
return {
getFieldsetTitle: function(scope, fieldsetConfigModel, fieldsetIndex) {
+115 -3
View File
@@ -1,4 +1,11 @@
angular.module('umbraco.services').factory('archetypeService', function () {
// Variables.
var draggedRteArchetype;
var rteClass = ".umb-rte textarea";
var editorSettings = {};
var disabledSortables = [];
//public
return {
//helper that returns a JS ojbect from 'value' string or the original string
@@ -44,7 +51,7 @@ angular.module('umbraco.services').factory('archetypeService', function () {
return property.alias == alias;
});
},
getUniquePropertyAlias: function (currentScope, propertyAliasParts) {
getUniquePropertyAlias: function (currentScope, propertyAliasParts, excludeUniqueId) {
if (currentScope.hasOwnProperty('fieldsetIndex') && currentScope.hasOwnProperty('property') && currentScope.hasOwnProperty('propertyConfigIndex'))
{
var currentPropertyAlias = "f" + currentScope.fieldsetIndex + "-" + currentScope.property.alias + "-p" + currentScope.propertyConfigIndex;
@@ -57,9 +64,15 @@ angular.module('umbraco.services').factory('archetypeService', function () {
}
if (currentScope.$parent)
this.getUniquePropertyAlias(currentScope.$parent, propertyAliasParts);
this.getUniquePropertyAlias(currentScope.$parent, propertyAliasParts, true);
return _.unique(propertyAliasParts).reverse().join("-");
var reversed = _.unique(propertyAliasParts).reverse();
if (!excludeUniqueId) {
reversed.push(_.uniqueId("u-"));
}
return reversed.join("-");
},
getFieldset: function(scope) {
return scope.archetypeRenderModel.fieldsets[scope.fieldsetIndex];
@@ -99,6 +112,105 @@ angular.module('umbraco.services').factory('archetypeService', function () {
// it's the Umbraco way to hide the invalid state when altering an invalid property, even if the new value isn't valid either
property.isValid = true;
this.setFieldsetValidity(fieldset);
},
// This stores the rich text editors in all Archetypes (e.g., during a drag operation).
// Typically, the editors will be restored after the drag completes.
storeEditors: function (element) {
// If there are not tinyMCE editors, this may be undefined.
if (typeof tinyMCE === "undefined") {
return;
}
// Variables.
var self = this;
draggedRteArchetype = element;
// Empty the stored settings.
editorSettings = {};
// For fast lookups, store each editor by the element ID.
var editorsById = {};
for (var i = 0; i < tinyMCE.editors.length; i++) {
var tempEditor = tinyMCE.editors[i];
editorsById[tempEditor.id] = tempEditor;
}
// Process each rich text editor.
$(rteClass).each(function() {
// Variables.
var id = $(this).attr("id");
var editor = editorsById[id];
// Get the property's temporary ID.
var scope = angular.element(this).scope().$parent;
var property = self.getFieldsetProperty(scope);
var tempId = property.editorState.temporaryId;
// Store the editor settings by the temporary ID?
if (editor && editor.settings) {
editorSettings[tempId] = editor.settings;
}
});
},
// This restores the rich text editors in the specified Archetype
// (e.g., after a drop drop operation).
restoreEditors: function(element) {
// If there are not tinyMCE editors, this may be undefined.
if (typeof tinyMCE === "undefined") {
return;
}
// Variables.
var bothElements = element
? element.add(draggedRteArchetype)
: draggedRteArchetype;
var self = this;
// Process each RTE in both Archetypes.
$(rteClass, bothElements).each(function () {
// Variables.
var id = $(this).attr("id");
// Get the stored editor settings.
var scope = angular.element(this).scope().$parent;
var property = self.getFieldsetProperty(scope);
var tempId = property.editorState.temporaryId;
var settings = editorSettings[tempId];
// Remove and reinitialize the editor.
tinyMCE.execCommand("mceRemoveEditor", false, id);
tinyMCE.init(settings);
});
},
// Ensures the specified property has a temporary ID in its editor state,
// optionally forcing one to be regenerated (if specified).
ensureTemporaryId: function(property, regenerateId) {
if (!property.editorState) {
property.editorState = {};
}
var editorState = property.editorState;
if (!editorState.temporaryId || regenerateId) {
editorState.temporaryId = _.uniqueId("property-temp-id-");
}
},
// Remembers a sortable that has been disabled (so it can be enabled later).
rememberDisabledSortable: function(sortable) {
disabledSortables.push(sortable);
},
// Enables all of the sortables that were disabled.
enableSortables: function() {
_.each(disabledSortables, function(sortable) {
sortable.enable();
});
disabledSortables = [];
}
}
});
@@ -3,29 +3,25 @@
<div class="umb-panel-body no-header with-footer umb-scrollable archetypeAdvancedOptions">
<h3><archetype-localize key="developer_options">Developer Options</archetype-localize></h3>
<div>
<label for="archetypeAdvancedOptionsDeepDatatypeRequest"><input type="checkbox" id="archetypeAdvancedOptionsDeepDatatypeRequest" ng-model="model.enableDeepDatatypeRequests"/><archetype-localize key="deepDatatypeRequest">Enable Deep Datatype Requests?</archetype-localize><small><archetype-localize key="deepDatatypeRequestDescription">Allows for easier datatype interception at the cost of caching performance.</archetype-localize></small></label>
<label for="archetypeAdvancedOptionsDeepDatatypeRequest"><input type="checkbox" id="archetypeAdvancedOptionsDeepDatatypeRequest" ng-model="dialogData.model.enableDeepDatatypeRequests" /><archetype-localize key="deepDatatypeRequest">Enable Deep Datatype Requests?</archetype-localize><small><archetype-localize key="deepDatatypeRequestDescription">Allows for easier datatype interception at the cost of caching performance.</archetype-localize></small></label>
</div>
<div>
<label for="archetypeAdvancedOptionsDeveloperMode"><input type="checkbox" id="archetypeAdvancedOptionsDeveloperMode" ng-model="model.developerMode"/><archetype-localize key="toggleDeveloperMode">Enable Developer Mode?</archetype-localize><small><archetype-localize key="toggleDeveloperModeDescription">Toggle Developer Mode</archetype-localize></small></label>
<label for="archetypeAdvancedOptionsDeveloperMode"><input type="checkbox" id="archetypeAdvancedOptionsDeveloperMode" ng-model="dialogData.model.developerMode" /><archetype-localize key="toggleDeveloperMode">Enable Developer Mode?</archetype-localize><small><archetype-localize key="toggleDeveloperModeDescription">Toggle Developer Mode</archetype-localize></small></label>
</div>
<div>
<label for="archetypeOverrideDefaultConverter"><input type="checkbox" id="archetypeOverrideDefaultConverter" ng-model="model.overrideDefaultPropertyValueConverter" /><archetype-localize key="overrideDefaultConverter">Override Default Property Value Converter?</archetype-localize><small><archetype-localize key="overrideDefaultConverterDescription">Check this if you wish to use your own custom property value converter.</archetype-localize></small></label>
<label for="archetypeOverrideDefaultConverter"><input type="checkbox" id="archetypeOverrideDefaultConverter" ng-model="dialogData.model.overrideDefaultPropertyValueConverter" /><archetype-localize key="overrideDefaultConverter">Override Default Property Value Converter?</archetype-localize><small><archetype-localize key="overrideDefaultConverterDescription">Check this if you wish to use your own custom property value converter.</archetype-localize></small></label>
</div>
<div>
<label for="archetypeAdvancedOptionsConfigModel"><archetype-localize key="configModel">Config Model</archetype-localize><small><archetype-localize key="configModelDescription">Be careful editing the text below, it controls the schema for this archetype.</archetype-localize></small></label>
<textarea class="archetypeDeveloperModel" id="archetypeAdvancedOptionsConfigModel" ng-model="model"></textarea>
<textarea class="archetypeDeveloperModel" id="archetypeAdvancedOptionsConfigModel" ng-model="dialogData.model" ng-change="dialogData.modelChanged = true"></textarea>
</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" class="ng-isolate-scope ng-scope">Cancel</localize>
</a>
<button class="btn btn-primary" ng-click="apply()">
<archetype-localize key="button_apply">Apply</archetype-localize>
<button class="btn" ng-click="apply()">
<archetype-localize key="button_close">Close</archetype-localize>
</button>
</div>
</div>
+23 -18
View File
@@ -3,46 +3,55 @@
<div class="umb-panel-body no-header with-footer umb-scrollable archetypeAdvancedOptions">
<h3><archetype-localize key="global_fieldset_options">Global Fieldset Options</archetype-localize></h3>
<div>
<label for="archetypeAdvancedOptionsStartWithAddButton"><input type="checkbox" id="archetypeAdvancedOptionsStartWithAddButton" ng-model="model.startWithAddButton"/><archetype-localize key="startWithAddButton">Start With Add Button?</archetype-localize><small><archetype-localize key="startWithAddButtonDescription">Empty property shows an add button instead of providing a default fieldset.</archetype-localize></small></label>
<label for="archetypeAdvancedOptionsStartWithAddButton"><input type="checkbox" id="archetypeAdvancedOptionsStartWithAddButton" ng-model="dialogData.model.startWithAddButton"/><archetype-localize key="startWithAddButton">Start With Add Button?</archetype-localize><small><archetype-localize key="startWithAddButtonDescription">Empty property shows an add button instead of providing a default fieldset.</archetype-localize></small></label>
</div>
<div>
<label for="archetypeAdvancedOptionsHideLabels"><input type="checkbox" id="archetypeAdvancedOptionsHideLabels" ng-model="model.hidePropertyLabels"/><archetype-localize key="hidePropertyLabels">Hide Property Labels?</archetype-localize><small><archetype-localize key="hidePropertyLabelsDescription">Hides the property labels.</archetype-localize></small></label>
<label for="archetypeAdvancedOptionsHideLabels"><input type="checkbox" id="archetypeAdvancedOptionsHideLabels" ng-model="dialogData.model.hidePropertyLabels"/><archetype-localize key="hidePropertyLabels">Hide Property Labels?</archetype-localize><small><archetype-localize key="hidePropertyLabelsDescription">Hides the property labels.</archetype-localize></small></label>
</div>
<div>
<label for="archetypeAdvancedOptionsCollapsing"><input type="checkbox" id="archetypeAdvancedOptionsCollapsing" ng-model="model.enableCollapsing"/><archetype-localize key="enableCollapsing">Enable Collapsing?</archetype-localize><small><archetype-localize key="enableCollapsingDescription">Enable fieldset collapsing.</archetype-localize></small></label>
<label for="archetypeAdvancedOptionsCollapsing"><input type="checkbox" id="archetypeAdvancedOptionsCollapsing" ng-model="dialogData.model.enableCollapsing"/><archetype-localize key="enableCollapsing">Enable Collapsing?</archetype-localize><small><archetype-localize key="enableCollapsingDescription">Enable fieldset collapsing.</archetype-localize></small></label>
</div>
<div>
<label for="archetypeAdvancedOptionsMaxFieldsets"><archetype-localize key="maxFieldsets">Max Fieldsets</archetype-localize><small><archetype-localize key="maxFieldsetsDescription">How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.</archetype-localize></small></label>
<input type="number" id="archetypeAdvancedOptionsMaxFieldsets" class="archetypeMaxFieldsets" ng-model="model.maxFieldsets"/>
<input type="number" id="archetypeAdvancedOptionsMaxFieldsets" class="archetypeMaxFieldsets" ng-model="dialogData.model.maxFieldsets"/>
</div>
<h4><archetype-localize key="fieldsetControls">Fieldset controls</archetype-localize></h4>
<div>
<label for="archetypeAdvancedOptionsHideControls"><input type="checkbox" id="archetypeAdvancedOptionsHideControls" ng-model="model.hideFieldsetControls"/><archetype-localize key="hideFieldsetControls">Hide Fieldset Controls?</archetype-localize><small><archetype-localize key="hideFieldsetControlsDescription">Hides the fieldset add/remove/sort controls.</archetype-localize></small></label>
<label for="archetypeAdvancedOptionsHideControls"><input type="checkbox" id="archetypeAdvancedOptionsHideControls" ng-model="dialogData.model.hideFieldsetControls"/><archetype-localize key="hideFieldsetControls">Hide Fieldset Controls?</archetype-localize><small><archetype-localize key="hideFieldsetControlsDescription">Hides the fieldset add/remove/sort controls.</archetype-localize></small></label>
</div>
<div>
<label for="archetypeAdvancedOptionsCloning"><input type="checkbox" id="archetypeAdvancedOptionsCloning" ng-model="model.enableCloning"/><archetype-localize key="enableCloning">Enable Cloning?</archetype-localize><small><archetype-localize key="enableCloningDescription">Enable fieldset cloning.</archetype-localize></small></label>
<label for="archetypeAdvancedOptionsCloning"><input type="checkbox" id="archetypeAdvancedOptionsCloning" ng-model="dialogData.model.enableCloning"/><archetype-localize key="enableCloning">Enable Cloning?</archetype-localize><small><archetype-localize key="enableCloningDescription">Enable fieldset cloning.</archetype-localize></small></label>
</div>
<div>
<label for="archetypeAdvancedOptionsDisabling"><input type="checkbox" id="archetypeAdvancedOptionsDisabling" ng-model="model.enableDisabling" /><archetype-localize key="enableDisabling">Enable Fieldset Disabling?</archetype-localize><small><archetype-localize key="enableDisablingDescription">Allows fieldsets to be individually enabled/disabled.</archetype-localize></small></label>
<label for="archetypeAdvancedOptionsDisabling"><input type="checkbox" id="archetypeAdvancedOptionsDisabling" ng-model="dialogData.model.enableDisabling" /><archetype-localize key="enableDisabling">Enable Fieldset Disabling?</archetype-localize><small><archetype-localize key="enableDisablingDescription">Allows fieldsets to be individually enabled/disabled.</archetype-localize></small></label>
</div>
<div>
<label for="archetypeAdvancedOptionsPublishing"><input type="checkbox" id="archetypeAdvancedOptionsPublishing" ng-model="dialogData.model.enablePublishing" /><archetype-localize key="enablePublishing">Enable Fieldset Publishing?</archetype-localize><small><archetype-localize key="enablePublishingDescription">Allows fieldsets to be automatically published and/or unpublished.</archetype-localize></small></label>
</div>
<div>
<label for="archetypeAdvancedOptionsCrossDragging"><input type="checkbox" id="archetypeAdvancedOptionsCrossDragging" ng-model="dialogData.model.enableCrossDragging" /><archetype-localize key="enableCrossDragging">Enable Cross-Archetype Dragging?</archetype-localize><small><archetype-localize key="enableCrossDraggingDescription">Allows fieldsets to be dragged into other Archetypes.</archetype-localize></small></label>
</div>
<div>
<label for="archetypeAdvancedOptionsMemberGroups"><input type="checkbox" id="archetypeAdvancedOptionsMemberGroups" ng-model="dialogData.model.enableMemberGroups" /><archetype-localize key="enableMemberGroups">Enable Member Group Access?</archetype-localize><small><archetype-localize key="enableMemerGroupsDescription">Allows fieldsets to be displayed for specified member groups only.</archetype-localize></small></label>
</div>
<h4><archetype-localize key="multipleFieldsets">Multiple fieldsets</archetype-localize></h4>
<div>
<label for="archetypeAdvancedOptionsMultipleFieldsets"><input type="checkbox" id="archetypeAdvancedOptionsMultipleFieldsets" ng-model="model.enableMultipleFieldsets"/><archetype-localize key="enableMultipleFieldsets">Enable Multiple Fieldsets?</archetype-localize><small><archetype-localize key="enableMultipleFieldsetsDescription">Allows multiple types of fieldsets within this archetype.</archetype-localize></small></label>
<label for="archetypeAdvancedOptionsMultipleFieldsets"><input type="checkbox" id="archetypeAdvancedOptionsMultipleFieldsets" ng-model="dialogData.model.enableMultipleFieldsets"/><archetype-localize key="enableMultipleFieldsets">Enable Multiple Fieldsets?</archetype-localize><small><archetype-localize key="enableMultipleFieldsetsDescription">Allows multiple types of fieldsets within this archetype.</archetype-localize></small></label>
</div>
<div ng-show="model.enableMultipleFieldsets">
<div ng-show="dialogData.model.enableMultipleFieldsets">
<label><archetype-localize key="fieldsetGroups">Fieldset groups</archetype-localize></label>
<small><archetype-localize key="fieldsetGroupsDescription">If you have a lot of fieldsets to choose from, you may want to consider grouping them in the fieldset picker. Once you have created your groups here, a group picker will be displayed in the fieldset editor and you can assign your fieldsets to their respective groups.</archetype-localize></small>
<div class="archetypeFieldsetGroups">
<ul ui-sortable="sortableOptions" ng-model="model.fieldsetGroups">
<li ng-repeat="fieldsetGroup in model.fieldsetGroups">
<ul ui-sortable="sortableOptions" ng-model="dialogData.model.fieldsetGroups">
<li ng-repeat="fieldsetGroup in dialogData.model.fieldsetGroups">
<div>
<input id="archetypeFieldsetGroupName_{{$index}}" type="text" ng-model="fieldsetGroup.name" />
<i class="icon icon-delete" ng-click="removeFieldsetGroup($index)"></i>
<i class="icon icon-navigation handle" ng-show="model.fieldsetGroups.length > 1"></i>
<i class="icon icon-navigation handle" ng-show="dialogData.model.fieldsetGroups.length > 1"></i>
</div>
</li>
</ul>
@@ -53,12 +62,8 @@
<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" class="ng-isolate-scope ng-scope">Cancel</localize>
</a>
<button class="btn btn-primary" ng-click="apply()">
<archetype-localize key="button_apply">Apply</archetype-localize>
<button class="btn" ng-click="apply()">
<archetype-localize key="button_close">Close</archetype-localize>
</button>
</div>
</div>
@@ -4,30 +4,26 @@
<h3><archetype-localize key="custom_style_script_options">Custom Style/Script Options</archetype-localize></h3>
<div>
<label for="archetypeAdvancedOptionsCustomClass"><archetype-localize key="customWrapperClass">Custom Wrapper Class</archetype-localize><small><archetype-localize key="customWrapperClassDescription">(Optional) Enter a custom CSS class that will be applied to the wrapper div.</archetype-localize></small></label>
<input type="text" id="archetypeAdvancedOptionsCustomClass" ng-model="model.customCssClass"/>
<input type="text" id="archetypeAdvancedOptionsCustomClass" ng-model="dialogData.model.customCssClass"/>
</div>
<div>
<label for="archetypeAdvancedOptionsCustomCss"><archetype-localize key="cssFile">CSS File</archetype-localize><small><archetype-localize key="cssFileDescription">(Optional) Enter a path for a custom CSS file to be included on the page.</archetype-localize></small></label>
<input type="text" id="archetypeAdvancedOptionsCustomCss" ng-model="model.customCssPath"/>
<input type="text" id="archetypeAdvancedOptionsCustomCss" ng-model="dialogData.model.customCssPath"/>
</div>
<div>
<label for="archetypeAdvancedOptionsCustomJs"><archetype-localize key="jsFile">JS File</archetype-localize><small><archetype-localize key="jsFileDescription">(Optional) Enter a path for a custom JS file to be included on the page.</archetype-localize></small></label>
<input type="text" id="archetypeAdvancedOptionsCustomJs" ng-model="model.customJsPath"/>
<input type="text" id="archetypeAdvancedOptionsCustomJs" ng-model="dialogData.model.customJsPath"/>
</div>
<div>
<label for="archetypeAdvancedOptionsCustomView"><archetype-localize key="viewFile">View File</archetype-localize><small><archetype-localize key="viewFileDescription">(Optional) Enter a path for a custom view file to be used to render this Archetype.</archetype-localize></small></label>
<input type="text" id="archetypeAdvancedOptionsCustomView" ng-model="model.customViewPath"/>
<input type="text" id="archetypeAdvancedOptionsCustomView" ng-model="dialogData.model.customViewPath"/>
</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" class="ng-isolate-scope ng-scope">Cancel</localize>
</a>
<button class="btn btn-primary" ng-click="apply()">
<archetype-localize key="button_apply">Apply</archetype-localize>
<button class="btn" ng-click="apply()">
<archetype-localize key="button_close">Close</archetype-localize>
</button>
</div>
</div>
+68 -13
View File
@@ -1,14 +1,23 @@
{{VERSION_HTML}}
<div class="archetypeEditor ng-class:model.config.customCssClass">
<textarea class="archetypeDeveloperModel" ng-show="model.config.developerMode" ng-model="model.value"></textarea>
<ul ui-sortable="sortableOptions" ng-model="model.value.fieldsets" ng-show="!showAddButton()">
<!-- "Add" button. -->
<div ng-show="showAddButton()">
<a class="archetypeAddButton" ng-click="openFieldsetPicker(0, $event)" prevent-default>
<i class="icon icon-add"></i>
<archetype-localize key="addFieldset">Add an item</archetype-localize>
</a>
</div>
<!-- Fieldsets. -->
<ul ui-sortable="sortableOptions" class="archetypeSortable" ng-class="{archetypeEmpty: model.value.fieldsets.length === 0 || sortingLastItem()}" ng-model="model.value.fieldsets">
<li ng-repeat="fieldset in model.value.fieldsets">
<fieldset ng-class="['archetype-fieldset-' + fieldset.alias, (getFieldsetValidity(fieldset) == false ? 'archetypeFieldsetError' : '')]" ng-init="fieldsetConfigModel = getConfigFieldsetByAlias(fieldset.alias)">
<div class="archetypeFieldsetLabel" ng-class="{enableCollapsing: model.config.enableCollapsing}">
<div ng-click="focusFieldset(fieldset)" class="label-sub module-label">
<span class="caret" ng-hide="fieldset.collapse || !model.config.enableCollapsing"></span>
<span class="caret caret-right" ng-show="fieldset.collapse && model.config.enableCollapsing"></span>
<label ng-class="{dimmed: fieldset.disabled}">
<span class="caret" ng-class="{'caret-right': isCollapsed(fieldset)}" ng-show="model.config.enableCollapsing"></span>
<label ng-class="{dimmed: isDisabled(fieldset)}">
<i class="fieldsetIcon icon ng-class:fieldsetConfigModel.icon"></i>
<span ng-bind="getFieldsetTitle(fieldsetConfigModel, $index)"></span>
</label>
@@ -17,14 +26,15 @@
<i class="icon icon-add" ng-show="canAdd()" ng-click="openFieldsetPicker($index, $event)"></i>
<i class="icon icon-navigation handle" ng-show="canSort()"></i>
<i class="icon icon-documents" ng-click="cloneRow($index)" ng-show="canClone()"></i>
<i class="icon icon-power" ng-click="enableDisable(fieldset)" ng-show="canDisable()"></i>
<i class="icon icon-power" ng-class="{'icon-active': fieldset.disabled}" ng-click="enableDisable(fieldset)" ng-show="showDisableIcon(fieldset)"></i>
<i class="icon icon-time icon-disabled" ng-class="{'icon-active': isDisabledByPublishing(fieldset)}" ng-show="showPublishingIcon(fieldset)"></i>
<i class="icon icon-delete" ng-click="removeRow($index)" ng-show="canRemove()"></i>
</div>
</div>
<div class="archetypeCollapser animate-hide" ng-hide="model.config.enableCollapsing && isCollapsed(fieldset)">
<div class="archetypeCollapser animate-hide" ng-hide="model.config.enableCollapsing && isCollapsed(fieldset)" ng-if="isLoaded(fieldset)">
<form class="form-inline">
<div ng-class="[('archetype-property-' + property.alias), (getPropertyValidity($parent.$index, property.alias) === false ? 'archetypePropertyError' : '')]" class="archetypeProperty control-group" ng-repeat="property in fieldsetConfigModel.properties">
<label ng-hide="model.config.hidePropertyLabels == '1'" class="control-label" for="archetype-property-{{model.alias}}-{{$parent.$index}}-{{$index}}">
<label ng-hide="model.config.hidePropertyLabels == '1'" class="control-label" for="archetype-property-{{model.alias}}-f{{$parent.$index}}-{{property.alias}}-p{{$index}}" ng-attr-title="{{ isDebuggingEnabled || model.config.developerMode ? property.alias : null }}">
<span>{{property.label}}</span>
<div class="archetypeFieldsetHelpText" ng-show="property.helpText">
<small>{{property.helpText}}</small>
@@ -36,17 +46,62 @@
<archetype-submit-watcher active-submit-watcher="activeSubmitWatcher" load-callback="submitWatcherOnLoad" submit-callback="submitWatcherOnSubmit"></archetype-submit-watcher>
</div>
</div>
<div class="control-group archetypeProperty settingsWrapper" ng-show="canConfigure()">
<div ng-click="showSettings = !showSettings" class="settingsHeader">
<span class="caret" ng-show="showSettings"></span>
<span class="caret caret-right" ng-hide="showSettings"></span>
<label>
<span><archetype-localize key="settings">Settings</archetype-localize></span>
</label>
</div>
<div class="settings" ng-show="showSettings">
<!-- misc fieldset settings go here -->
<div ng-if="fieldset.releaseDateModel" ng-show="canPublish()" class="control-group">
<label ng-hide="model.config.hidePropertyLabels == '1'" class="control-label">
<span><archetype-localize key="publish">Publishing</archetype-localize></span>
<div class="archetypeFieldsetHelpText">
<small><archetype-localize key="publishHelpText">Configure automatic publishing and/or unpublishing of this item</archetype-localize></small>
</div>
</label>
<div class="publishOptions" ng-class="[(model.config.hidePropertyLabels == '1' ? 'controls-no-label' : 'controls')]">
<div class="publishDate">
<label for="{{fieldset.releaseDateModel.alias}}">
<archetype-localize key="publishReleaseDate">Publish at</archetype-localize>
</label>
<umb-editor model="fieldset.releaseDateModel"></umb-editor>
</div>
<div class="publishDate">
<label for="{{fieldset.expireDateModel.alias}}">
<archetype-localize key="publishExpireDate">Unpublish at</archetype-localize>
</label>
<umb-editor model="fieldset.expireDateModel"></umb-editor>
</div>
<!-- we need a submit watcher here to make sure the publish dates are saved back to their models -->
<archetype-submit-watcher active-submit-watcher="activeSubmitWatcher" load-callback="submitWatcherOnLoad" submit-callback="submitWatcherOnSubmit"></archetype-submit-watcher>
</div>
</div>
<div ng-if="fieldset.allowedMemberGroupsModel" ng-show="canUseMemberGroups()" class="control-group allowedGroups">
<label ng-hide="model.config.hidePropertyLabels == '1'" class="control-label">
<span><archetype-localize key="allowedMemberGroups">Allowed member groups</archetype-localize></span>
<div class="archetypeFieldsetHelpText">
<small><archetype-localize key="allowedMemberGroupsHelpText">Choose the member groups that should be allowed to see this item. Leave empty to allow all member groups.</archetype-localize></small>
</div>
</label>
<div ng-class="[(model.config.hidePropertyLabels == '1' ? 'controls-no-label' : 'controls')]">
<umb-editor model="fieldset.allowedMemberGroupsModel"></umb-editor>
</div>
<!-- we need a submit watcher here to make sure the allowed member groups are saved back to the model -->
<archetype-submit-watcher active-submit-watcher="activeSubmitWatcher" load-callback="submitWatcherOnLoad" submit-callback="submitWatcherOnSubmit"></archetype-submit-watcher>
</div>
</div>
</div>
</form>
</div>
</fieldset>
</li>
</ul>
<div ng-show="showAddButton()">
<a class="archetypeAddButton" ng-click="openFieldsetPicker(0, $event)" prevent-default>
<i class="icon icon-add"></i>
<archetype-localize key="addFieldset">Add an item</archetype-localize>
</a>
</div>
<!-- Fieldset picker. -->
<div class="usky-grid fieldsetPicker" ng-class="{withGroups: overlayMenu.fieldsetGroups.length > 1}" ng-if="overlayMenu.show">
<div class="cell-tools-menu" ng-style="overlayMenu.style" delayed-mouseleave="closeFieldsetPicker()" archetype-click-outside="closeFieldsetPicker()">
<h5>
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "Archetype",
"version": "1.11",
"version": "1.13.0",
"url": "http://github.com/imulus/archetype/",
"author": "Imulus - Kevin Giszewski - Tom Fulton - Lee Kelleher - Matt Brailsford - Kenn Jacobsen - Et. Al.",
"authorUrl": "http://imulus.com/",
+1 -1
View File
@@ -12,7 +12,7 @@
<iconUrl>http://github.com/imulus/archetype/raw/master/assets/logo.png</iconUrl>
<licenseUrl><%= licenseUrl %></licenseUrl>
<dependencies>
<dependency id="UmbracoCms.Core" version="7.2.2" />
<dependency id="Archetype.Binaries" version="<%= version %>" />
</dependencies>
</metadata>
</package>
-39
View File
@@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<umbPackage>
<info>
<package>
<name><%= name %></name>
<version><%= version %></version>
<license url="<%= licenseUrl %>"><%= license %></license>
<url><%= url %></url>
<requirements>
<major>0</major>
<minor>0</minor>
<patch>0</patch>
</requirements>
</package>
<author>
<name><%= author %></name>
<website><%= authorUrl %></website>
</author>
<readme><![CDATA[<%= readmeContents %>]]></readme>
</info>
<DocumentTypes />
<Templates />
<Stylesheets />
<Macros />
<DictionaryItems />
<Languages />
<DataTypes />
<control />
<Actions />
<files>
<% files.forEach(function(file) { %>
<file>
<guid><%= file.guid %>.<%= file.ext %></guid>
<orgPath><%= file.dir %></orgPath>
<orgName><%= file.name %></orgName>
</file>
<% }); %>
</files>
</umbPackage>
+18
View File
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>Archetype.Binaries</id>
<version><%= version %></version>
<title><%= name %></title>
<authors>imulus, kgiszewski, tomfulton</authors>
<owners>imulus, kgiszewski, tomfulton</owners>
<projectUrl>http://github.com/imulus/archetype</projectUrl>
<description><![CDATA[Archetype binaries for Umbraco]]></description>
<tags>umbraco</tags>
<iconUrl>http://github.com/imulus/archetype/raw/master/assets/logo.png</iconUrl>
<licenseUrl><%= licenseUrl %></licenseUrl>
<dependencies>
<dependency id="UmbracoCms.Core" version="7.2.2" />
</dependencies>
</metadata>
</package>
+18
View File
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>Archetype.Courier</id>
<version><%= version %></version>
<title><%= name %></title>
<authors>leekelleher</authors>
<owners>kgiszewski, leekelleher</owners>
<projectUrl>http://github.com/imulus/archetype</projectUrl>
<description><![CDATA[Archetype Courier extension for Umbraco]]></description>
<tags>umbraco</tags>
<iconUrl>http://github.com/imulus/archetype/raw/master/assets/logo.png</iconUrl>
<licenseUrl><%= licenseUrl %></licenseUrl>
<dependencies>
<dependency id="Archetype.Binaries" version="<%= version %>" />
</dependencies>
</metadata>
</package>
+1 -1
View File
@@ -22,7 +22,7 @@
"grunt-msbuild": "~0.1.9",
"grunt-dotnet-assembly-info": "~1.0.9",
"load-grunt-tasks": "~0.4.0",
"grunt-umbraco-package": "0.0.6"
"grunt-umbraco-package": "^1.0.0"
},
"repository": {
"type": "git",