Compare commits

...

384 Commits

Author SHA1 Message Date
perploug f916a6bc18 fixes datepicker css ref issue 2013-11-21 12:15:20 +01:00
perploug 8865f798a6 fixes media dialog sync issues 2013-11-21 12:15:03 +01:00
Tim Geyssens 362bb593f1 Adds value convertor for rel links 2013-11-21 11:48:07 +01:00
Tim Geyssens 4dc7b185aa another update to rel links data migration 2013-11-21 11:27:34 +01:00
Tim Geyssens d0d1b2675d Some changes to related links to make sure peoples front end code will still work 2013-11-21 11:24:46 +01:00
Tim Geyssens b624d87a59 make sure related links datatype value type is set to JSON 2013-11-21 11:17:43 +01:00
perploug aa75a6bf9f Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-21 11:14:25 +01:00
perploug 14a0efde01 Minor width adjustment 2013-11-21 11:13:53 +01:00
Tim Geyssens 1c20496974 removes cs from rel links data upgrader, was getting lock issues 2013-11-21 11:13:21 +01:00
perploug 309dd5d4a2 content dashboard 2013-11-21 11:09:20 +01:00
Tim Geyssens 92c28de028 Final touches to rel links data upgrader 2013-11-21 10:41:42 +01:00
Tim Geyssens 16ea928c75 rel links data upgrader, migration is working :) 2013-11-21 10:30:27 +01:00
Tim Geyssens 31f67eac6c uses newtonsoft json serializer on rel link data upgrader 2013-11-21 10:20:18 +01:00
Sebastiaan Janssen a04aef9b98 U4-3623 Text corrections in install wizard 2013-11-21 10:17:52 +01:00
Niels Hartvig 9f046f9945 Updates default dashboards 2013-11-21 09:58:27 +01:00
Tim Geyssens 64cae76dca And yet another small update to rel links data upgrader 2013-11-21 09:57:18 +01:00
Tim Geyssens b6e4a96e3b Another small update to rel links data upgrader 2013-11-21 09:35:20 +01:00
Tim Geyssens 82154ee660 Small update to rel links data upgrader 2013-11-21 09:23:41 +01:00
Sebastiaan Janssen 655075aabe Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-21 08:53:56 +01:00
Sebastiaan Janssen 3773cac232 Limit MVC and WebAPI to version 4 for now until we can test 5. 2013-11-21 08:53:40 +01:00
Tim Geyssens 05cd6500ba Adds some exception handling to the rel links data upgrader, always nice not to blow up the upgrader 2013-11-21 08:53:13 +01:00
Tim Geyssens 345340b957 Adds rel links data upgrader 2013-11-21 08:45:46 +01:00
Shannon 22be517daf publicizes the legacy parameter editor alias map, ensures that a YSOD is not shown when a legacy parameter editor is trying to be rendered, we just render a text box in its place 2013-11-21 18:10:47 +11:00
Shannon 8860e77468 Fixes tests 2013-11-21 17:47:23 +11:00
Shannon ffeed58f5d Fixes: U4-3576 When editing file based items and changing the file name - we need to change the route location 2013-11-21 17:23:48 +11:00
Shannon 6fd5eee4f6 Fixes: U4-3591 Creating PropertyValueConverter for a v7 prop editor (created with manifest) ends up with YSOD when outputting value on frontend 2013-11-21 16:39:21 +11:00
Shannon 4354840674 Fixes an issue with member search 2013-11-21 15:57:53 +11:00
Shannon 6d1ba5a823 Fixes: U4-3625 List view filtering is not enabled on media and adds debounce 2013-11-21 15:52:40 +11:00
Shannon eee63e3a48 Fixes: U4-3626 List view filtering needs to be applied using debounce 2013-11-21 15:04:10 +11:00
Shannon abd1c89660 Changes locker to be static 2013-11-21 14:42:35 +11:00
Shannon 9acaa82d4b Fixes hash generation and checking with the trees.config file - since this is changed during startup our plugin cache was never active :( 2013-11-21 14:01:54 +11:00
Shannon d5dc5127ae Ensures the approved check box is checked when creating a new member. 2013-11-21 12:17:07 +11:00
Shannon d8862c85bf Fixes tags property editor to not submit the html form when pressing enter. 2013-11-21 12:16:26 +11:00
Shannon 874c7977c2 updates typefinder assembly ignore list - ensures that we scan the providers dll and ignores some other new ones (should slightly speed up startup) 2013-11-21 12:15:59 +11:00
Shannon fa34652cf1 Fixes: U4-3588 Value cannot be null. Parameter name: child error when using the Login Macro 2013-11-21 11:08:33 +11:00
Shannon 22c615a641 fixes filtering issue 2013-11-21 10:39:10 +11:00
perploug 2ffc64b965 Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-21 00:15:31 +01:00
perploug 4c932f013a fixes delete dialog missing spacing 2013-11-21 00:15:08 +01:00
perploug 52b40ac514 fixes tree item style reload 2013-11-21 00:14:51 +01:00
perploug 631710222f fixes media picker single-item mode 2013-11-21 00:14:37 +01:00
perploug 2824a2ca8b fixes simple create tree reload 2013-11-21 00:14:10 +01:00
Shandem c90af1df39 Merge pull request #253 from greystate/7.0.0__U4-3581
Returning root element instead of document node from JsonToXml()
2013-11-20 15:08:51 -08:00
perploug c679e00b81 minor change in iframe offloading 2013-11-20 20:14:58 +01:00
perploug c6caa6aae7 Missing dictionary items 2013-11-20 15:59:25 +01:00
perploug 1b1642ce46 fixes broken script dialog and tree sync 2013-11-20 15:33:24 +01:00
perploug 31d0450d6c fixes broke xslt visualizer 2013-11-20 15:08:04 +01:00
perploug a71d18f352 Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-20 14:55:09 +01:00
perploug 12c982f170 ups, forgot an alert() 2013-11-20 14:54:27 +01:00
Sebastiaan Janssen 35af370f70 Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-20 14:51:50 +01:00
Sebastiaan Janssen bbee0a81c9 Undo "fix" for starter kit installer, we'll fix properly later 2013-11-20 14:51:35 +01:00
Sebastiaan Janssen 2beb3c5b4c Merge branch 'master' of https://github.com/umbraco/Umbraco-CMS into 7.0.0
Conflicts:
	.gitignore
2013-11-20 14:50:57 +01:00
perploug f7d407e9fd various dialogs fixes 2013-11-20 14:37:46 +01:00
perploug d67db8a90a Fixes ctrl+s hotkeys in legacy editors 2013-11-20 14:37:28 +01:00
Chriztian Steinmeier 98e7ee90f4 Minor pedantic casing change 2013-11-20 14:20:22 +01:00
Chriztian Steinmeier 90c4358844 Return the root element instead of document node 2013-11-20 14:19:39 +01:00
perploug 2cb4b207dc fixes broken merge 2013-11-20 13:41:31 +01:00
perploug b80b2475e0 Merge 2013-11-20 13:34:42 +01:00
perploug 94bbcb98a6 adds filter to getChildren 2013-11-20 10:24:45 +01:00
perploug 26f79e1010 Fixed attribute filtering when no items should be filtered 2013-11-20 10:24:35 +01:00
Stephan a626eeff7d U4-3591 - more explicit exception when two IPropertyValueConverter collides 2013-11-20 09:58:28 +01:00
Shannon 84353d1e77 Fixes: U4-3587 Can't delete a member when there is a group assigned 2013-11-20 18:23:23 +11:00
Shannon 39aa100490 Fixes: U4-3572 CSS class changes are not applied to tree nodes after resync 2013-11-20 18:10:54 +11:00
Shannon d1a656b3cd FIxes installer when duplicate conflicts: U4-3612 Cannot install Txt starter kit in the back office 2013-11-20 17:25:25 +11:00
Shannon d87db5b338 Shows an error notification if there is a ysod when not in debug mode so the user at least knows something has gone wrong. 2013-11-20 17:24:45 +11:00
Shannon 0a11f31754 Fixes: U4-3610 When adding another tab to a member type no members will load and result in a YSOD 2013-11-20 16:58:25 +11:00
Shannon 0c226d1a2c Fixes: U4-3581 Make sure advanced v7 prop editors can also be used from xslt 2013-11-20 15:54:50 +11:00
Shannon 596cf2a9e1 Ensures that members are auto-approved if creating a member via the legacy members API. 2013-11-20 15:11:08 +11:00
Shannon 2f089128d7 Fixes: U4-3608 When logged in as a user with a custom start node the media thumbs do not display on a folder 2013-11-20 14:48:11 +11:00
Shannon b52b649548 Fixes: U4-3209 Ensure user is validated for PostAddFile on MediaController 2013-11-20 14:41:05 +11:00
Shannon 7e4739956a Ensures that tree requests have section security applied, though it's not perfect until we have security by tree and section it ensures that a user cannot list out tree data when they don't have access to a section in which that tree's data is required. Now the root node requests via the application tree controller have their auth filters applied (that took quite a lot of zany work). Gets AD login working nicely too. 2013-11-20 14:18:03 +11:00
Shannon e040fc8819 Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-20 08:55:38 +11:00
Shannon c2a858b903 Ensures approval status is checked when validating a member 2013-11-20 08:55:09 +11:00
perploug e1108ce65b Removes extra line on datatype editor 2013-11-19 22:35:41 +01:00
perploug a6e93879c2 Adds overload to file system tree to allow multiple file extensions filter 2013-11-19 21:57:07 +01:00
perploug 56e9d0a602 Adds documentation for missing resource methods 2013-11-19 21:56:35 +01:00
perploug 23d5d117e7 Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-19 20:38:00 +01:00
perploug daa4ff28e7 Fixes missing section state indicator 2013-11-19 20:37:39 +01:00
Sebastiaan Janssen 291fcb043c Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-19 20:30:45 +01:00
Sebastiaan Janssen dea1e9e541 Whoops, my last fix was a bit too broad 2013-11-19 20:30:28 +01:00
perploug ca8b6cac7a updated testrunner config 2013-11-19 20:24:29 +01:00
perploug 6cf9312d1a editorState docs 2013-11-19 20:24:19 +01:00
perploug 45868d3fec Fixes repo browser 404 issue 2013-11-19 20:23:56 +01:00
Sebastiaan Janssen 3d90e66d36 Bump version number 2013-11-19 19:20:07 +01:00
Sebastiaan Janssen 836177a90f Fixes issue where media cache is not properly populated with isDoc and image propertyTypes 2013-11-19 19:11:48 +01:00
Sebastiaan Janssen 14bb0ce4d8 At least a temporary fix of the starter kit installer 2013-11-19 18:01:09 +01:00
perploug c6720ff42c Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-19 16:26:54 +01:00
perploug 863c7d11b7 Moves the folder selector on the mediapicker
To the item itself, instead of external button
2013-11-19 16:26:07 +01:00
Sebastiaan Janssen 53c043d22e Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-19 16:06:26 +01:00
Sebastiaan Janssen 7e70253e1c U4-3340 Installer: Make SQL CE Default option 2013-11-19 16:06:14 +01:00
perploug b6bca084c5 Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-19 15:46:04 +01:00
perploug 0a7e09b3dd revert logo to good ol' orange 2013-11-19 15:45:53 +01:00
Sebastiaan Janssen 313b831559 Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-19 15:13:18 +01:00
Sebastiaan Janssen 355137f982 U4-3469 Umbraco 7 + MVC 4 + nuget, web.config error 2013-11-19 15:12:47 +01:00
perploug 6cd09e7b86 minor css tweaks 2013-11-19 14:33:00 +01:00
perploug e80023bcff Adjusts the media picker to display folders properly 2013-11-19 14:21:38 +01:00
perploug d1c7a3764f enables the media picker to select current folder 2013-11-19 14:21:17 +01:00
perploug 806596f04d Disables the tree header when it has a alt start node 2013-11-19 14:20:51 +01:00
perploug 77889f968b turns off imagecropper toxml which has caused issues 2013-11-19 14:19:41 +01:00
perploug 7cb496ee3c WIP on better mediapicker view 2013-11-19 11:10:58 +01:00
perploug fb1d6436b7 wrap rules request in a $q.all() to await response 2013-11-19 11:10:01 +01:00
perploug f749886bf4 disable caching on style rules resource 2013-11-19 11:08:51 +01:00
perploug 11c35977d3 fixes broken legacy pickers 2013-11-19 11:06:09 +01:00
perploug 66119ba3d8 fixes linkpicker broken due to new NiceUrl format 2013-11-19 09:06:43 +01:00
Shannon 31ab56a3c1 Got AD members listed in the tree but we won't be able to edit them till 7.1, now to get login going. 2013-11-19 18:31:15 +11:00
Shannon 640967666f fixes issue with the guid converter 2013-11-19 18:09:23 +11:00
Shannon e2890d4186 reverts the installer to ensure media picker is included along with multiple media picker - people will want both and this fixes a failing test. 2013-11-19 17:52:20 +11:00
Shannon 1e2688b14d fixes some more unit tests 2013-11-19 17:41:48 +11:00
Shannon 5fc82fef18 Fixes: U4-3440 Tempates (MVC Views) tree sync doesn't work correctly 2013-11-19 17:17:39 +11:00
Shannon d3b8ac31c7 Fixes up a bunch of failing tests with hard coded ids. Still need to fix a few more 2013-11-19 15:36:30 +11:00
Shannon a11b326c22 Fixes: U4-3574 right click menu options for trees emit events for all nested nodes involved 2013-11-19 14:12:33 +11:00
Shannon 7f012de43e renames utill to have one "l" (utility) 2013-11-19 14:08:51 +11:00
Shannon 7752aaabfe Updates tree/resource/service so that devs can provider their own custom query string data to load trees/dialogs if required. 2013-11-19 14:05:14 +11:00
Shannon f7e86f6b09 Fixes: U4-3555 Membership tree letters should not contain the 'delete' action 2013-11-19 13:18:33 +11:00
Shannon e502579319 Fixes up security check for start node for mntp 2013-11-19 12:28:50 +11:00
Shannon 2f42fc61bf Changed method signatures of some of the conversion methods on the PropertyValueEditor to make it more flexible for developers to do what they want. 2013-11-19 11:51:01 +11:00
Shannon ac2009e4ae Fixes up CData issues - true/false editor had incorrect value type - changed to INT, drop down had incorrect value type - changed to STRING, changed logic to check for empty/null values, if so never return CData as this just takes up more un-needed space 2013-11-19 10:54:28 +11:00
Shannon 44404b70e1 fixes up protected field - changes to private 2013-11-19 10:40:21 +11:00
Shannon 5bb68f32bf Fixes up editorState - ensures that it is set in all of the correct places (removes appState editingEntity and references), ensures that setting 'current' is not possible, ensures that editorState is reset on all route changes, adds unit tests for getting/setting editorState. 2013-11-19 10:39:18 +11:00
Shannon 89b20a2e77 Updates installer to not install the legacy 'Media Picker' by default and instead install the newer "Multiple Media Picker" which has been given new ids. 2013-11-19 10:11:39 +11:00
Shannon d2a00f5c18 media folders are not containers by default: U4-3566 Don't make Media Folders "Listviews" by default 2013-11-19 09:39:14 +11:00
perploug 91bcb656ec adds basic media controller mocks and tests 2013-11-18 22:29:38 +01:00
perploug 4fea694c6a Loads content and media trees with a custom root 2013-11-18 22:29:19 +01:00
perploug abce483d0e Fixes right-click on li in the tree 2013-11-18 21:07:17 +01:00
perploug 8d0603b11c fixes mntp startnode issue 2013-11-18 20:44:12 +01:00
perploug 6d516212eb Changes the default media picker to a multiple-node one 2013-11-18 20:43:42 +01:00
perploug c3fd4bd685 Adds editorState to media, datatype, content, and member editors 2013-11-18 20:43:21 +01:00
Sebastiaan Janssen e922ca88f2 U4-3553 Settings - Document Type - Tabs do not work 2013-11-18 18:54:55 +01:00
Sebastiaan Janssen 64d5533274 Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-18 18:11:46 +01:00
Sebastiaan Janssen 734895c90c U4-3328 404 on zoom-in.png during install 2013-11-18 18:11:26 +01:00
Sebastiaan Janssen a009cad200 Wrong bootstrap file reference, error was hidden by Client Dependency framework 2013-11-18 18:08:38 +01:00
perploug b743ea4fb8 Changes treepicker to tree source on the mntp settings 2013-11-18 16:14:49 +01:00
perploug ed54b55965 Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-18 14:59:30 +01:00
perploug 82e9ab1825 Adds multipicking as a setting on media picker 2013-11-18 14:59:02 +01:00
perploug da2f3aefe6 Improves media drag n drop sorting 2013-11-18 14:58:29 +01:00
Sebastiaan Janssen 17db60c34a Fixes U4-3399 - Adds some nuget dependencies and we don't need the dummy in macroscripts
any more nor do we need to preventatively delete json.net any more.
2013-11-18 14:51:12 +01:00
perploug 9ae9a4e52d fixes serverside part of legacy pickers 2013-11-18 11:49:11 +01:00
perploug 4dbd1d3ca7 adds section to page title 2013-11-18 11:48:58 +01:00
perploug f758634a90 lofgin autofocus 2013-11-18 11:01:13 +01:00
perploug c302de6bdf adds link to upload property editor 2013-11-18 11:01:05 +01:00
perploug e3ec0c1019 fixes missing tinymce buttons 2013-11-18 10:48:46 +01:00
perploug a9dd33908c Fixes missing header validation 2013-11-18 10:48:33 +01:00
Shannon 21e3893528 Fixes: U4-3558 members tree syncing is a bit strange and not showing the selected member 2013-11-18 15:58:53 +11:00
Shannon f8e17b711e custom membership providers now working in the back office. 2013-11-18 15:29:53 +11:00
Shannon 4d31512ef0 Custom membership provider's now working in the back office UI - have created intial functionality to allow custom properties with custom membership providers (the creation already performs the link if the Member member type is available). Updating also works too, need to clean up some code though as it's fairly messy. 2013-11-18 14:25:08 +11:00
Shannon 1707e6b18f Added ability for a menu item to simply navigate to a route, adding functoinality for us to create/edit/delete members based on a generic membership provider. 2013-11-17 13:43:04 +11:00
perploug 9212033858 Allows people to click tree to close dialogs 2013-11-16 10:38:14 +01:00
perploug 6effcf82ac Fixes legacy dialog .destroy issues 2013-11-16 10:38:02 +01:00
perploug 71a0c45889 Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-15 08:35:53 +01:00
Shannon febe81105b starts fixing custom membership provider problems with the member editor/tree - this now at least loads in the members section. 2013-11-15 18:26:40 +11:00
Shannon 830d6d914f puts the test init code back in that shouldn't need to be there but the server is failing now for some reason. 2013-11-15 18:21:55 +11:00
Shannon 259d8e03db completes: U4-3300 Need to test content service copy API with tags - since there's 'special' code in there to handle it that's not been tested with the new changes - with test 2013-11-15 17:54:01 +11:00
Shannon 2784e2a22d removes ref to missing file 2013-11-15 17:30:26 +11:00
Shannon 94cc49e67e Fixed the model mapping tests 2013-11-15 17:15:59 +11:00
Shannon 2bd91d619d fixes failing unit test due to default value change for keep user logged in 2013-11-15 17:04:45 +11:00
Shannon d446d84cf5 fixes failing unit test due to default package url change 2013-11-15 17:03:29 +11:00
Shannon 5244f75d0d Merge remote-tracking branch 'origin/6.2.0' into 7.0.0 2013-11-15 17:01:13 +11:00
Shandem 96440c9ee5 Merge pull request #248 from lars-erik/6.2.0-fix-sqlsyntaxprovider-indexclustring
6.2.0 fix sqlsyntaxprovider indexclustring
2013-11-14 22:00:31 -08:00
Shannon 4545af0a21 Boom! container nodes work for both media and content, fixes:
U4-3540 When creating a Container type node - the list view shows all children of the item it's being created underneath
U4-3541 media tree is not catering for container types
2013-11-15 16:56:51 +11:00
Shannon 0878de4a8b Fixes tree service from showing that there is children when there isn't, fixes container node issues:
U4-3540 When creating a Container type node - the list view shows all children of the item it's being created underneath
U4-3541 media tree is not catering for container types
Adds container style
2013-11-15 16:19:46 +11:00
Shannon 9774744991 should knock off a few minutes for running tests. 2013-11-15 16:00:48 +11:00
Shannon 4a6103ba94 Fixes some merge issues, tries to speed up unit tests a little. 2013-11-15 15:10:02 +11:00
Shannon 8bbe6675db Merge remote-tracking branch 'origin/6.2.0' into 7.0.0
Conflicts:
	src/Umbraco.Core/Persistence/Factories/UmbracoEntityFactory.cs
	src/Umbraco.Core/Persistence/Repositories/EntityRepository.cs
2013-11-15 15:00:44 +11:00
Shannon b4c005c140 Fixes up the EntityRepository to use dynamics for media as well so that *all* fields in the main table are returned so we can store this information in AdditionalData, now that this is working nicely we should make the entity repo lookup the properties for content too just like we're doing for media since these get put into AdditionalData as well and there's really not much overhead to do that.
Conflicts:
	src/Umbraco.Core/Persistence/Repositories/EntityRepository.cs
2013-11-15 14:53:26 +11:00
Shannon 34cebe989f Fixes up the EntityRepository to use dynamics for media as well so that *all* fields in the main table are returned so we can store this information in AdditionalData, now that this is working nicely we should make the entity repo lookup the properties for content too just like we're doing for media since these get put into AdditionalData as well and there's really not much overhead to do that. 2013-11-15 14:29:34 +11:00
Shannon eca823ea90 Fix for U4-3529 Ysod editing Partial View 2013-11-15 13:49:20 +11:00
Shannon 89481405b5 Fixes: U4-3534 Sorting content items 2013-11-15 12:57:28 +11:00
Shannon f1d837dfd1 fixes: U4-3539 Cannot set a scheduled publish at date/time gives a warning message 2013-11-15 12:46:55 +11:00
Shannon c61fd1ec27 Fixes datetimepicker once and for all, fixes user model to return the culture not just the language, adds ability to localize the datetimepicker - will default to english but is easy to add other versions, currently the only custom one in there is brazilian (since it was already made).
fixes: U4-2863 Date picker-textbox jumps between 12 and 24 hours clock
U4-3537 Cannot clear date/time value, still have problems with it's null validation not clearing from the server
2013-11-15 12:26:29 +11:00
Shannon 5314afb51a Changed editorContext to use appState instead for content/media/member editors - the appState saved is the basic entity, this means that if property editors resolve this value they do not have access to actually change the real content model which we don't want to allow (or changing other property's values).
Fixed up some inconsistencies between all of these editors and the content editor helper, fixed up tree syncing with the members editor.
2013-11-15 10:38:36 +11:00
Shannon 1c742db414 Cleans up a bit more code - no longer passing in nav controller scope, removes zany args.scope assignment back to the nav ctrl via the nav service, this is not necessary at all and doesn't make any sense. 2013-11-15 09:43:21 +11:00
Shandem f8b2fcaa2b Merge pull request #249 from rsoeteman/7.0.0
Fix for  U4-3529  Ysod editing Partial View
2013-11-14 14:00:09 -08:00
perploug 684c99b532 removes css that conflicts with firefox selects state 2013-11-14 22:17:18 +01:00
perploug 28ec40e1ae modifies angular-mobile to fix firefox glitch 2013-11-14 22:05:51 +01:00
perploug cadf1fe9bb removes old bootstrap files 2013-11-14 22:03:51 +01:00
Richard Soeteman 393c365b6e Fix for U4-3529 Ysod editing Partial View 2013-11-14 14:48:04 +01:00
perploug a657e10545 Consolidates contextmenu action handling
Moves umbOptionsMenu and umbContext menu exection into navigationService
2013-11-14 14:13:39 +01:00
perploug d6f9d23626 merge 2013-11-14 14:12:49 +01:00
perploug 7e0eefc18a adds editor context value 2013-11-14 13:12:08 +01:00
perploug 9bcd276073 fixes sir trevor manifest 2013-11-14 13:11:58 +01:00
perploug d0fd7523c2 fixes media move to root 2013-11-14 13:11:45 +01:00
perploug 0a6826c62a adds manifest documentation 2013-11-14 13:11:20 +01:00
perploug 132b1f305a moves context action execute to navigationService 2013-11-14 13:11:03 +01:00
Shannon 7dfd684cd8 Fixes: U4-3504 Sorting media doesn't work, always defaults to sorting the root 2013-11-14 22:25:08 +11:00
Shannon 4ce5e67116 Fixes: U4-3517 Package tree doesnt load 2013-11-14 22:01:26 +11:00
Shannon 6d2caaa723 Fixes: U4-3430 Save Properties not working for usercontrol macro 2013-11-14 21:56:01 +11:00
Lars-Erik Aabech e3cd85a6a2 Made CreateIndexBuilder set IndexType in Clustered(), NonClustered() and Unique(). 2013-11-14 10:55:35 +01:00
Lars-Erik Aabech 69f805ecca Proof that CreateIndexBuilder.NonClustered() does not affect index creation statement on SQL Server.
CreateIndexBuilder_SqlServer_NonClustered_CreatesNonClusteredIndex() fails expecting NONCLUSTERED but getting CLUSTERED.
CreateIndexBuilder_SqlServer_Unique_CreatesUniqueNonClusteredIndex() fails expecting UNIQUE NONCLUSTERED but getting CLUSTERED.
2013-11-14 10:53:58 +01:00
Shannon 10e65e8027 Adds new Multiple Media picker property editor 2013-11-14 20:36:06 +11:00
Shannon d79110aee6 Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-14 20:32:26 +11:00
Shannon 9eb9b8df92 Fixes: U4-3501 Error when selecting multiple items with the media picker in v7 - ensures the standard media picker cannot multi-select, hides the add button when multi select is disabled and there's a value. 2013-11-14 20:32:11 +11:00
Shandem fc8496dd95 Merge pull request #247 from rsoeteman/7.0.0
Fixed Dashboard Controller is only looking for one section
2013-11-14 01:30:22 -08:00
Richard Soeteman 21334bd282 Fixed Dashboard Controller is only looking for one section 2013-11-14 10:23:21 +01:00
Shannon 367bbd7eff Fixes: U4-3518 'Start Node in content' property of user does not work. 2013-11-14 19:58:55 +11:00
Shannon 2f62c58055 Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-14 19:35:13 +11:00
Shannon 47f7d0d8df no more nav.ui. removes exposing the userDialog, moves enter/leave tree to the navigation controller since it doesn't belong on the service, cleans up more of the nav ctrl and we have no more globals :) now to look at changing the object that is passed to dialogs (i.e. not the navigation controller scope) 2013-11-14 19:34:47 +11:00
perploug f4861fb344 fixes broken font on icon picker on windows 2013-11-14 09:16:46 +01:00
perploug 378fc2c655 fixes datatype editor buttons not snapping to buttom 2013-11-14 09:16:35 +01:00
perploug 202ae1eafe removes overflown tabs collection 2013-11-14 09:16:05 +01:00
Shannon 77cb86f74b fixes: U4-3429 After sorting the tree doesn't get refreshed (for content) 2013-11-14 19:14:52 +11:00
Shannon 4281610bc1 fixes tree sync with move media/content 2013-11-14 19:09:13 +11:00
perploug f11aca53e4 added icon picker loader 2013-11-14 09:08:26 +01:00
perploug 87fc9c3ee7 removed filter that didnt work anyway 2013-11-14 09:08:13 +01:00
perploug 4f27fd6d40 better caching of icons for icon picker 2013-11-14 09:07:54 +01:00
perploug 85155175cb fixes broken dialogs in firefox 2013-11-14 09:07:40 +01:00
perploug 6cddd55065 fixes issues with overflown tabs 2013-11-14 09:07:30 +01:00
perploug bf93d773a8 redirects all repo requests to our instead of packages 2013-11-14 09:04:10 +01:00
Shannon 20f1a308a8 fixes tree sync on move 2013-11-14 19:01:41 +11:00
Shannon b6dcbc83e4 Nearly got the whole nav.ui stuff taken care of, have most of the correct objects in appState, fixed up tree syncing with move dialog, fixed up state handling of the currently selected node, removed setting the navigationController's scope from within the navigationService (?), still some more stuff to clean up. 2013-11-14 18:50:31 +11:00
Shannon 6967027e41 remove sort controller's and views - when we put these back we can restore. 2013-11-14 17:05:14 +11:00
Shannon 87309a1ef3 fixes merge 2013-11-14 17:03:53 +11:00
Shannon 9027b41ded made syncTree method on handler return a promise so we can do somethnig with it after (it still raises an event). Updates all editors to assign a currentNode to their scope when syncTree is complete, now that gets assigned to the umboptions which is now decoupled from nav.ui. 2013-11-14 16:59:08 +11:00
Shannon 43f001280e slowly getting the tree node model decoupled from being passed in to menu actions, updated more of the appState and clarified a few things, created a new umboptionsmenu directive to be used for the options drop down on editors 2013-11-14 16:09:53 +11:00
Shannon 8dab2148f1 changes TinyMCEv3Alias to just TinyMCEAlias but unfortunatey we cannot change the actual alias stored in the db because we're already in RC - that means that people will forever see TinyMCEv3 as the property editor alias :( even though it is already v4 2013-11-14 13:39:03 +11:00
Shannon 6474b2b045 Updates eventsService to actually be able to handle async callbacks with promises - though i'm really not sure when this will effectively be used. It no longer returns a promise - since that was a 'false promise' anyways . lol. 2013-11-14 13:27:53 +11:00
Shannon 0b1eb4b42c Created events test and POC 2013-11-14 12:17:20 +11:00
Shannon 86c996efb8 Merge remote-tracking branch 'origin/6.2.0' into 7.0.0 2013-11-14 10:51:52 +11:00
Shandem c037e2e09f Merge pull request #246 from lars-erik/6.2.0-fix-U4-3508
Fixes Template.ToXml() (U4-3508) and refactored Template.Import to use P...
2013-11-13 15:51:29 -08:00
lars-erik d8debf6789 Fixes Template.ToXml() (U4-3508) and refactored Template.Import to use PackagingService.ImportTemplates.
Fixed nullreference bug in ImportTemplates when used with XElement("Template"). (Added test for case with one template only)
2013-11-13 14:27:05 +01:00
perploug b02b45c815 datepicker adds current user language 2013-11-13 13:46:04 +01:00
perploug 05cbccec5c adds hotkeys to search, dialogs and help 2013-11-13 13:45:46 +01:00
perploug 238bc58234 Revert to old datepicker 2013-11-13 11:33:39 +01:00
Shannon dd22377b9b Removes the need for activeTree/currentTree on the nav ctrl, fixes the section animation on first load, 2013-11-13 20:35:53 +11:00
Shannon 01589f0a35 Cleans up some more tree code that is not used or required, moves the ui.treeEventHandler to a local var in the nav service since it doesn't need to be exposed, fixes main controller redirecting due to an undefined check. 2013-11-13 20:14:33 +11:00
Shannon b9d22b2577 Fixes: U4-3506 Linkpicker in RTE doesn't expand tree to last selected link - missing GetPath parameter - which lead to lots of other cleanup, removes auth listening on the section and tree directives since that doesn't belong there, now the navigation controller determines what to render depending on authorization. Removes the path parameter on the umbTree and umbTreeItem since this didn't work and syncTree should be used instead. Fixed up some more tree sync logic as well. 2013-11-13 19:57:34 +11:00
Shannon 36c21ca322 refactors out ui.tablet into private variable - only navigationService needs to know about this, otherwise if everything does it needs to go into appState and the listener needs to go elsewhere (a directive) 2013-11-13 18:44:44 +11:00
Shannon 4fe6da9118 refactored out the dialogTitle, currentDialog, actions ui object to use appState, updated the context menu directive to not rely on globals, instead it gets passed the values it needs from the navigation controller. 2013-11-13 18:40:30 +11:00
Shannon b4f8e6c93d refactors out the usage of 'ui.stickyNavigation' to use appState 2013-11-13 16:43:40 +11:00
Shannon 886d146595 refactored out the usage of ui.showTray to use appState 2013-11-13 16:35:23 +11:00
Shannon 2aaf3d06fa missing adding touchDevice to the local scope 2013-11-13 16:25:25 +11:00
Shannon 35315e0331 Removes touchDevice from rootScope and navigationService, now we detect this on app startup and add to the globalState which can be retrieved whenever. 2013-11-13 16:22:47 +11:00
Shannon ba72991929 refactored out the usage of "ui.showContextMenu" with the usage of appState. Added a new init.js instead of having the startup scripts embedded in the routes file (we should make a 'startup' naming convention like we have for 'controllers' to combine into one file) 2013-11-13 16:16:11 +11:00
Shannon ad7edf0d52 refactors out the usage of 'ui.showNavigation' and replaces with using appState. Adds unit tests for appState. 2013-11-13 15:51:59 +11:00
Shannon ac15e84324 refactored out the global 'ui.currentSection' to use the appState service. 2013-11-13 15:20:13 +11:00
Shannon 5d49dfbe28 refactors showSearchResults to be part of appState 2013-11-13 14:25:07 +11:00
Shannon 5889140386 Created the new appState service - this will be used to control all of the tracked back office state and used used explicitly by getting/setting values by key - cannot be mutable without defining properties first, then other controllers/services can listen for changes to state and act accordingly. Theoretically the navigationService 'should' be the only thing setting any of the state. Have started refactoring out the easy wins to move away from the dreaded ui object. 2013-11-13 13:50:36 +11:00
Shannon fd91340e75 Updates DefaultShortStringHelperTests to ensure that umb config is mocked. 2013-11-13 12:41:02 +11:00
Shannon 8dbdd67c98 Reverted CleanStringForSafeFileName to the original name that doesn't strip unnecessary characters. 2013-11-13 12:33:03 +11:00
Shannon d0c5dd208f Reverted to Newtonsoft.Json 4.5.11 2013-11-13 11:28:14 +11:00
Shannon d46486d3db Fixes: U4-3493 Cannot delete a template with children 2013-11-13 11:09:11 +11:00
Shannon c52e0cbb65 Added GetTemplateNode and FindTemplateInTree to the IFileService 2013-11-13 11:05:08 +11:00
Shannon 6224d02989 Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-13 11:00:06 +11:00
Shannon 9e8286bda9 Adds ability to query the template tree (hierarchy) with the template repository + unit tests. 2013-11-13 10:59:36 +11:00
Shandem e9ed1bf17a Merge pull request #244 from leekelleher/U4-3051
Fixes: U4-3051 GetAncestorOrSelfDocuments gets stuck in infinite loop
2013-11-12 14:11:05 -08:00
leekelleher cfcfb75dcc Fixes: U4-3051 GetAncestorOrSelfDocuments gets stuck in infinite loop 2013-11-12 21:26:21 +00:00
perploug 9ad869d367 merge 2013-11-12 19:29:15 +01:00
perploug acbde943b0 replaces the datepicker with a native angular picker 2013-11-12 19:01:48 +01:00
perploug c4a0e1e923 changes options to actions 2013-11-12 19:01:24 +01:00
perploug 8465b3465b ensures history is reset on login 2013-11-12 19:00:51 +01:00
perploug 8666ae0540 sections css tweak 2013-11-12 19:00:37 +01:00
perploug 9c8e156768 fixes dublicate help and user dialogs 2013-11-12 19:00:25 +01:00
perploug 9efe68724d Fixes dublicate key bindings for hotkeys 2013-11-12 19:00:08 +01:00
Shannon 2129ac8241 Adds template repository tests, updates template repo business logic to be able to delete the whole template tree, updates some script repo tests too. 2013-11-12 22:28:43 +11:00
Shannon 6bab9500c1 Merge remote-tracking branch 'origin/6.2.0' into 7.0.0 2013-11-12 20:54:56 +11:00
Shannon bb4a7ef21f Merge remote-tracking branch 'origin/7.0.0' into 7.0.0 2013-11-12 20:53:06 +11:00
Shannon abb6b6519f Fixes gravatar JS issue if user times out 2013-11-12 20:52:55 +11:00
Shannon e94ca7513b Fixes: U4-3473 Cannot edit Partial views - getting YSOD data reader error - PetaPoco error will backport to 6.2 2013-11-12 20:50:17 +11:00
perploug ad9fa736f4 Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-12 10:05:46 +01:00
perploug cad0f8bb2a WIP on photo folderresiizng on IE 2013-11-12 10:05:26 +01:00
perploug 289caa791a moves touch device prop to rootscope 2013-11-12 10:04:40 +01:00
perploug bfa325163d adds fall-back icon to content types 2013-11-12 10:03:59 +01:00
perploug f03e9ecebe adds check to dialog swiping 2013-11-12 10:03:34 +01:00
perploug 0ab2b74004 fixes missing legacy icons in IE 2013-11-12 10:03:19 +01:00
perploug fe40288514 fixes dublicate hotkey in legacy editors 2013-11-12 10:02:59 +01:00
Shannon df867af900 Fixes: U4-3329 Link to "Edit Profile" errors if you don't have access to Users 2013-11-12 18:13:00 +11:00
Shannon 5f5f535f05 Changes UserController to be CurrentUserController - and removes the other methods in there since that was an overlooked security issue. This controller is responsible solely for dealing with the currently logged in user. Changes over to be currentuser.resource as well. 2013-11-12 18:07:10 +11:00
Shannon a532b49485 Fixes: U4-3482 keepUserLoggedIn setting ignored? and streamlines some of the auth methods. 2013-11-12 17:38:32 +11:00
Shannon c28f800fe6 Removes the re-committed app plugins property editor that shouldn't be there 2013-11-12 17:38:09 +11:00
Shannon e7201b6a69 Fixes: U4-3485 Can't use membership provider functions with a membertype that contains a "Belle" property editor 2013-11-12 16:07:53 +11:00
Shannon 1f538d1bd5 Fixes: U4-3489 Member tree items should not have refresh node as an action 2013-11-12 15:24:08 +11:00
Shannon a9ffa3f1b7 his reverts commit c2fca795e6 to use the normal tree cache 2013-11-12 15:06:47 +11:00
Shannon c2fca795e6 This is an attempt to put the tree cache into sessionStorage - I'm creating this revision in case we want to re-visit this but unfortunately it is much more difficult because the cache is serialized/deserialized which means only the first level will be cached automatically since the loadNodeChildren would have to update the cache too but it doesn't know what a cache key is.
I've then done it the other way which is that we cache the tree sections when changing sections, this works great but poses other issues due to the serialized nature of the tree nodes. Spending too much time here, will revisit some other day. will revert after this is committed.
2013-11-12 15:02:02 +11:00
Shannon 72b08f4029 Fixes an issue if the upgrade check server is not responding. 2013-11-12 13:28:13 +11:00
Shannon c4bfeeb321 Changes the CreateTreeNode to ensure that a parentId is always passed in - now all tree node models have a parentId property based on the server side data. Changes the JS tree node model to not have a 'parent' property and instead changes this to a parent() method - this allows us to serialize the tree model because otherwise it has cyclical references. 2013-11-12 13:09:24 +11:00
Shannon acd52d42f4 Refactoring TreeNode to inherit from EntityBasic = makes much more sense and makes our models more consistent. 2013-11-12 12:30:10 +11:00
Shannon 635ccc444d Adds another childrenOf option to clearing tree cache to clear a cached branch, this is used to fix U4-3465 Media tree not updating when creating folders and can be used elsewhere where modifying trees outside of it's context. 2013-11-12 12:01:16 +11:00
Shannon 6dcfbaee7f Adds a new filter arg to remove tree cache - we will use this in order to clear specific items from tree cache (like when we are creating folders for media in the media picker) 2013-11-12 11:09:30 +11:00
Anders Stentebjerg 6fb6aa397f Styling
- Logo size login screen
- H1 in panel
2013-11-11 15:34:49 +01:00
Morten Christensen 181593f5ea Merge pull request #234 from saciervo/fix/petapoco-fetch
SqlHelper Refactoring
2013-11-11 02:59:49 -08:00
Shannon c0037a40c6 Fixes a unit test - before if the packager could not resolve a legacy data type because the ids were not valid, it would just ignore that properly, now it logs warnings and just converts to a label property. 2013-11-11 18:17:49 +11:00
Shannon 57e98fda97 Fixes setting the 'section' on a tree node, fixes the editors syncTree call to not force reload when routing to the editor - this will still load in the data for the tree if it is missing, just won't force reload the individual tree node loading. 2013-11-11 17:54:42 +11:00
Shannon 3111a2d22f Missing file 2013-11-11 17:12:35 +11:00
Shannon f123c58c79 Fixes up some more tree sync, streamlines naming conventions, adds more doc/comments to the code and specifies what is internal (only to be used by legacy code). syncTree method now takes an object to sync and both sets the active tree and the path at the same time and fixes setting the active tree to search the root node and children because content/media trees are single section trees. 2013-11-11 17:12:09 +11:00
Shannon 9f613c04f3 Fixes more tree syncing - setActiveTreeType should *not* perform any tree loading, it should just set the active root tree node. syncTree is always used in conjunction with that call in the legacy API which means we get 2 tree queries loading at once and syncing ends up not working. We'll create a nicer method for our angular views to use to sync the tree, setActiveTreeType will typically only be used by the legacy umbraco wrapper. 2013-11-11 16:15:09 +11:00
Shannon 0be60a5c88 Fixes: U4-3466 Deleting Document Type with children fails 2013-11-11 15:09:26 +11:00
Shannon 8fc82476a6 Fixes some tree syncing with legacy trees - now need to cleanup the delete animation stuff. 2013-11-11 14:36:45 +11:00
Shannon 6fe647146c Fixes: U4-3431 Macro property not passed to ASCX usercontrol 2013-11-11 12:23:46 +11:00
Shannon dd80b41735 Merge remote-tracking branch 'origin/6.2.0' into 7.0.0
Conflicts:
	src/Umbraco.Tests/Macros/MacroTests.cs
2013-11-11 12:23:27 +11:00
Shannon a311a54d3d Hugely simplifies setting properties from macro parameters on user control macros with tests. 2013-11-11 12:22:29 +11:00
Shannon 330732323f Hugely simplifies setting properties from macro parameters on user control macros with tests. 2013-11-11 12:16:30 +11:00
Shannon ad0b7e4259 Changed default (development) macro error handling to throw. 2013-11-11 10:16:25 +11:00
Shannon 0d42f721db fixed more tree sync 2013-11-08 12:35:42 +11:00
Shannon 7664cec0d3 Fixes: U4-3442 tree sync doesn't work for nodes that are not loaded - tree sync is now working properly and loads in any nodes that are missing. Have removed the dependency on navigationService from umbTree directive since it should not have that dependency. navigationService now sets it's global current node after treeSync based on an event. Moved the treeSync logic to the treeService so it can be unit tested (now to write the unit tests). Added another method to treeService to reload a single node - this is now used by treeSync when the current node is being synced - much nicer than reloading all the children. Updates the treeService to always add the current section to each tree node, this will make it much easier to know the treenode section - and in theory should mean we might be able to remove the ui global currentSection var. 2013-11-08 11:48:04 +11:00
Shannon ef40c76363 Re-formats the code structure of nav service and umbtree to be easier to read, adds better error checking to treeservice 2013-11-08 09:07:28 +11:00
Shannon 367cdde35e Merge remote-tracking branch 'origin/6.2.0' into 7.0.0
Conflicts:
	src/umbraco.cms/businesslogic/workflow/Notification.cs
2013-11-08 08:55:22 +11:00
Shannon 590b7f2289 Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-08 08:49:07 +11:00
Sandro Ciervo 9911f03745 Fixed potential DbReaderException
- Use Fetch<T> instead of Query<T> because we create another DbReader inside the loop with DoesMacroHaveParameters().
2013-11-07 20:09:06 +01:00
Anders Stentebjerg 2d09785753 Search form 1px up 2013-11-07 17:15:41 +00:00
perploug 7a31ba0de7 merge 2013-11-07 18:14:53 +01:00
Anders Stentebjerg 1cfb79788a Align header 2013-11-07 17:11:35 +00:00
Anders Stentebjerg 641d0c737f Styling
- Retina optimized gravatar
- White Umbraco logo
2013-11-07 16:51:25 +00:00
perploug 242b755b1a Tabs overflow 2013-11-07 17:48:54 +01:00
Sebastiaan Janssen d76336cd39 Merge pull request #194 from Attackmonkey/Hackathon-U4-3228
Fixes issue U4-3228, where dictionary item names are not trimmed.
2013-11-07 08:45:21 -08:00
Sebastiaan Janssen 0dc3920309 Merge pull request #191 from dipeshhirani/U4-2756
Fixed the issue below: U4-2756
2013-11-07 08:38:44 -08:00
Sebastiaan Janssen 98d1aafb75 Merge pull request #187 from wpyz/6.2.0
Fixes issue with opening VS solution when only Visual Studio 2013 is installed (fixes U4-3445)
2013-11-07 08:36:40 -08:00
Anders Stentebjerg fa0b3ddab9 Set focus on pageName 2013-11-07 16:30:14 +00:00
Per Ploug Krogslund 7440855c72 merge 2013-11-07 17:16:22 +01:00
perploug 937bda9c16 select on focus directive 2013-11-07 17:11:32 +01:00
Anders Stentebjerg 2b3a9a0b8f U4-3449 Polish UX so it matches grid 2013-11-07 16:04:07 +00:00
Sebastiaan Janssen 6a0d7ec8d6 Merge pull request #183 from mkariti/U4-1477
fix U4-1477
2013-11-07 07:49:27 -08:00
perploug 8b879183ba Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0 2013-11-07 16:05:43 +01:00
perploug 0f424d314f Changes editor header editor to input:text 2013-11-07 16:05:22 +01:00
Morten Christensen f9a86385b5 Rearranging the create schema extensions methods to provide a bit more flexibility for external usage. 2013-11-07 14:03:34 +01:00
Morten Christensen b8f7df1a96 Fixing the broken stylesheetrepository test and ignoring the StylesheetRepository in the RepositoryResolverTest for the time being as it takes two different UOWs as opposed to other repositories. 2013-11-07 13:33:49 +01:00
Tim Payne 425fd80e65 Fixes issue U4-3228, where dictionary item names are not trimmed. 2013-11-07 12:28:43 +00:00
Morten Christensen 04bb778dc1 Fix StylesheetRepositoryTest which broke as a result of PR #176 2013-11-07 12:52:25 +01:00
dipeshhirani 3f2be3342a Fixed the issue below:
The "Unpublish" button (under Properties tab) is bad translated to Italian.
The used word is "Non pubblicato". This phrase is mean "It is not published".
A best translation is "Non pubblicare" (unpublish).

Did not do any of the others as they are either already done or the requesters change seems incorrect/irrelevent
2013-11-07 11:42:08 +00:00
Morten Christensen 3ba50e7bae Merge pull request #176 from pynej/add-stylesheet-ids
Fix for missing Id's on FileService.GetStylesheets() call.  This is need...
2013-11-07 03:41:33 -08:00
Morten Christensen 7306ddef14 Merge pull request #182 from stocksr/6.2.0-petapoco-refactor
6.2.0 petapoco refactor - umbraco.cms.businesslogic.language.Item
2013-11-07 03:37:37 -08:00
Morten Christensen 17bb29eb66 Merge pull request #185 from saciervo/6.2.0
Use PetaPoco instead of SqlHelper
2013-11-07 03:35:49 -08:00
Morten Christensen 8bf3de738f Merge pull request #188 from stocksr/6.2.0-petapoco-refactor-umbraco.cms.businesslogic.language.Language
Refactoring umbraco.cms.businesslogic.language.Language class
2013-11-07 03:34:08 -08:00
Robert Stocks 2d37502a44 Refactoring umbraco.cms.businesslogic.language.Language class 2013-11-07 11:28:00 +00:00
Ryan Lewis d5c485205a Whitespace 2013-11-07 11:24:40 +00:00
Ryan Lewis 9533198365 Can open VS solution with only Visual Studio 2013 installed (fixes U4-3445) 2013-11-07 11:23:41 +00:00
Morten Christensen 66f20e3800 Merge branch '6.2.0' of https://github.com/umbraco/Umbraco-CMS into 6.2.0 2013-11-07 12:19:27 +01:00
Sandro Ciervo 9269a98806 Refactored Umbraco.Web.UI.Controls.InsertMacroSplitButton
- CreateChildControls()
- DoesMacroHaveParameters (Int32)
2013-11-07 12:15:03 +01:00
mkariti 7c97fddec5 fix U4-1477 2013-11-07 13:08:56 +02:00
Morten Christensen a567cf2a87 Minor update to the DefaultData so the used PetaPoco db object is consistent 2013-11-07 12:00:45 +01:00
Morten Christensen 1e319d667b Updating the remaining methods in the Notification class so it no longer uses the legacy SqlHelper. 2013-11-07 11:59:59 +01:00
Sebastiaan Janssen cc039e365d Merge pull request #181 from Attackmonkey/Tim-Payne-Hackathon-U4-2708
Fixes issue U4-2708
2013-11-07 02:55:03 -08:00
Morten Christensen f91ff5dc31 Special commit for a special Lars-Erik 2013-11-07 11:48:25 +01:00
Robert Stocks 9347a2edbb Refactoring umbraco.cms.businesslogic.language.Item class - Fix Update and Delete calls 2013-11-07 10:40:23 +00:00
Robert Stocks 64a73ef528 Refactoring umbraco.cms.businesslogic.language.Item class 2013-11-07 10:20:55 +00:00
Tim Payne 4ea04f5ffe Fixes issue U4-2708 2013-11-07 10:08:11 +00:00
Morten Christensen 6b006e6fd7 Refactoring GetUserNotifications method in the Notification class 2013-11-07 11:00:19 +01:00
Shannon 30fe174601 working on U4-3442 tree sync doesn't work for nodes that are not loaded 2013-11-07 17:53:46 +11:00
Shannon 31448eb987 Fixes: U4-3427 Tree persistence not working 2013-11-07 17:41:44 +11:00
Shannon 29cf9ae46a Changes all references of navigationService.ui.currentTreeNode to be navigationService.ui.currentNode since that was what has existed previously, now suddenly we have 2 references to current tree node - I'm 99% sure that we only want one reference and currentTreeNode seems to have been added later and isn't declared properly on the nav service. 2013-11-07 17:32:06 +11:00
Shannon 01eb7157bd Adds missing moveNode from the legacy tree api 2013-11-07 17:20:01 +11:00
Shannon bacdcb7abf updates some more logic when saving macro properties to always try to map to the new ones if legacy aliases are used. 2013-11-07 16:07:08 +11:00
Shannon 164b630d5e Fixes: U4-3428 Macro Parameter Types aren't set correctly when a (legacy) package installs them 2013-11-07 16:00:58 +11:00
Shannon d9abbd4232 Fixes: U4-3437 Deleting a macro with parameters causes YSOD 2013-11-07 15:16:18 +11:00
Shannon 3d6eea9470 Fixes: U4-3350 Content Validation: Can't get rid of DateTime error 2013-11-07 14:58:41 +11:00
Shannon 345b96e253 Moves TreeControllerBase to separate file and moves the CreateTreeNode methods to that controller so they can be used in events handlers. 2013-11-07 13:52:06 +11:00
Shannon 546788761f Fixes merge issue 2013-11-07 12:33:06 +11:00
Shannon fad84ac0bb Merge remote-tracking branch 'origin/6.2.0' into 7.0.0
Conflicts:
	src/Umbraco.Web.UI/umbraco/members/EditMember.aspx
	src/Umbraco.Web/Umbraco.Web.csproj
	src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMember.aspx.cs
2013-11-07 12:30:28 +11:00
Shannon fc0654a80f Fixes: U4-2241 Native Multi-node tree picker in Member Types: Saving clears selected items 2013-11-07 12:02:41 +11:00
Sebastiaan Janssen 4717faaf1b Merge pull request #180 from Jeavon/U4-3432
Fix for U4-3432Rollback Dialog - CreateDate/Creator formatting tweaks
2013-11-06 09:48:08 -08:00
Jeavon Leopold e7d587f776 Fix for U4-3432Rollback Dialog - CreateDate/Creator formatting tweaks required 2013-11-06 17:19:18 +00:00
Stephan dca0c85db5 Merge remote-tracking branch 'origin/6.2.0' into 6.2.0 2013-11-04 12:54:07 +01:00
Shannon 5006115b2d Fixes object extensions and tests
Conflicts:
	src/Umbraco.Core/ObjectExtensions.cs
	src/Umbraco.Tests/ObjectExtensionsTests.cs
2013-11-02 15:20:04 +11:00
Stephan 058cec7551 Cache AspNet hosting permission level 2013-11-01 16:57:31 +01:00
Jeremy Pyne 6451f6ad68 Fix sql errors in prev change. 2013-10-29 10:00:25 -04:00
Jeremy Pyne 7cd6882f28 Removed dependence in Stylesheet repository on Entity Service. 2013-10-29 09:24:05 -04:00
Jeremy Pyne dc336728b5 Fix for missing Id's on FileService.GetStylesheets() call. This is needed as sytlesheets can only be loaded in the editor via their Id so listing stylesheets needs to list there Id as well for custom plugins to render the build in editor. 2013-10-28 14:32:18 -04:00
Sebastiaan Janssen 4935525591 Merge pull request #147 from AndyButland/u4-2958
Fix for issue U4-2958 Member can edit & Show on profile do not persist on Member Type editor
2013-10-05 10:04:08 -07:00
Andy Butland 693778fe74 Fixed issue where member type properties would not persist after first save without reloading page 2013-10-02 21:20:05 +02:00
Sebastiaan Janssen 8eee7cae2f Merge branch '6.1.6' 2013-09-30 16:10:14 +02:00
Shandem a353f6fb74 Merge pull request #135 from Myster/master
Fix multiple words in search U4-2509
2013-09-11 19:33:47 -07:00
Murray Roke a64efb93b3 Improved search with "and", partial match U4-2509
- added partial matching on each word.
- fixed bug so 'all' words match rather than 'any' words.
2013-09-12 14:30:42 +12:00
Murray Roke cf9f11ff45 Improved admin search splitting query U4-2509 2013-09-12 13:22:14 +12:00
Murray Roke d7481b5ca4 Fix multiple words in search U4-2509
When multiple words are entered in the search field no results are
returned.
This pull req. contains the fix suggested by Tony.
2013-09-12 10:22:59 +12:00
Niels Hartvig 2fb55cb831 Enhanced permission checking on views and snippets
Thanks to Richard Turnbull from NGS Secure Research who discovered a
minor issue that made it possible for authenticated Umbraco Users to
view files beyond their permissions
2013-09-02 14:23:27 +02:00
Sebastiaan Janssen 0e6a926a3f Merge branch '6.1.5' 2013-09-02 12:24:26 +02:00
Sebastiaan Janssen 1e76cf67d3 Fix merge problem 2013-08-23 08:57:02 +02:00
Sebastiaan Janssen 61149f8112 Merge branch '6.1.4'
Conflicts:
	.gitignore
	src/Umbraco.Web.UI/install/steps/database.ascx
	src/Umbraco.Web/Umbraco.Web.csproj
	src/Umbraco.Web/umbraco.presentation/umbraco/controls/Images/ImageViewer.ascx.cs
	src/umbraco.editorControls/mediapicker/mediaChooser.cs
2013-08-22 14:46:11 +02:00
Sebastiaan Janssen b5494546c7 defaultDocumentTypeProperty is no longer case-sensitive. Added to the Release config as well so it makes it into the umbraco downloadable package. 2013-07-19 15:40:12 +02:00
Sebastiaan Janssen 7bac1ef1cd Merge branch 'wip-u4-1949' of https://github.com/AndyButland/Umbraco-CMS into AndyButland-wip-u4-1949 2013-07-19 15:22:05 +02:00
Sebastiaan Janssen da15d40b04 Merge pull request #51 from kipusoep/master
Updated the download link
2013-07-19 06:18:13 -07:00
Sebastiaan Janssen 67bd303173 Merge pull request #46 from michielvoo/u4-2417
U4-2417 Could the preview thumbnail link to the full image
2013-07-19 06:02:51 -07:00
Sebastiaan Janssen 20e6843bf0 Merge pull request #32 from AndyButland/wip-u4-1285
Fix for U4-1285: Apostrophes in member groups cause exceptions
2013-07-19 05:39:38 -07:00
Sebastiaan Janssen 85c80b07f9 Merge pull request #42 from michielvoo/u4-232
Enabled support for integrated security for SQL Server to the installer.
2013-07-19 04:26:50 -07:00
Sebastiaan Janssen 557dccd88b Merge pull request #41 from michielvoo/u4-667
U4-667
2013-07-19 04:18:29 -07:00
Sebastiaan Janssen 334f0bfd2b Merge pull request #40 from michielvoo/u4-663
U4-663
2013-07-19 03:53:15 -07:00
AndyButland 986d37afd6 Removed debugging console.log reference 2013-07-18 21:23:05 +02:00
Stefan Kip 63ea79a4d6 Updated the download link 2013-07-11 10:03:25 +02:00
Michiel van Oosterhout e4df176a37 U4-2417: show media picker image as link to the original image.
Order of the views in the markup did not match the order of the Style enum.
ImageViewer control now selects the view by matching the ViewerStyle enum to a View ID. This way the order of the views in the markup is no longer important.

Also:
Removed user control from Umbraco.Web project, moved designer code and added code behind class for user control to Umbraco.Web.UI
Refactored code to use Umbraco.Core.IO
Removed some code that was commented out
2013-07-03 17:36:28 +02:00
Michiel van Oosterhout d926180e3a Added special overload for creating a connection string with integrated security.
Actually disable checkbox is the selected database type is not Microsoft SQL Server.
Refactored saveDBConfig for readability.
2013-06-28 16:40:23 +02:00
Michiel van Oosterhout 72bb1b3583 U4-667
Added a script to make the checkbox "Render content in editor" dependent on the "Use in editor" checkbox.
Also refactored the create.aspx code-behind so it's easier to see what control is loaded in the dialog when debugging.
2013-06-28 10:44:24 +02:00
Michiel van Oosterhout 240e58e061 U4-663
Do not overwrite existing files when creating a new template.
2013-06-28 10:42:51 +02:00
Michiel van Oosterhout e980296d6d Enabled support for integrated security for SQL Server to the installer. 2013-06-28 10:39:48 +02:00
AndyButland d23482b7a6 Moved setting for DefaultDocumentTypeProperty from GlobalSettings to UmbracoSettings 2013-06-27 16:00:49 +02:00
AndyButland 212800f706 Added config setting for default document type property; used setting to set default new property type 2013-06-26 17:25:44 +02:00
AndyButland d47ff4005c Support for deleting member groups with apostrophes 2013-06-26 06:16:39 +02:00
AndyButland dfeb1c7a0b Support for displaying and editing member groups with apostrophes 2013-06-26 06:16:23 +02:00
893 changed files with 57888 additions and 51263 deletions
+4 -2
View File
@@ -1,6 +1,6 @@
@ECHO OFF
SET release=7.0.0
SET comment=RC
SET comment=
SET version=%release%
IF [%comment%] EQU [] (SET version=%release%) ELSE (SET version=%release%-%comment%)
@@ -13,7 +13,6 @@ echo This file is only here so that the containing folder will be included in th
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\App_Data\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\App_Plugins\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\css\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\macroScripts\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\masterpages\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\media\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\scripts\dummy.txt
@@ -21,6 +20,9 @@ echo This file is only here so that the containing folder will be included in th
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\Views\Partials\dummy.txt
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\Views\MacroPartials\dummy.txt
ren .\_BuildOutput\WebApp\MacroScripts\Web.config Web.config.transform
ren .\_BuildOutput\WebApp\Views\Web.config Web.config.transform
..\src\.nuget\NuGet.exe pack NuSpecs\UmbracoCms.Core.nuspec -Version %version%
..\src\.nuget\NuGet.exe pack NuSpecs\UmbracoCms.nuspec -Version %version%
+5 -3
View File
@@ -15,9 +15,11 @@
<language>en-US</language>
<tags>umbraco</tags>
<dependencies>
<dependency id="Microsoft.AspNet.Mvc" version="4.0" />
<dependency id="Microsoft.AspNet.WebApi" version="4.0" />
<dependency id="Microsoft.AspNet.Mvc" version="[4.0.0,5.0.0)" />
<dependency id="Microsoft.AspNet.WebApi" version="[4.0.0,5.0.0)" />
<dependency id="Microsoft.AspNet.WebApi.Client" version="[4.0.0, 5.0.0)" />
<dependency id="Microsoft.AspNet.Mvc.FixedDisplayModes" version="1.0.0" />
<dependency id="Microsoft.Net.Http" version="[2.0.0, 3.0.0)" />
<dependency id="MiniProfiler" version="[2.1.0, 3.0.0)" />
<dependency id="HtmlAgilityPack" version="[1.4.6, 2.0.0)" />
<dependency id="Lucene.Net" version="[2.9.4.1, 3.0.0.0)" />
@@ -27,7 +29,7 @@
<dependency id="ClientDependency" version="[1.7.0, 2.0.0)" />
<dependency id="ClientDependency-Mvc" version="[1.7.0, 2.0.0)" />
<dependency id="AutoMapper" version="[3.0.0, 4.0.0)" />
<dependency id="Newtonsoft.Json" version="[5.0.0, 6.0.0)" />
<dependency id="Newtonsoft.Json" version="[4.5.11, 5.0.0)" />
</dependencies>
</metadata>
<files>
+1 -1
View File
@@ -23,7 +23,7 @@
<file src="..\_BuildOutput\WebApp\bin\x86\**" target="Content\bin\x86" />
<file src="..\_BuildOutput\Configs\**" target="Content\config" exclude="..\_BuildOutput\Configs\Web.config.transform" />
<file src="..\_BuildOutput\WebApp\css\**" target="Content\css" />
<file src="..\_BuildOutput\WebApp\macroScripts\**" target="Content\macroScripts" />
<file src="..\_BuildOutput\WebApp\macroScripts\**" target="Content\macroScripts" exclude="..\_BuildOutput\WebApp\macroScripts\Web.config" />
<file src="..\_BuildOutput\WebApp\masterpages\**" target="Content\masterpages" />
<file src="..\_BuildOutput\WebApp\media\**" target="Content\media" />
<file src="..\_BuildOutput\WebApp\scripts\**" target="Content\scripts" />
+1 -7
View File
@@ -21,13 +21,7 @@ if ($project) {
$projectDestinationPath = Split-Path $project.FullName -Parent
$umbracoFilesPath = Join-Path $rootPath "UmbracoFiles\*"
Copy-Item $umbracoFilesPath $projectDestinationPath -recurse -force
# Remove Newtonsoft.Json if present in the bin folder
# If we don't do this, the correct version never gets copied in
$projectDestinationPath = Split-Path $project.FullName -Parent
$jsonDllFile = Join-Path $projectDestinationPath "bin\Newtonsoft.Json.dll"
Remove-Item $jsonDllFile -Confirm:$false
# Open readme.txt file
$DTE.ItemOperations.OpenFile($toolsPath + '\Readme.txt')
}
+163 -163
View File
@@ -1,164 +1,164 @@
using System;
using Umbraco.Core.Dynamics;
namespace Umbraco.Core
{
/// <summary>
/// Represents the result of an operation attempt.
/// </summary>
/// <typeparam name="T">The type of the attempted operation result.</typeparam>
[Serializable]
public struct Attempt<T>
{
private readonly bool _success;
private readonly T _result;
private readonly Exception _exception;
/// <summary>
/// Gets a value indicating whether this <see cref="Attempt{T}"/> was successful.
/// </summary>
public bool Success
{
get { return _success; }
}
/// <summary>
/// Gets the exception associated with an unsuccessful attempt.
/// </summary>
public Exception Exception { get { return _exception; } }
/// <summary>
/// Gets the exception associated with an unsuccessful attempt.
/// </summary>
/// <remarks>Keep it for backward compatibility sake.</remarks>
[Obsolete(".Error is obsolete, you should use .Exception instead.", false)]
public Exception Error { get { return _exception; } }
/// <summary>
/// Gets the attempt result.
/// </summary>
public T Result
{
get { return _result; }
}
// optimize, use a singleton failed attempt
private static readonly Attempt<T> Failed = new Attempt<T>(false, default(T), null);
/// <summary>
/// Represents an unsuccessful attempt.
/// </summary>
/// <remarks>Keep it for backward compatibility sake.</remarks>
[Obsolete(".Failed is obsolete, you should use Attempt<T>.Fail() instead.", false)]
public static readonly Attempt<T> False = Failed;
// private - use Succeed() or Fail() methods to create attempts
private Attempt(bool success, T result, Exception exception)
{
_success = success;
_result = result;
_exception = exception;
}
/// <summary>
/// Initialize a new instance of the <see cref="Attempt{T}"/> struct with a result.
/// </summary>
/// <param name="success">A value indicating whether the attempt is successful.</param>
/// <param name="result">The result of the attempt.</param>
/// <remarks>Keep it for backward compatibility sake.</remarks>
[Obsolete("Attempt ctors are obsolete, you should use Attempt<T>.Succeed(), Attempt<T>.Fail() or Attempt<T>.If() instead.", false)]
public Attempt(bool success, T result)
: this(success, result, null)
{ }
/// <summary>
/// Initialize a new instance of the <see cref="Attempt{T}"/> struct representing a failed attempt, with an exception.
/// </summary>
/// <param name="exception">The exception causing the failure of the attempt.</param>
/// <remarks>Keep it for backward compatibility sake.</remarks>
[Obsolete("Attempt ctors are obsolete, you should use Attempt<T>.Succeed(), Attempt<T>.Fail() or Attempt<T>.If() instead.", false)]
public Attempt(Exception exception)
: this(false, default(T), exception)
{ }
/// <summary>
/// Creates a successful attempt.
/// </summary>
/// <returns>The successful attempt.</returns>
public static Attempt<T> Succeed()
{
return new Attempt<T>(true, default(T), null);
}
/// <summary>
/// Creates a successful attempt with a result.
/// </summary>
/// <param name="result">The result of the attempt.</param>
/// <returns>The successful attempt.</returns>
public static Attempt<T> Succeed(T result)
{
return new Attempt<T>(true, result, null);
}
/// <summary>
/// Creates a failed attempt.
/// </summary>
/// <returns>The failed attempt.</returns>
public static Attempt<T> Fail()
{
return Failed;
}
/// <summary>
/// Creates a failed attempt with an exception.
/// </summary>
/// <param name="exception">The exception causing the failure of the attempt.</param>
/// <returns>The failed attempt.</returns>
public static Attempt<T> Fail(Exception exception)
{
return new Attempt<T>(false, default(T), exception);
}
/// <summary>
/// Creates a failed attempt with a result.
/// </summary>
/// <param name="result">The result of the attempt.</param>
/// <returns>The failed attempt.</returns>
public static Attempt<T> Fail(T result)
{
return new Attempt<T>(false, result, null);
}
/// <summary>
/// Creates a failed attempt with a result and an exception.
/// </summary>
/// <param name="result">The result of the attempt.</param>
/// <param name="exception">The exception causing the failure of the attempt.</param>
/// <returns>The failed attempt.</returns>
public static Attempt<T> Fail(T result, Exception exception)
{
return new Attempt<T>(false, result, exception);
}
/// <summary>
/// Creates a successful or a failed attempt.
/// </summary>
/// <param name="condition">A value indicating whether the attempt is successful.</param>
/// <returns>The attempt.</returns>
public static Attempt<T> SucceedIf(bool condition)
{
return condition ? new Attempt<T>(true, default(T), null) : Failed;
}
/// <summary>
/// Creates a successful or a failed attempt, with a result.
/// </summary>
/// <param name="condition">A value indicating whether the attempt is successful.</param>
/// <param name="result">The result of the attempt.</param>
/// <returns>The attempt.</returns>
public static Attempt<T> SucceedIf(bool condition, T result)
{
return new Attempt<T>(condition, result, null);
}
}
using System;
using Umbraco.Core.Dynamics;
namespace Umbraco.Core
{
/// <summary>
/// Represents the result of an operation attempt.
/// </summary>
/// <typeparam name="T">The type of the attempted operation result.</typeparam>
[Serializable]
public struct Attempt<T>
{
private readonly bool _success;
private readonly T _result;
private readonly Exception _exception;
/// <summary>
/// Gets a value indicating whether this <see cref="Attempt{T}"/> was successful.
/// </summary>
public bool Success
{
get { return _success; }
}
/// <summary>
/// Gets the exception associated with an unsuccessful attempt.
/// </summary>
public Exception Exception { get { return _exception; } }
/// <summary>
/// Gets the exception associated with an unsuccessful attempt.
/// </summary>
/// <remarks>Keep it for backward compatibility sake.</remarks>
[Obsolete(".Error is obsolete, you should use .Exception instead.", false)]
public Exception Error { get { return _exception; } }
/// <summary>
/// Gets the attempt result.
/// </summary>
public T Result
{
get { return _result; }
}
// optimize, use a singleton failed attempt
private static readonly Attempt<T> Failed = new Attempt<T>(false, default(T), null);
/// <summary>
/// Represents an unsuccessful attempt.
/// </summary>
/// <remarks>Keep it for backward compatibility sake.</remarks>
[Obsolete(".Failed is obsolete, you should use Attempt<T>.Fail() instead.", false)]
public static readonly Attempt<T> False = Failed;
// private - use Succeed() or Fail() methods to create attempts
private Attempt(bool success, T result, Exception exception)
{
_success = success;
_result = result;
_exception = exception;
}
/// <summary>
/// Initialize a new instance of the <see cref="Attempt{T}"/> struct with a result.
/// </summary>
/// <param name="success">A value indicating whether the attempt is successful.</param>
/// <param name="result">The result of the attempt.</param>
/// <remarks>Keep it for backward compatibility sake.</remarks>
[Obsolete("Attempt ctors are obsolete, you should use Attempt<T>.Succeed(), Attempt<T>.Fail() or Attempt<T>.If() instead.", false)]
public Attempt(bool success, T result)
: this(success, result, null)
{ }
/// <summary>
/// Initialize a new instance of the <see cref="Attempt{T}"/> struct representing a failed attempt, with an exception.
/// </summary>
/// <param name="exception">The exception causing the failure of the attempt.</param>
/// <remarks>Keep it for backward compatibility sake.</remarks>
[Obsolete("Attempt ctors are obsolete, you should use Attempt<T>.Succeed(), Attempt<T>.Fail() or Attempt<T>.If() instead.", false)]
public Attempt(Exception exception)
: this(false, default(T), exception)
{ }
/// <summary>
/// Creates a successful attempt.
/// </summary>
/// <returns>The successful attempt.</returns>
public static Attempt<T> Succeed()
{
return new Attempt<T>(true, default(T), null);
}
/// <summary>
/// Creates a successful attempt with a result.
/// </summary>
/// <param name="result">The result of the attempt.</param>
/// <returns>The successful attempt.</returns>
public static Attempt<T> Succeed(T result)
{
return new Attempt<T>(true, result, null);
}
/// <summary>
/// Creates a failed attempt.
/// </summary>
/// <returns>The failed attempt.</returns>
public static Attempt<T> Fail()
{
return Failed;
}
/// <summary>
/// Creates a failed attempt with an exception.
/// </summary>
/// <param name="exception">The exception causing the failure of the attempt.</param>
/// <returns>The failed attempt.</returns>
public static Attempt<T> Fail(Exception exception)
{
return new Attempt<T>(false, default(T), exception);
}
/// <summary>
/// Creates a failed attempt with a result.
/// </summary>
/// <param name="result">The result of the attempt.</param>
/// <returns>The failed attempt.</returns>
public static Attempt<T> Fail(T result)
{
return new Attempt<T>(false, result, null);
}
/// <summary>
/// Creates a failed attempt with a result and an exception.
/// </summary>
/// <param name="result">The result of the attempt.</param>
/// <param name="exception">The exception causing the failure of the attempt.</param>
/// <returns>The failed attempt.</returns>
public static Attempt<T> Fail(T result, Exception exception)
{
return new Attempt<T>(false, result, exception);
}
/// <summary>
/// Creates a successful or a failed attempt.
/// </summary>
/// <param name="condition">A value indicating whether the attempt is successful.</param>
/// <returns>The attempt.</returns>
public static Attempt<T> SucceedIf(bool condition)
{
return condition ? new Attempt<T>(true, default(T), null) : Failed;
}
/// <summary>
/// Creates a successful or a failed attempt, with a result.
/// </summary>
/// <param name="condition">A value indicating whether the attempt is successful.</param>
/// <param name="result">The result of the attempt.</param>
/// <returns>The attempt.</returns>
public static Attempt<T> SucceedIf(bool condition, T result)
{
return new Attempt<T>(condition, result, null);
}
}
}
@@ -1,38 +1,38 @@
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.BaseRest
{
internal class BaseRestSection : UmbracoConfigurationSection, IBaseRestSection
{
private const string KeyEnabled = "enabled";
private bool? _enabled;
[ConfigurationProperty("", IsKey = false, IsRequired = false, IsDefaultCollection = true)]
public ExtensionElementCollection Items
{
get { return (ExtensionElementCollection)base[""]; }
}
/// <summary>
/// Gets or sets a value indicating whether base rest extensions are enabled.
/// </summary>
[ConfigurationProperty(KeyEnabled, DefaultValue = true, IsRequired = false)]
public bool Enabled
{
get
{
return _enabled ?? (IsPresent == false || (bool)this[KeyEnabled]);
}
internal set { _enabled = value; }
}
IExtensionsCollection IBaseRestSection.Items
{
get { return Items; }
}
}
}
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.BaseRest
{
internal class BaseRestSection : UmbracoConfigurationSection, IBaseRestSection
{
private const string KeyEnabled = "enabled";
private bool? _enabled;
[ConfigurationProperty("", IsKey = false, IsRequired = false, IsDefaultCollection = true)]
public ExtensionElementCollection Items
{
get { return (ExtensionElementCollection)base[""]; }
}
/// <summary>
/// Gets or sets a value indicating whether base rest extensions are enabled.
/// </summary>
[ConfigurationProperty(KeyEnabled, DefaultValue = true, IsRequired = false)]
public bool Enabled
{
get
{
return _enabled ?? (IsPresent == false || (bool)this[KeyEnabled]);
}
internal set { _enabled = value; }
}
IExtensionsCollection IBaseRestSection.Items
{
get { return Items; }
}
}
}
@@ -1,81 +1,81 @@
using System;
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.BaseRest
{
[ConfigurationCollection(typeof(ExtensionElement), CollectionType = ConfigurationElementCollectionType.BasicMapAlternate)]
internal class ExtensionElement : ConfigurationElementCollection, IEnumerable<IMethodSection>, IExtension
{
const string KeyAlias = "alias";
const string KeyType = "type";
const string KeyMethod = "method";
[ConfigurationProperty(KeyAlias, IsKey = true, IsRequired = true)]
public string Alias
{
get { return (string)base[KeyAlias]; }
}
[ConfigurationProperty(KeyType, IsKey = false, IsRequired = true)]
public string Type
{
get { return (string)base[KeyType]; }
}
public override ConfigurationElementCollectionType CollectionType
{
get { return ConfigurationElementCollectionType.BasicMapAlternate; }
}
protected override string ElementName
{
get { return KeyMethod; }
}
protected override bool IsElementName(string elementName)
{
return elementName.Equals(KeyMethod, StringComparison.InvariantCultureIgnoreCase);
}
protected override ConfigurationElement CreateNewElement()
{
return new MethodElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((MethodElement)element).Name;
}
public override bool IsReadOnly()
{
return false;
}
new public MethodElement this[string index]
{
get { return (MethodElement)BaseGet(index); }
}
IEnumerator<IMethodSection> IEnumerable<IMethodSection>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as IMethodSection;
}
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
IMethodSection IExtension.this[string index]
{
get { return this[index]; }
}
}
}
using System;
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.BaseRest
{
[ConfigurationCollection(typeof(ExtensionElement), CollectionType = ConfigurationElementCollectionType.BasicMapAlternate)]
internal class ExtensionElement : ConfigurationElementCollection, IEnumerable<IMethodSection>, IExtension
{
const string KeyAlias = "alias";
const string KeyType = "type";
const string KeyMethod = "method";
[ConfigurationProperty(KeyAlias, IsKey = true, IsRequired = true)]
public string Alias
{
get { return (string)base[KeyAlias]; }
}
[ConfigurationProperty(KeyType, IsKey = false, IsRequired = true)]
public string Type
{
get { return (string)base[KeyType]; }
}
public override ConfigurationElementCollectionType CollectionType
{
get { return ConfigurationElementCollectionType.BasicMapAlternate; }
}
protected override string ElementName
{
get { return KeyMethod; }
}
protected override bool IsElementName(string elementName)
{
return elementName.Equals(KeyMethod, StringComparison.InvariantCultureIgnoreCase);
}
protected override ConfigurationElement CreateNewElement()
{
return new MethodElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((MethodElement)element).Name;
}
public override bool IsReadOnly()
{
return false;
}
new public MethodElement this[string index]
{
get { return (MethodElement)BaseGet(index); }
}
IEnumerator<IMethodSection> IEnumerable<IMethodSection>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as IMethodSection;
}
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
IMethodSection IExtension.this[string index]
{
get { return this[index]; }
}
}
}
@@ -1,70 +1,70 @@
using System;
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.BaseRest
{
public interface IExtensionsCollection : IEnumerable<IExtension>
{
IExtension this[string index] { get; }
}
[ConfigurationCollection(typeof(ExtensionElement), CollectionType = ConfigurationElementCollectionType.BasicMapAlternate)]
internal class ExtensionElementCollection : ConfigurationElementCollection, IExtensionsCollection
{
const string KeyExtension = "extension";
public override ConfigurationElementCollectionType CollectionType
{
get { return ConfigurationElementCollectionType.BasicMapAlternate; }
}
protected override string ElementName
{
get { return KeyExtension; }
}
protected override bool IsElementName(string elementName)
{
return elementName.Equals(KeyExtension, StringComparison.InvariantCultureIgnoreCase);
}
protected override ConfigurationElement CreateNewElement()
{
return new ExtensionElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((ExtensionElement)element).Alias;
}
public override bool IsReadOnly()
{
return false;
}
new public ExtensionElement this[string index]
{
get { return (ExtensionElement)BaseGet(index); }
}
IEnumerator<IExtension> IEnumerable<IExtension>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as IExtension;
}
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
IExtension IExtensionsCollection.this[string index]
{
get { return this[index]; }
}
}
}
using System;
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.BaseRest
{
public interface IExtensionsCollection : IEnumerable<IExtension>
{
IExtension this[string index] { get; }
}
[ConfigurationCollection(typeof(ExtensionElement), CollectionType = ConfigurationElementCollectionType.BasicMapAlternate)]
internal class ExtensionElementCollection : ConfigurationElementCollection, IExtensionsCollection
{
const string KeyExtension = "extension";
public override ConfigurationElementCollectionType CollectionType
{
get { return ConfigurationElementCollectionType.BasicMapAlternate; }
}
protected override string ElementName
{
get { return KeyExtension; }
}
protected override bool IsElementName(string elementName)
{
return elementName.Equals(KeyExtension, StringComparison.InvariantCultureIgnoreCase);
}
protected override ConfigurationElement CreateNewElement()
{
return new ExtensionElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((ExtensionElement)element).Alias;
}
public override bool IsReadOnly()
{
return false;
}
new public ExtensionElement this[string index]
{
get { return (ExtensionElement)BaseGet(index); }
}
IEnumerator<IExtension> IEnumerable<IExtension>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as IExtension;
}
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
IExtension IExtensionsCollection.this[string index]
{
get { return this[index]; }
}
}
}
@@ -1,14 +1,14 @@
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.BaseRest
{
public interface IBaseRestSection
{
IExtensionsCollection Items { get; }
/// <summary>
/// Gets a value indicating whether base rest extensions are enabled.
/// </summary>
bool Enabled { get; }
}
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.BaseRest
{
public interface IBaseRestSection
{
IExtensionsCollection Items { get; }
/// <summary>
/// Gets a value indicating whether base rest extensions are enabled.
/// </summary>
bool Enabled { get; }
}
}
@@ -1,11 +1,11 @@
namespace Umbraco.Core.Configuration.BaseRest
{
public interface IExtension
{
string Alias { get; }
string Type { get; }
IMethodSection this[string index] { get; }
}
namespace Umbraco.Core.Configuration.BaseRest
{
public interface IExtension
{
string Alias { get; }
string Type { get; }
IMethodSection this[string index] { get; }
}
}
@@ -1,17 +1,17 @@
namespace Umbraco.Core.Configuration.BaseRest
{
public interface IMethodSection
{
string Name { get; }
bool AllowAll { get; }
string AllowGroup { get; }
string AllowType { get; }
string AllowMember { get; }
bool ReturnXml { get; }
}
namespace Umbraco.Core.Configuration.BaseRest
{
public interface IMethodSection
{
string Name { get; }
bool AllowAll { get; }
string AllowGroup { get; }
string AllowType { get; }
string AllowMember { get; }
bool ReturnXml { get; }
}
}
@@ -1,50 +1,50 @@
using System.Configuration;
namespace Umbraco.Core.Configuration.BaseRest
{
internal class MethodElement : ConfigurationElement, IMethodSection
{
const string KeyName = "name";
const string KeyAllowAll = "allowAll";
const string KeyAllowGroup = "allowGroup";
const string KeyAllowType = "allowType";
const string KeyAllowMember = "allowMember";
const string KeyReturnXml = "returnXml";
[ConfigurationProperty(KeyName, IsKey = true, IsRequired = true)]
public string Name
{
get { return (string)base[KeyName]; }
}
[ConfigurationProperty(KeyAllowAll, IsKey = false, IsRequired = false, DefaultValue = false)]
public bool AllowAll
{
get { return (bool)base[KeyAllowAll]; }
}
[ConfigurationProperty(KeyAllowGroup, IsKey = false, IsRequired = false, DefaultValue = null)]
public string AllowGroup
{
get { return (string)base[KeyAllowGroup]; }
}
[ConfigurationProperty(KeyAllowType, IsKey = false, IsRequired = false, DefaultValue = null)]
public string AllowType
{
get { return (string)base[KeyAllowType]; }
}
[ConfigurationProperty(KeyAllowMember, IsKey = false, IsRequired = false, DefaultValue = null)]
public string AllowMember
{
get { return (string)base[KeyAllowMember]; }
}
[ConfigurationProperty(KeyReturnXml, IsKey = false, IsRequired = false, DefaultValue = true)]
public bool ReturnXml
{
get { return (bool)base[KeyReturnXml]; }
}
}
}
using System.Configuration;
namespace Umbraco.Core.Configuration.BaseRest
{
internal class MethodElement : ConfigurationElement, IMethodSection
{
const string KeyName = "name";
const string KeyAllowAll = "allowAll";
const string KeyAllowGroup = "allowGroup";
const string KeyAllowType = "allowType";
const string KeyAllowMember = "allowMember";
const string KeyReturnXml = "returnXml";
[ConfigurationProperty(KeyName, IsKey = true, IsRequired = true)]
public string Name
{
get { return (string)base[KeyName]; }
}
[ConfigurationProperty(KeyAllowAll, IsKey = false, IsRequired = false, DefaultValue = false)]
public bool AllowAll
{
get { return (bool)base[KeyAllowAll]; }
}
[ConfigurationProperty(KeyAllowGroup, IsKey = false, IsRequired = false, DefaultValue = null)]
public string AllowGroup
{
get { return (string)base[KeyAllowGroup]; }
}
[ConfigurationProperty(KeyAllowType, IsKey = false, IsRequired = false, DefaultValue = null)]
public string AllowType
{
get { return (string)base[KeyAllowType]; }
}
[ConfigurationProperty(KeyAllowMember, IsKey = false, IsRequired = false, DefaultValue = null)]
public string AllowMember
{
get { return (string)base[KeyAllowMember]; }
}
[ConfigurationProperty(KeyReturnXml, IsKey = false, IsRequired = false, DefaultValue = true)]
public bool ReturnXml
{
get { return (bool)base[KeyReturnXml]; }
}
}
}
@@ -1,70 +1,70 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
namespace Umbraco.Core.Configuration
{
/// <summary>
/// Defines a configuration section that contains inner text that is comma delimited
/// </summary>
internal class CommaDelimitedConfigurationElement : InnerTextConfigurationElement<CommaDelimitedStringCollection>, IEnumerable<string>
{
public override CommaDelimitedStringCollection Value
{
get
{
var converter = new CommaDelimitedStringCollectionConverter();
return (CommaDelimitedStringCollection) converter.ConvertFrom(RawValue);
}
}
IEnumerator<string> IEnumerable<string>.GetEnumerator()
{
return new InnerEnumerator(Value.GetEnumerator());
}
IEnumerator IEnumerable.GetEnumerator()
{
return new InnerEnumerator(Value.GetEnumerator());
}
/// <summary>
/// A wrapper for StringEnumerator since it doesn't explicitly implement IEnumerable
/// </summary>
private class InnerEnumerator : IEnumerator<string>
{
private readonly StringEnumerator _stringEnumerator;
public InnerEnumerator(StringEnumerator stringEnumerator)
{
_stringEnumerator = stringEnumerator;
}
public bool MoveNext()
{
return _stringEnumerator.MoveNext();
}
public void Reset()
{
_stringEnumerator.Reset();
}
string IEnumerator<string>.Current
{
get { return _stringEnumerator.Current; }
}
public object Current
{
get { return _stringEnumerator.Current; }
}
public void Dispose()
{
ObjectExtensions.DisposeIfDisposable(_stringEnumerator);
}
}
}
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
namespace Umbraco.Core.Configuration
{
/// <summary>
/// Defines a configuration section that contains inner text that is comma delimited
/// </summary>
internal class CommaDelimitedConfigurationElement : InnerTextConfigurationElement<CommaDelimitedStringCollection>, IEnumerable<string>
{
public override CommaDelimitedStringCollection Value
{
get
{
var converter = new CommaDelimitedStringCollectionConverter();
return (CommaDelimitedStringCollection) converter.ConvertFrom(RawValue);
}
}
IEnumerator<string> IEnumerable<string>.GetEnumerator()
{
return new InnerEnumerator(Value.GetEnumerator());
}
IEnumerator IEnumerable.GetEnumerator()
{
return new InnerEnumerator(Value.GetEnumerator());
}
/// <summary>
/// A wrapper for StringEnumerator since it doesn't explicitly implement IEnumerable
/// </summary>
private class InnerEnumerator : IEnumerator<string>
{
private readonly StringEnumerator _stringEnumerator;
public InnerEnumerator(StringEnumerator stringEnumerator)
{
_stringEnumerator = stringEnumerator;
}
public bool MoveNext()
{
return _stringEnumerator.MoveNext();
}
public void Reset()
{
_stringEnumerator.Reset();
}
string IEnumerator<string>.Current
{
get { return _stringEnumerator.Current; }
}
public object Current
{
get { return _stringEnumerator.Current; }
}
public void Dispose()
{
ObjectExtensions.DisposeIfDisposable(_stringEnumerator);
}
}
}
}
@@ -1,34 +1,34 @@
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class AccessElement : RawXmlConfigurationElement, IAccess
{
public AccessElement()
{
}
public AccessElement(XElement rawXml)
:base(rawXml)
{
}
public IEnumerable<IAccessItem> Rules
{
get
{
var result = new List<AccessItem>();
if (RawXml != null)
{
result.AddRange(RawXml.Elements("deny").Select(x => new AccessItem {Action = AccessType.Deny, Value = x.Value }));
result.AddRange(RawXml.Elements("grant").Select(x => new AccessItem { Action = AccessType.Grant, Value = x.Value }));
result.AddRange(RawXml.Elements("grantBySection").Select(x => new AccessItem { Action = AccessType.GrantBySection, Value = x.Value }));
}
return result;
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class AccessElement : RawXmlConfigurationElement, IAccess
{
public AccessElement()
{
}
public AccessElement(XElement rawXml)
:base(rawXml)
{
}
public IEnumerable<IAccessItem> Rules
{
get
{
var result = new List<AccessItem>();
if (RawXml != null)
{
result.AddRange(RawXml.Elements("deny").Select(x => new AccessItem {Action = AccessType.Deny, Value = x.Value }));
result.AddRange(RawXml.Elements("grant").Select(x => new AccessItem { Action = AccessType.Grant, Value = x.Value }));
result.AddRange(RawXml.Elements("grantBySection").Select(x => new AccessItem { Action = AccessType.GrantBySection, Value = x.Value }));
}
return result;
}
}
}
}
@@ -1,15 +1,15 @@
namespace Umbraco.Core.Configuration.Dashboard
{
internal class AccessItem : IAccessItem
{
/// <summary>
/// This can be grant, deny or grantBySection
/// </summary>
public AccessType Action { get; set; }
/// <summary>
/// The value of the action
/// </summary>
public string Value { get; set; }
}
namespace Umbraco.Core.Configuration.Dashboard
{
internal class AccessItem : IAccessItem
{
/// <summary>
/// This can be grant, deny or grantBySection
/// </summary>
public AccessType Action { get; set; }
/// <summary>
/// The value of the action
/// </summary>
public string Value { get; set; }
}
}
@@ -1,9 +1,9 @@
namespace Umbraco.Core.Configuration.Dashboard
{
public enum AccessType
{
Grant,
Deny,
GrantBySection
}
namespace Umbraco.Core.Configuration.Dashboard
{
public enum AccessType
{
Grant,
Deny,
GrantBySection
}
}
@@ -1,32 +1,32 @@
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class AreaCollection : ConfigurationElementCollection, IEnumerable<IArea>
{
protected override ConfigurationElement CreateNewElement()
{
return new AreaElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((AreaElement) element).Value;
}
IEnumerator<IArea> IEnumerable<IArea>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as IArea;
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class AreaCollection : ConfigurationElementCollection, IEnumerable<IArea>
{
protected override ConfigurationElement CreateNewElement()
{
return new AreaElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((AreaElement) element).Value;
}
IEnumerator<IArea> IEnumerable<IArea>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as IArea;
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}
@@ -1,12 +1,12 @@
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class AreaElement : InnerTextConfigurationElement<string>, IArea
{
string IArea.AreaName
{
get { return Value; }
}
}
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class AreaElement : InnerTextConfigurationElement<string>, IArea
{
string IArea.AreaName
{
get { return Value; }
}
}
}
@@ -1,15 +1,15 @@
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class AreasElement : ConfigurationElement
{
[ConfigurationCollection(typeof(SectionCollection), AddItemName = "area")]
[ConfigurationProperty("", IsDefaultCollection = true)]
public AreaCollection AreaCollection
{
get { return (AreaCollection)base[""]; }
set { base[""] = value; }
}
}
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class AreasElement : ConfigurationElement
{
[ConfigurationCollection(typeof(SectionCollection), AddItemName = "area")]
[ConfigurationProperty("", IsDefaultCollection = true)]
public AreaCollection AreaCollection
{
get { return (AreaCollection)base[""]; }
set { base[""] = value; }
}
}
}
@@ -1,37 +1,37 @@
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class ControlCollection : ConfigurationElementCollection, IEnumerable<IDashboardControl>
{
internal void Add(ControlElement c)
{
BaseAdd(c);
}
protected override ConfigurationElement CreateNewElement()
{
return new ControlElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((ControlElement)element).ControlPath;
}
IEnumerator<IDashboardControl> IEnumerable<IDashboardControl>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as IDashboardControl;
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class ControlCollection : ConfigurationElementCollection, IEnumerable<IDashboardControl>
{
internal void Add(ControlElement c)
{
BaseAdd(c);
}
protected override ConfigurationElement CreateNewElement()
{
return new ControlElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((ControlElement)element).ControlPath;
}
IEnumerator<IDashboardControl> IEnumerable<IDashboardControl>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as IDashboardControl;
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}
@@ -1,74 +1,74 @@
using System;
using System.Configuration;
using System.Linq;
using System.Xml.Linq;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class ControlElement : RawXmlConfigurationElement, IDashboardControl
{
public bool ShowOnce
{
get
{
return RawXml.Attribute("showOnce") == null
? false
: bool.Parse(RawXml.Attribute("showOnce").Value);
}
}
public bool AddPanel
{
get
{
return RawXml.Attribute("addPanel") == null
? true
: bool.Parse(RawXml.Attribute("addPanel").Value);
}
}
public string PanelCaption
{
get
{
return RawXml.Attribute("panelCaption") == null
? ""
: RawXml.Attribute("panelCaption").Value;
}
}
public AccessElement Access
{
get
{
var access = RawXml.Element("access");
if (access == null)
{
return new AccessElement();
}
return new AccessElement(access);
}
}
public string ControlPath
{
get
{
//we need to return the first (and only) text element of the children (wtf... who designed this configuration ! :P )
var txt = RawXml.Nodes().OfType<XText>().FirstOrDefault();
if (txt == null)
{
throw new ConfigurationErrorsException("The control element must contain a text node indicating the control path");
}
return txt.Value.Trim();
}
}
IAccess IDashboardControl.AccessRights
{
get { return Access; }
}
}
using System;
using System.Configuration;
using System.Linq;
using System.Xml.Linq;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class ControlElement : RawXmlConfigurationElement, IDashboardControl
{
public bool ShowOnce
{
get
{
return RawXml.Attribute("showOnce") == null
? false
: bool.Parse(RawXml.Attribute("showOnce").Value);
}
}
public bool AddPanel
{
get
{
return RawXml.Attribute("addPanel") == null
? true
: bool.Parse(RawXml.Attribute("addPanel").Value);
}
}
public string PanelCaption
{
get
{
return RawXml.Attribute("panelCaption") == null
? ""
: RawXml.Attribute("panelCaption").Value;
}
}
public AccessElement Access
{
get
{
var access = RawXml.Element("access");
if (access == null)
{
return new AccessElement();
}
return new AccessElement(access);
}
}
public string ControlPath
{
get
{
//we need to return the first (and only) text element of the children (wtf... who designed this configuration ! :P )
var txt = RawXml.Nodes().OfType<XText>().FirstOrDefault();
if (txt == null)
{
throw new ConfigurationErrorsException("The control element must contain a text node indicating the control path");
}
return txt.Value.Trim();
}
}
IAccess IDashboardControl.AccessRights
{
get { return Access; }
}
}
}
@@ -1,24 +1,24 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class DashboardSection : ConfigurationSection, IDashboardSection
{
[ConfigurationCollection(typeof(SectionCollection), AddItemName = "section")]
[ConfigurationProperty("", IsDefaultCollection = true)]
public SectionCollection SectionCollection
{
get { return (SectionCollection)base[""]; }
set { base[""] = value; }
}
IEnumerable<ISection> IDashboardSection.Sections
{
get { return SectionCollection; }
}
}
}
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class DashboardSection : ConfigurationSection, IDashboardSection
{
[ConfigurationCollection(typeof(SectionCollection), AddItemName = "section")]
[ConfigurationProperty("", IsDefaultCollection = true)]
public SectionCollection SectionCollection
{
get { return (SectionCollection)base[""]; }
set { base[""] = value; }
}
IEnumerable<ISection> IDashboardSection.Sections
{
get { return SectionCollection; }
}
}
}
@@ -1,9 +1,9 @@
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.Dashboard
{
public interface IAccess
{
IEnumerable<IAccessItem> Rules { get; }
}
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.Dashboard
{
public interface IAccess
{
IEnumerable<IAccessItem> Rules { get; }
}
}
@@ -1,15 +1,15 @@
namespace Umbraco.Core.Configuration.Dashboard
{
public interface IAccessItem
{
/// <summary>
/// This can be grant, deny or grantBySection
/// </summary>
AccessType Action { get; set; }
/// <summary>
/// The value of the action
/// </summary>
string Value { get; set; }
}
namespace Umbraco.Core.Configuration.Dashboard
{
public interface IAccessItem
{
/// <summary>
/// This can be grant, deny or grantBySection
/// </summary>
AccessType Action { get; set; }
/// <summary>
/// The value of the action
/// </summary>
string Value { get; set; }
}
}
@@ -1,7 +1,7 @@
namespace Umbraco.Core.Configuration.Dashboard
{
public interface IArea
{
string AreaName { get; }
}
namespace Umbraco.Core.Configuration.Dashboard
{
public interface IArea
{
string AreaName { get; }
}
}
@@ -1,15 +1,15 @@
namespace Umbraco.Core.Configuration.Dashboard
{
public interface IDashboardControl
{
bool ShowOnce { get; }
bool AddPanel { get; }
string PanelCaption { get; }
string ControlPath { get; }
IAccess AccessRights { get; }
}
namespace Umbraco.Core.Configuration.Dashboard
{
public interface IDashboardControl
{
bool ShowOnce { get; }
bool AddPanel { get; }
string PanelCaption { get; }
string ControlPath { get; }
IAccess AccessRights { get; }
}
}
@@ -1,9 +1,9 @@
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.Dashboard
{
public interface IDashboardSection
{
IEnumerable<ISection> Sections { get; }
}
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.Dashboard
{
public interface IDashboardSection
{
IEnumerable<ISection> Sections { get; }
}
}
@@ -1,13 +1,13 @@
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.Dashboard
{
public interface IDashboardTab
{
string Caption { get; }
IEnumerable<IDashboardControl> Controls { get; }
IAccess AccessRights { get; }
}
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.Dashboard
{
public interface IDashboardTab
{
string Caption { get; }
IEnumerable<IDashboardControl> Controls { get; }
IAccess AccessRights { get; }
}
}
@@ -1,15 +1,15 @@
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.Dashboard
{
public interface ISection
{
string Alias { get; }
IEnumerable<string> Areas { get; }
IEnumerable<IDashboardTab> Tabs { get; }
IAccess AccessRights { get; }
}
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.Dashboard
{
public interface ISection
{
string Alias { get; }
IEnumerable<string> Areas { get; }
IEnumerable<IDashboardTab> Tabs { get; }
IAccess AccessRights { get; }
}
}
@@ -1,37 +1,37 @@
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class SectionCollection : ConfigurationElementCollection, IEnumerable<ISection>
{
internal void Add(SectionElement c)
{
BaseAdd(c);
}
protected override ConfigurationElement CreateNewElement()
{
return new SectionElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((SectionElement)element).Alias;
}
IEnumerator<ISection> IEnumerable<ISection>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as ISection;
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class SectionCollection : ConfigurationElementCollection, IEnumerable<ISection>
{
internal void Add(SectionElement c)
{
BaseAdd(c);
}
protected override ConfigurationElement CreateNewElement()
{
return new SectionElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((SectionElement)element).Alias;
}
IEnumerator<ISection> IEnumerable<ISection>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as ISection;
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}
@@ -1,50 +1,50 @@
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class SectionElement : ConfigurationElement, ISection
{
[ConfigurationProperty("alias", IsRequired = true)]
public string Alias
{
get { return (string) this["alias"]; }
}
[ConfigurationProperty("areas", IsRequired = true)]
public AreasElement Areas
{
get { return (AreasElement)this["areas"]; }
}
[ConfigurationProperty("access")]
public AccessElement Access
{
get { return (AccessElement)this["access"]; }
}
[ConfigurationCollection(typeof(SectionCollection), AddItemName = "tab")]
[ConfigurationProperty("", IsDefaultCollection = true)]
public TabCollection TabCollection
{
get { return (TabCollection)base[""]; }
set { base[""] = value; }
}
IEnumerable<IDashboardTab> ISection.Tabs
{
get { return TabCollection; }
}
IEnumerable<string> ISection.Areas
{
get { return Areas.AreaCollection.Cast<AreaElement>().Select(x => x.Value); }
}
IAccess ISection.AccessRights
{
get { return Access; }
}
}
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class SectionElement : ConfigurationElement, ISection
{
[ConfigurationProperty("alias", IsRequired = true)]
public string Alias
{
get { return (string) this["alias"]; }
}
[ConfigurationProperty("areas", IsRequired = true)]
public AreasElement Areas
{
get { return (AreasElement)this["areas"]; }
}
[ConfigurationProperty("access")]
public AccessElement Access
{
get { return (AccessElement)this["access"]; }
}
[ConfigurationCollection(typeof(SectionCollection), AddItemName = "tab")]
[ConfigurationProperty("", IsDefaultCollection = true)]
public TabCollection TabCollection
{
get { return (TabCollection)base[""]; }
set { base[""] = value; }
}
IEnumerable<IDashboardTab> ISection.Tabs
{
get { return TabCollection; }
}
IEnumerable<string> ISection.Areas
{
get { return Areas.AreaCollection.Cast<AreaElement>().Select(x => x.Value); }
}
IAccess ISection.AccessRights
{
get { return Access; }
}
}
}
@@ -1,37 +1,37 @@
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class TabCollection : ConfigurationElementCollection, IEnumerable<IDashboardTab>
{
internal void Add(TabElement c)
{
BaseAdd(c);
}
protected override ConfigurationElement CreateNewElement()
{
return new TabElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((TabElement)element).Caption;
}
IEnumerator<IDashboardTab> IEnumerable<IDashboardTab>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as IDashboardTab;
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class TabCollection : ConfigurationElementCollection, IEnumerable<IDashboardTab>
{
internal void Add(TabElement c)
{
BaseAdd(c);
}
protected override ConfigurationElement CreateNewElement()
{
return new TabElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((TabElement)element).Caption;
}
IEnumerator<IDashboardTab> IEnumerable<IDashboardTab>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as IDashboardTab;
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}
@@ -1,38 +1,38 @@
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class TabElement : ConfigurationElement, IDashboardTab
{
[ConfigurationProperty("caption", IsRequired = true)]
public string Caption
{
get { return (string)this["caption"]; }
}
[ConfigurationProperty("access")]
public AccessElement Access
{
get { return (AccessElement)this["access"]; }
}
[ConfigurationCollection(typeof(ControlCollection), AddItemName = "control")]
[ConfigurationProperty("", IsDefaultCollection = true)]
public ControlCollection ControlCollection
{
get { return (ControlCollection)base[""]; }
set { base[""] = value; }
}
IEnumerable<IDashboardControl> IDashboardTab.Controls
{
get { return ControlCollection; }
}
IAccess IDashboardTab.AccessRights
{
get { return Access; }
}
}
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class TabElement : ConfigurationElement, IDashboardTab
{
[ConfigurationProperty("caption", IsRequired = true)]
public string Caption
{
get { return (string)this["caption"]; }
}
[ConfigurationProperty("access")]
public AccessElement Access
{
get { return (AccessElement)this["access"]; }
}
[ConfigurationCollection(typeof(ControlCollection), AddItemName = "control")]
[ConfigurationProperty("", IsDefaultCollection = true)]
public ControlCollection ControlCollection
{
get { return (ControlCollection)base[""]; }
set { base[""] = value; }
}
IEnumerable<IDashboardControl> IDashboardTab.Controls
{
get { return ControlCollection; }
}
IAccess IDashboardTab.AccessRights
{
get { return Access; }
}
}
}
@@ -1,69 +1,69 @@
using System;
using System.Xml;
using System.Xml.Linq;
namespace Umbraco.Core.Configuration
{
/// <summary>
/// A full config section is required for any full element and we have some elements that are defined like this:
/// {element}MyValue{/element} instead of as attribute values.
/// </summary>
/// <typeparam name="T"></typeparam>
internal class InnerTextConfigurationElement<T> : RawXmlConfigurationElement
{
public InnerTextConfigurationElement()
{
}
public InnerTextConfigurationElement(XElement rawXml) : base(rawXml)
{
}
protected override void DeserializeElement(XmlReader reader, bool serializeCollectionKey)
{
base.DeserializeElement(reader, serializeCollectionKey);
//now validate and set the raw value
if (RawXml.HasElements)
throw new InvalidOperationException("An InnerTextConfigurationElement cannot contain any child elements, only attributes and a value");
RawValue = RawXml.Value.Trim();
//RawValue = reader.ReadElementContentAsString();
}
public virtual T Value
{
get
{
var converted = ObjectExtensions.TryConvertTo<T>(RawValue);
if (converted.Success == false)
throw new InvalidCastException("Could not convert value " + RawValue + " to type " + typeof(T));
return converted.Result;
}
}
/// <summary>
/// Exposes the raw string value
/// </summary>
internal string RawValue { get; set; }
/// <summary>
/// Implicit operator so we don't need to use the 'Value' property explicitly
/// </summary>
/// <param name="m"></param>
/// <returns></returns>
public static implicit operator T(InnerTextConfigurationElement<T> m)
{
return m.Value;
}
/// <summary>
/// Return the string value of Value
/// </summary>
/// <returns></returns>
public override string ToString()
{
return string.Format("{0}", Value);
}
}
using System;
using System.Xml;
using System.Xml.Linq;
namespace Umbraco.Core.Configuration
{
/// <summary>
/// A full config section is required for any full element and we have some elements that are defined like this:
/// {element}MyValue{/element} instead of as attribute values.
/// </summary>
/// <typeparam name="T"></typeparam>
internal class InnerTextConfigurationElement<T> : RawXmlConfigurationElement
{
public InnerTextConfigurationElement()
{
}
public InnerTextConfigurationElement(XElement rawXml) : base(rawXml)
{
}
protected override void DeserializeElement(XmlReader reader, bool serializeCollectionKey)
{
base.DeserializeElement(reader, serializeCollectionKey);
//now validate and set the raw value
if (RawXml.HasElements)
throw new InvalidOperationException("An InnerTextConfigurationElement cannot contain any child elements, only attributes and a value");
RawValue = RawXml.Value.Trim();
//RawValue = reader.ReadElementContentAsString();
}
public virtual T Value
{
get
{
var converted = ObjectExtensions.TryConvertTo<T>(RawValue);
if (converted.Success == false)
throw new InvalidCastException("Could not convert value " + RawValue + " to type " + typeof(T));
return converted.Result;
}
}
/// <summary>
/// Exposes the raw string value
/// </summary>
internal string RawValue { get; set; }
/// <summary>
/// Implicit operator so we don't need to use the 'Value' property explicitly
/// </summary>
/// <param name="m"></param>
/// <returns></returns>
public static implicit operator T(InnerTextConfigurationElement<T> m)
{
return m.Value;
}
/// <summary>
/// Return the string value of Value
/// </summary>
/// <returns></returns>
public override string ToString()
{
return string.Format("{0}", Value);
}
}
}
@@ -1,43 +1,43 @@
using System.Configuration;
using Umbraco.Core.Configuration.UmbracoSettings;
namespace Umbraco.Core.Configuration
{
/// <summary>
/// Used for specifying default values for comma delimited config
/// </summary>
internal class OptionalCommaDelimitedConfigurationElement : CommaDelimitedConfigurationElement
{
private readonly CommaDelimitedConfigurationElement _wrapped;
private readonly string[] _defaultValue;
public OptionalCommaDelimitedConfigurationElement()
{
}
public OptionalCommaDelimitedConfigurationElement(CommaDelimitedConfigurationElement wrapped, string[] defaultValue)
{
_wrapped = wrapped;
_defaultValue = defaultValue;
}
public override CommaDelimitedStringCollection Value
{
get
{
if (_wrapped == null)
{
return base.Value;
}
if (string.IsNullOrEmpty(_wrapped.RawValue))
{
var val = new CommaDelimitedStringCollection();
val.AddRange(_defaultValue);
return val;
}
return _wrapped.Value;
}
}
}
using System.Configuration;
using Umbraco.Core.Configuration.UmbracoSettings;
namespace Umbraco.Core.Configuration
{
/// <summary>
/// Used for specifying default values for comma delimited config
/// </summary>
internal class OptionalCommaDelimitedConfigurationElement : CommaDelimitedConfigurationElement
{
private readonly CommaDelimitedConfigurationElement _wrapped;
private readonly string[] _defaultValue;
public OptionalCommaDelimitedConfigurationElement()
{
}
public OptionalCommaDelimitedConfigurationElement(CommaDelimitedConfigurationElement wrapped, string[] defaultValue)
{
_wrapped = wrapped;
_defaultValue = defaultValue;
}
public override CommaDelimitedStringCollection Value
{
get
{
if (_wrapped == null)
{
return base.Value;
}
if (string.IsNullOrEmpty(_wrapped.RawValue))
{
var val = new CommaDelimitedStringCollection();
val.AddRange(_defaultValue);
return val;
}
return _wrapped.Value;
}
}
}
}
@@ -1,23 +1,23 @@
namespace Umbraco.Core.Configuration
{
/// <summary>
/// This is used to supply optional/default values when using InnerTextConfigurationElement
/// </summary>
/// <typeparam name="T"></typeparam>
internal class OptionalInnerTextConfigurationElement<T> : InnerTextConfigurationElement<T>
{
private readonly InnerTextConfigurationElement<T> _wrapped;
private readonly T _defaultValue;
public OptionalInnerTextConfigurationElement(InnerTextConfigurationElement<T> wrapped, T defaultValue)
{
_wrapped = wrapped;
_defaultValue = defaultValue;
}
public override T Value
{
get { return string.IsNullOrEmpty(_wrapped.RawValue) ? _defaultValue : _wrapped.Value; }
}
}
namespace Umbraco.Core.Configuration
{
/// <summary>
/// This is used to supply optional/default values when using InnerTextConfigurationElement
/// </summary>
/// <typeparam name="T"></typeparam>
internal class OptionalInnerTextConfigurationElement<T> : InnerTextConfigurationElement<T>
{
private readonly InnerTextConfigurationElement<T> _wrapped;
private readonly T _defaultValue;
public OptionalInnerTextConfigurationElement(InnerTextConfigurationElement<T> wrapped, T defaultValue)
{
_wrapped = wrapped;
_defaultValue = defaultValue;
}
public override T Value
{
get { return string.IsNullOrEmpty(_wrapped.RawValue) ? _defaultValue : _wrapped.Value; }
}
}
}
@@ -1,30 +1,30 @@
using System.Configuration;
using System.Xml;
using System.Xml.Linq;
namespace Umbraco.Core.Configuration
{
/// <summary>
/// A configuration section that simply exposes the entire raw xml of the section itself which inheritors can use
/// to do with as they please.
/// </summary>
internal abstract class RawXmlConfigurationElement : ConfigurationElement
{
protected RawXmlConfigurationElement()
{
}
protected RawXmlConfigurationElement(XElement rawXml)
{
RawXml = rawXml;
}
protected override void DeserializeElement(XmlReader reader, bool serializeCollectionKey)
{
RawXml = (XElement)XNode.ReadFrom(reader);
}
protected XElement RawXml { get; private set; }
}
using System.Configuration;
using System.Xml;
using System.Xml.Linq;
namespace Umbraco.Core.Configuration
{
/// <summary>
/// A configuration section that simply exposes the entire raw xml of the section itself which inheritors can use
/// to do with as they please.
/// </summary>
internal abstract class RawXmlConfigurationElement : ConfigurationElement
{
protected RawXmlConfigurationElement()
{
}
protected RawXmlConfigurationElement(XElement rawXml)
{
RawXml = rawXml;
}
protected override void DeserializeElement(XmlReader reader, bool serializeCollectionKey)
{
RawXml = (XElement)XNode.ReadFrom(reader);
}
protected XElement RawXml { get; private set; }
}
}
+126 -126
View File
@@ -1,127 +1,127 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Threading;
using Umbraco.Core.Configuration.BaseRest;
using Umbraco.Core.Configuration.Dashboard;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Logging;
namespace Umbraco.Core.Configuration
{
/// <summary>
/// The gateway to all umbraco configuration
/// </summary>
public class UmbracoConfig
{
#region Singleton
private static readonly Lazy<UmbracoConfig> Lazy = new Lazy<UmbracoConfig>(() => new UmbracoConfig());
public static UmbracoConfig For
{
get { return Lazy.Value; }
}
#endregion
/// <summary>
/// Default constructor
/// </summary>
private UmbracoConfig()
{
if (_umbracoSettings == null)
{
var umbracoSettings = ConfigurationManager.GetSection("umbracoConfiguration/settings") as IUmbracoSettingsSection;
if (umbracoSettings == null)
{
LogHelper.Warn<UmbracoConfig>("Could not load the " + typeof(IUmbracoSettingsSection) + " from config file!");
}
SetUmbracoSettings(umbracoSettings);
}
if (_baseRestExtensions == null)
{
var baseRestExtensions = ConfigurationManager.GetSection("umbracoConfiguration/BaseRestExtensions") as IBaseRestSection;
if (baseRestExtensions == null)
{
LogHelper.Warn<UmbracoConfig>("Could not load the " + typeof(IBaseRestSection) + " from config file!");
}
SetBaseRestExtensions(baseRestExtensions);
}
if (_dashboardSection == null)
{
var dashboardConfig = ConfigurationManager.GetSection("umbracoConfiguration/dashBoard") as IDashboardSection;
if (dashboardConfig == null)
{
LogHelper.Warn<UmbracoConfig>("Could not load the " + typeof(IDashboardSection) + " from config file!");
}
SetDashboardSettings(dashboardConfig);
}
}
/// <summary>
/// Constructor - can be used for testing
/// </summary>
/// <param name="umbracoSettings"></param>
/// <param name="baseRestSettings"></param>
/// <param name="dashboardSettings"></param>
public UmbracoConfig(IUmbracoSettingsSection umbracoSettings, IBaseRestSection baseRestSettings, IDashboardSection dashboardSettings)
{
SetUmbracoSettings(umbracoSettings);
SetBaseRestExtensions(baseRestSettings);
SetDashboardSettings(dashboardSettings);
}
private IDashboardSection _dashboardSection;
private IUmbracoSettingsSection _umbracoSettings;
private IBaseRestSection _baseRestExtensions;
/// <summary>
/// Gets the IDashboardSection
/// </summary>
public IDashboardSection DashboardSettings()
{
return _dashboardSection;
}
//ONLY for unit testing
internal void SetDashboardSettings(IDashboardSection value)
{
_dashboardSection = value;
}
//ONLY for unit testing
internal void SetUmbracoSettings(IUmbracoSettingsSection value)
{
_umbracoSettings = value;
}
/// <summary>
/// Gets the IUmbracoSettings
/// </summary>
public IUmbracoSettingsSection UmbracoSettings()
{
return _umbracoSettings;
}
//ONLY for unit testing
public void SetBaseRestExtensions(IBaseRestSection value)
{
_baseRestExtensions = value;
}
/// <summary>
/// Gets the IBaseRestSection
/// </summary>
public IBaseRestSection BaseRestExtensions()
{
return _baseRestExtensions;
}
//TODO: Add other configurations here !
}
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Threading;
using Umbraco.Core.Configuration.BaseRest;
using Umbraco.Core.Configuration.Dashboard;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Logging;
namespace Umbraco.Core.Configuration
{
/// <summary>
/// The gateway to all umbraco configuration
/// </summary>
public class UmbracoConfig
{
#region Singleton
private static readonly Lazy<UmbracoConfig> Lazy = new Lazy<UmbracoConfig>(() => new UmbracoConfig());
public static UmbracoConfig For
{
get { return Lazy.Value; }
}
#endregion
/// <summary>
/// Default constructor
/// </summary>
private UmbracoConfig()
{
if (_umbracoSettings == null)
{
var umbracoSettings = ConfigurationManager.GetSection("umbracoConfiguration/settings") as IUmbracoSettingsSection;
if (umbracoSettings == null)
{
LogHelper.Warn<UmbracoConfig>("Could not load the " + typeof(IUmbracoSettingsSection) + " from config file!");
}
SetUmbracoSettings(umbracoSettings);
}
if (_baseRestExtensions == null)
{
var baseRestExtensions = ConfigurationManager.GetSection("umbracoConfiguration/BaseRestExtensions") as IBaseRestSection;
if (baseRestExtensions == null)
{
LogHelper.Warn<UmbracoConfig>("Could not load the " + typeof(IBaseRestSection) + " from config file!");
}
SetBaseRestExtensions(baseRestExtensions);
}
if (_dashboardSection == null)
{
var dashboardConfig = ConfigurationManager.GetSection("umbracoConfiguration/dashBoard") as IDashboardSection;
if (dashboardConfig == null)
{
LogHelper.Warn<UmbracoConfig>("Could not load the " + typeof(IDashboardSection) + " from config file!");
}
SetDashboardSettings(dashboardConfig);
}
}
/// <summary>
/// Constructor - can be used for testing
/// </summary>
/// <param name="umbracoSettings"></param>
/// <param name="baseRestSettings"></param>
/// <param name="dashboardSettings"></param>
public UmbracoConfig(IUmbracoSettingsSection umbracoSettings, IBaseRestSection baseRestSettings, IDashboardSection dashboardSettings)
{
SetUmbracoSettings(umbracoSettings);
SetBaseRestExtensions(baseRestSettings);
SetDashboardSettings(dashboardSettings);
}
private IDashboardSection _dashboardSection;
private IUmbracoSettingsSection _umbracoSettings;
private IBaseRestSection _baseRestExtensions;
/// <summary>
/// Gets the IDashboardSection
/// </summary>
public IDashboardSection DashboardSettings()
{
return _dashboardSection;
}
//ONLY for unit testing
internal void SetDashboardSettings(IDashboardSection value)
{
_dashboardSection = value;
}
//ONLY for unit testing
internal void SetUmbracoSettings(IUmbracoSettingsSection value)
{
_umbracoSettings = value;
}
/// <summary>
/// Gets the IUmbracoSettings
/// </summary>
public IUmbracoSettingsSection UmbracoSettings()
{
return _umbracoSettings;
}
//ONLY for unit testing
public void SetBaseRestExtensions(IBaseRestSection value)
{
_baseRestExtensions = value;
}
/// <summary>
/// Gets the IBaseRestSection
/// </summary>
public IBaseRestSection BaseRestExtensions()
{
return _baseRestExtensions;
}
//TODO: Add other configurations here !
}
}
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
@@ -217,6 +218,19 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
}
}
[Obsolete("This is here so that if this config element exists we won't get a YSOD, it is not used whatsoever and will be removed in future versions")]
[ConfigurationProperty("DocumentTypeIconList")]
internal InnerTextConfigurationElement<IconPickerBehaviour> DocumentTypeIconList
{
get
{
return new OptionalInnerTextConfigurationElement<IconPickerBehaviour>(
(InnerTextConfigurationElement<IconPickerBehaviour>)this["DocumentTypeIconList"],
//set the default
IconPickerBehaviour.HideFileDuplicates);
}
}
[ConfigurationProperty("disallowedUploadFiles")]
internal CommaDelimitedConfigurationElement DisallowedUploadFiles
{
@@ -380,7 +394,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
{
get { return MacroErrors; }
}
IEnumerable<string> IContentSection.DisallowedUploadFiles
{
get { return DisallowedUploadFiles; }
@@ -1,8 +1,8 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IChar
{
string Char { get; }
string Replacement { get; }
}
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IChar
{
string Char { get; }
string Replacement { get; }
}
}
@@ -1,8 +1,8 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IContentErrorPage
{
int ContentId { get; }
string Culture { get; set; }
}
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IContentErrorPage
{
int ContentId { get; }
string Culture { get; set; }
}
}
@@ -1,63 +1,63 @@
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IContentSection : IUmbracoConfigurationSection
{
string NotificationEmailAddress { get; }
bool DisableHtmlEmail { get; }
IEnumerable<string> ImageFileTypes { get; }
IEnumerable<string> ImageTagAllowedAttributes { get; }
IEnumerable<IImagingAutoFillUploadField> ImageAutoFillProperties { get; }
string ScriptFolderPath { get; }
IEnumerable<string> ScriptFileTypes { get; }
bool ScriptEditorDisable { get; }
bool ResolveUrlsFromTextString { get; }
bool UploadAllowDirectories { get; }
IEnumerable<IContentErrorPage> Error404Collection { get; }
bool EnsureUniqueNaming { get; }
bool TidyEditorContent { get; }
string TidyCharEncoding { get; }
bool XmlCacheEnabled { get; }
bool ContinouslyUpdateXmlDiskCache { get; }
bool XmlContentCheckForDiskChanges { get; }
bool EnableSplashWhileLoading { get; }
string PropertyContextHelpOption { get; }
bool UseLegacyXmlSchema { get; }
bool ForceSafeAliases { get; }
string PreviewBadge { get; }
int UmbracoLibraryCacheDuration { get; }
MacroErrorBehaviour MacroErrorBehaviour { get; }
IEnumerable<string> DisallowedUploadFiles { get; }
bool CloneXmlContent { get; }
bool GlobalPreviewStorageEnabled { get; }
string DefaultDocumentTypeProperty { get; }
}
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IContentSection : IUmbracoConfigurationSection
{
string NotificationEmailAddress { get; }
bool DisableHtmlEmail { get; }
IEnumerable<string> ImageFileTypes { get; }
IEnumerable<string> ImageTagAllowedAttributes { get; }
IEnumerable<IImagingAutoFillUploadField> ImageAutoFillProperties { get; }
string ScriptFolderPath { get; }
IEnumerable<string> ScriptFileTypes { get; }
bool ScriptEditorDisable { get; }
bool ResolveUrlsFromTextString { get; }
bool UploadAllowDirectories { get; }
IEnumerable<IContentErrorPage> Error404Collection { get; }
bool EnsureUniqueNaming { get; }
bool TidyEditorContent { get; }
string TidyCharEncoding { get; }
bool XmlCacheEnabled { get; }
bool ContinouslyUpdateXmlDiskCache { get; }
bool XmlContentCheckForDiskChanges { get; }
bool EnableSplashWhileLoading { get; }
string PropertyContextHelpOption { get; }
bool UseLegacyXmlSchema { get; }
bool ForceSafeAliases { get; }
string PreviewBadge { get; }
int UmbracoLibraryCacheDuration { get; }
MacroErrorBehaviour MacroErrorBehaviour { get; }
IEnumerable<string> DisallowedUploadFiles { get; }
bool CloneXmlContent { get; }
bool GlobalPreviewStorageEnabled { get; }
string DefaultDocumentTypeProperty { get; }
}
}
@@ -1,9 +1,9 @@
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IDeveloperSection : IUmbracoConfigurationSection
{
IEnumerable<IFileExtension> AppCodeFileExtensions { get; }
}
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IDeveloperSection : IUmbracoConfigurationSection
{
IEnumerable<IFileExtension> AppCodeFileExtensions { get; }
}
}
@@ -1,13 +1,13 @@
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IDistributedCallSection : IUmbracoConfigurationSection
{
bool Enabled { get; }
int UserId { get; }
IEnumerable<IServer> Servers { get; }
}
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IDistributedCallSection : IUmbracoConfigurationSection
{
bool Enabled { get; }
int UserId { get; }
IEnumerable<IServer> Servers { get; }
}
}
@@ -1,7 +1,7 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IFileExtension
{
string Extension { get; }
}
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IFileExtension
{
string Extension { get; }
}
}
@@ -1,11 +1,11 @@
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IHelpSection : IUmbracoConfigurationSection
{
string DefaultUrl { get; }
IEnumerable<ILink> Links { get; }
}
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IHelpSection : IUmbracoConfigurationSection
{
string DefaultUrl { get; }
IEnumerable<ILink> Links { get; }
}
}
@@ -1,18 +1,18 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IImagingAutoFillUploadField
{
/// <summary>
/// Allow setting internally so we can create a default
/// </summary>
string Alias { get; }
string WidthFieldAlias { get; }
string HeightFieldAlias { get; }
string LengthFieldAlias { get; }
string ExtensionFieldAlias { get; }
}
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IImagingAutoFillUploadField
{
/// <summary>
/// Allow setting internally so we can create a default
/// </summary>
string Alias { get; }
string WidthFieldAlias { get; }
string HeightFieldAlias { get; }
string LengthFieldAlias { get; }
string ExtensionFieldAlias { get; }
}
}
@@ -1,15 +1,15 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface ILink
{
string Application { get; }
string ApplicationUrl { get; }
string Language { get; }
string UserType { get; }
string HelpUrl { get; }
}
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface ILink
{
string Application { get; }
string ApplicationUrl { get; }
string Language { get; }
string UserType { get; }
string HelpUrl { get; }
}
}
@@ -1,7 +1,7 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface ILogType
{
string LogTypeAlias { get; }
}
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface ILogType
{
string LogTypeAlias { get; }
}
}
@@ -1,27 +1,27 @@
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface ILoggingSection : IUmbracoConfigurationSection
{
bool AutoCleanLogs { get; }
bool EnableLogging { get; }
bool EnableAsyncLogging { get; }
int CleaningMiliseconds { get; }
int MaxLogAge { get; }
IEnumerable<ILogType> DisabledLogTypes { get; }
string ExternalLoggerAssembly { get; }
string ExternalLoggerType { get; }
bool ExternalLoggerEnableAuditTrail { get; }
bool ExternalLoggerIsConfigured { get; }
}
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface ILoggingSection : IUmbracoConfigurationSection
{
bool AutoCleanLogs { get; }
bool EnableLogging { get; }
bool EnableAsyncLogging { get; }
int CleaningMiliseconds { get; }
int MaxLogAge { get; }
IEnumerable<ILogType> DisabledLogTypes { get; }
string ExternalLoggerAssembly { get; }
string ExternalLoggerType { get; }
bool ExternalLoggerEnableAuditTrail { get; }
bool ExternalLoggerIsConfigured { get; }
}
}
@@ -1,7 +1,7 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface INotDynamicXmlDocument
{
string Element { get; }
}
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface INotDynamicXmlDocument
{
string Element { get; }
}
}
@@ -1,9 +1,9 @@
using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IProvidersSection : IUmbracoConfigurationSection
{
string DefaultBackOfficeUserProvider { get; }
}
using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IProvidersSection : IUmbracoConfigurationSection
{
string DefaultBackOfficeUserProvider { get; }
}
}
@@ -1,12 +1,12 @@
using System;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IRazorStaticMapping
{
Guid DataTypeGuid { get; }
string NodeTypeAlias { get; }
string PropertyTypeAlias { get; }
string MappingName { get; }
}
using System;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IRazorStaticMapping
{
Guid DataTypeGuid { get; }
string NodeTypeAlias { get; }
string PropertyTypeAlias { get; }
string MappingName { get; }
}
}
@@ -1,10 +1,10 @@
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IRepositoriesSection : IUmbracoConfigurationSection
{
IEnumerable<IRepository> Repositories { get; }
}
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IRepositoriesSection : IUmbracoConfigurationSection
{
IEnumerable<IRepository> Repositories { get; }
}
}
@@ -1,13 +1,13 @@
using System;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IRepository
{
string Name { get; }
Guid Id { get; }
string RepositoryUrl { get; }
string WebServiceUrl { get; }
bool HasCustomWebServiceUrl { get; }
}
using System;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IRepository
{
string Name { get; }
Guid Id { get; }
string RepositoryUrl { get; }
string WebServiceUrl { get; }
bool HasCustomWebServiceUrl { get; }
}
}
@@ -1,15 +1,15 @@
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IRequestHandlerSection : IUmbracoConfigurationSection
{
bool UseDomainPrefixes { get; }
bool AddTrailingSlash { get; }
bool RemoveDoubleDashes { get; }
IEnumerable<IChar> CharCollection { get; }
}
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IRequestHandlerSection : IUmbracoConfigurationSection
{
bool UseDomainPrefixes { get; }
bool AddTrailingSlash { get; }
bool RemoveDoubleDashes { get; }
IEnumerable<IChar> CharCollection { get; }
}
}
@@ -1,13 +1,13 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IScheduledTask
{
string Alias { get; }
bool Log { get; }
int Interval { get; }
string Url { get; }
}
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IScheduledTask
{
string Alias { get; }
bool Log { get; }
int Interval { get; }
string Url { get; }
}
}
@@ -1,9 +1,9 @@
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IScheduledTasksSection : IUmbracoConfigurationSection
{
IEnumerable<IScheduledTask> Tasks { get; }
}
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IScheduledTasksSection : IUmbracoConfigurationSection
{
IEnumerable<IScheduledTask> Tasks { get; }
}
}
@@ -1,11 +1,11 @@
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IScriptingSection : IUmbracoConfigurationSection
{
IEnumerable<INotDynamicXmlDocument> NotDynamicXmlDocumentElements { get; }
IEnumerable<IRazorStaticMapping> DataTypeModelStaticMappings { get; }
}
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IScriptingSection : IUmbracoConfigurationSection
{
IEnumerable<INotDynamicXmlDocument> NotDynamicXmlDocumentElements { get; }
IEnumerable<IRazorStaticMapping> DataTypeModelStaticMappings { get; }
}
}
@@ -1,13 +1,13 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface ISecuritySection : IUmbracoConfigurationSection
{
bool KeepUserLoggedIn { get; }
bool HideDisabledUsersInBackoffice { get; }
string AuthCookieName { get; }
string AuthCookieDomain { get; }
}
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface ISecuritySection : IUmbracoConfigurationSection
{
bool KeepUserLoggedIn { get; }
bool HideDisabledUsersInBackoffice { get; }
string AuthCookieName { get; }
string AuthCookieDomain { get; }
}
}
@@ -1,9 +1,9 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IServer
{
string ForcePortnumber { get; }
string ForceProtocol { get; }
string ServerAddress { get; }
}
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IServer
{
string ForcePortnumber { get; }
string ForceProtocol { get; }
string ServerAddress { get; }
}
}
@@ -1,13 +1,13 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface ITemplatesSection : IUmbracoConfigurationSection
{
bool UseAspNetMasterPages { get; }
bool EnableSkinSupport { get; }
RenderingEngine DefaultRenderingEngine { get; }
bool EnableTemplateFolders { get; }
}
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface ITemplatesSection : IUmbracoConfigurationSection
{
bool UseAspNetMasterPages { get; }
bool EnableSkinSupport { get; }
RenderingEngine DefaultRenderingEngine { get; }
bool EnableTemplateFolders { get; }
}
}
@@ -1,33 +1,33 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IUmbracoSettingsSection : IUmbracoConfigurationSection
{
IContentSection Content { get; }
ISecuritySection Security { get; }
IRequestHandlerSection RequestHandler { get; }
ITemplatesSection Templates { get; }
IDeveloperSection Developer { get; }
IViewStateMoverModuleSection ViewStateMoverModule { get; }
ILoggingSection Logging { get; }
IScheduledTasksSection ScheduledTasks { get; }
IDistributedCallSection DistributedCall { get; }
IRepositoriesSection PackageRepositories { get; }
IProvidersSection Providers { get; }
IHelpSection Help { get; }
IWebRoutingSection WebRouting { get; }
IScriptingSection Scripting { get; }
}
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IUmbracoSettingsSection : IUmbracoConfigurationSection
{
IContentSection Content { get; }
ISecuritySection Security { get; }
IRequestHandlerSection RequestHandler { get; }
ITemplatesSection Templates { get; }
IDeveloperSection Developer { get; }
IViewStateMoverModuleSection ViewStateMoverModule { get; }
ILoggingSection Logging { get; }
IScheduledTasksSection ScheduledTasks { get; }
IDistributedCallSection DistributedCall { get; }
IRepositoriesSection PackageRepositories { get; }
IProvidersSection Providers { get; }
IHelpSection Help { get; }
IWebRoutingSection WebRouting { get; }
IScriptingSection Scripting { get; }
}
}
@@ -1,7 +1,7 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IViewStateMoverModuleSection : IUmbracoConfigurationSection
{
bool Enable { get; }
}
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IViewStateMoverModuleSection : IUmbracoConfigurationSection
{
bool Enable { get; }
}
}
@@ -1,12 +1,12 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IWebRoutingSection : IUmbracoConfigurationSection
{
bool TrySkipIisCustomErrors { get; }
bool InternalRedirectPreservesTemplate { get; }
string UrlProviderMode { get; }
}
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IWebRoutingSection : IUmbracoConfigurationSection
{
bool TrySkipIisCustomErrors { get; }
bool InternalRedirectPreservesTemplate { get; }
string UrlProviderMode { get; }
}
}
@@ -1,37 +1,37 @@
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class ImagingAutoFillPropertiesCollection : ConfigurationElementCollection, IEnumerable<IImagingAutoFillUploadField>
{
protected override ConfigurationElement CreateNewElement()
{
return new ImagingAutoFillUploadFieldElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((ImagingAutoFillUploadFieldElement)element).Alias;
}
internal void Add(ImagingAutoFillUploadFieldElement item)
{
BaseAdd(item);
}
IEnumerator<IImagingAutoFillUploadField> IEnumerable<IImagingAutoFillUploadField>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as IImagingAutoFillUploadField;
}
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class ImagingAutoFillPropertiesCollection : ConfigurationElementCollection, IEnumerable<IImagingAutoFillUploadField>
{
protected override ConfigurationElement CreateNewElement()
{
return new ImagingAutoFillUploadFieldElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((ImagingAutoFillUploadFieldElement)element).Alias;
}
internal void Add(ImagingAutoFillUploadFieldElement item)
{
BaseAdd(item);
}
IEnumerator<IImagingAutoFillUploadField> IEnumerable<IImagingAutoFillUploadField>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as IImagingAutoFillUploadField;
}
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}
@@ -1,91 +1,91 @@
using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class ImagingAutoFillUploadFieldElement : ConfigurationElement, IImagingAutoFillUploadField
{
/// <summary>
/// Allow setting internally so we can create a default
/// </summary>
[ConfigurationProperty("alias", IsKey = true, IsRequired = true)]
public string Alias
{
get { return (string)this["alias"]; }
set { this["alias"] = value; }
}
[ConfigurationProperty("widthFieldAlias")]
internal InnerTextConfigurationElement<string> WidthFieldAlias
{
get
{
return new OptionalInnerTextConfigurationElement<string>(
(InnerTextConfigurationElement<string>)this["widthFieldAlias"],
//set the default
"umbracoWidth");
}
}
[ConfigurationProperty("heightFieldAlias")]
internal InnerTextConfigurationElement<string> HeightFieldAlias
{
get
{
return new OptionalInnerTextConfigurationElement<string>(
(InnerTextConfigurationElement<string>)this["heightFieldAlias"],
//set the default
"umbracoHeight");
}
}
[ConfigurationProperty("lengthFieldAlias")]
internal InnerTextConfigurationElement<string> LengthFieldAlias
{
get
{
return new OptionalInnerTextConfigurationElement<string>(
(InnerTextConfigurationElement<string>)this["lengthFieldAlias"],
//set the default
"umbracoBytes");
}
}
[ConfigurationProperty("extensionFieldAlias")]
internal InnerTextConfigurationElement<string> ExtensionFieldAlias
{
get
{
return new OptionalInnerTextConfigurationElement<string>(
(InnerTextConfigurationElement<string>)this["extensionFieldAlias"],
//set the default
"umbracoExtension");
}
}
string IImagingAutoFillUploadField.Alias
{
get { return Alias; }
}
string IImagingAutoFillUploadField.WidthFieldAlias
{
get { return WidthFieldAlias; }
}
string IImagingAutoFillUploadField.HeightFieldAlias
{
get { return HeightFieldAlias; }
}
string IImagingAutoFillUploadField.LengthFieldAlias
{
get { return LengthFieldAlias; }
}
string IImagingAutoFillUploadField.ExtensionFieldAlias
{
get { return ExtensionFieldAlias; }
}
}
using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class ImagingAutoFillUploadFieldElement : ConfigurationElement, IImagingAutoFillUploadField
{
/// <summary>
/// Allow setting internally so we can create a default
/// </summary>
[ConfigurationProperty("alias", IsKey = true, IsRequired = true)]
public string Alias
{
get { return (string)this["alias"]; }
set { this["alias"] = value; }
}
[ConfigurationProperty("widthFieldAlias")]
internal InnerTextConfigurationElement<string> WidthFieldAlias
{
get
{
return new OptionalInnerTextConfigurationElement<string>(
(InnerTextConfigurationElement<string>)this["widthFieldAlias"],
//set the default
"umbracoWidth");
}
}
[ConfigurationProperty("heightFieldAlias")]
internal InnerTextConfigurationElement<string> HeightFieldAlias
{
get
{
return new OptionalInnerTextConfigurationElement<string>(
(InnerTextConfigurationElement<string>)this["heightFieldAlias"],
//set the default
"umbracoHeight");
}
}
[ConfigurationProperty("lengthFieldAlias")]
internal InnerTextConfigurationElement<string> LengthFieldAlias
{
get
{
return new OptionalInnerTextConfigurationElement<string>(
(InnerTextConfigurationElement<string>)this["lengthFieldAlias"],
//set the default
"umbracoBytes");
}
}
[ConfigurationProperty("extensionFieldAlias")]
internal InnerTextConfigurationElement<string> ExtensionFieldAlias
{
get
{
return new OptionalInnerTextConfigurationElement<string>(
(InnerTextConfigurationElement<string>)this["extensionFieldAlias"],
//set the default
"umbracoExtension");
}
}
string IImagingAutoFillUploadField.Alias
{
get { return Alias; }
}
string IImagingAutoFillUploadField.WidthFieldAlias
{
get { return WidthFieldAlias; }
}
string IImagingAutoFillUploadField.HeightFieldAlias
{
get { return HeightFieldAlias; }
}
string IImagingAutoFillUploadField.LengthFieldAlias
{
get { return LengthFieldAlias; }
}
string IImagingAutoFillUploadField.ExtensionFieldAlias
{
get { return ExtensionFieldAlias; }
}
}
}
@@ -23,7 +23,7 @@ namespace Umbraco.Core.Configuration
/// Gets the version comment (like beta or RC).
/// </summary>
/// <value>The version comment.</value>
public static string CurrentComment { get { return "RC"; } }
public static string CurrentComment { get { return ""; } }
// Get the version of the umbraco.dll by looking at a class in that dll
// Had to do it like this due to medium trust issues, see: http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx
+24 -24
View File
@@ -1,24 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Core
{
public static partial class Constants
{
public static class Examine
{
/// <summary>
/// The alias of the internal member searcher
/// </summary>
public const string InternalMemberSearcher = "InternalMemberSearcher";
/// <summary>
/// The alias of the internal content searcher
/// </summary>
public const string InternalSearcher = "InternalSearcher";
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Core
{
public static partial class Constants
{
public static class Examine
{
/// <summary>
/// The alias of the internal member searcher
/// </summary>
public const string InternalMemberSearcher = "InternalMemberSearcher";
/// <summary>
/// The alias of the internal content searcher
/// </summary>
public const string InternalSearcher = "InternalSearcher";
}
}
}
@@ -186,6 +186,8 @@ namespace Umbraco.Core
/// </summary>
public const string MediaPickerAlias = "Umbraco.MediaPicker";
public const string MultipleMediaPickerAlias = "Umbraco.MultipleMediaPicker";
/// <summary>
/// Guid for the Member Picker datatype.
/// </summary>
@@ -319,9 +321,9 @@ namespace Umbraco.Core
public const string TinyMCEv3 = "5E9B75AE-FACE-41C8-B47E-5F4B0FD82F83";
/// <summary>
/// Alias for the TinyMCE v3 wysiwyg datatype.
/// Alias for the TinyMCE wysiwyg datatype.
/// </summary>
public const string TinyMCEv3Alias = "Umbraco.TinyMCEv3";
public const string TinyMCEAlias = "Umbraco.TinyMCEv3";
/// <summary>
/// Guid for the True/False (Ja/Nej) datatype.
+14 -14
View File
@@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Umbraco.Core
{
/// <summary>
/// Any class implementing this interface that is added to the httpcontext.items keys or values will be disposed of at the end of the request.
/// </summary>
public interface IDisposeOnRequestEnd : IDisposable
{
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Umbraco.Core
{
/// <summary>
/// Any class implementing this interface that is added to the httpcontext.items keys or values will be disposed of at the end of the request.
/// </summary>
public interface IDisposeOnRequestEnd : IDisposable
{
}
}
@@ -1,31 +1,31 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Serialization;
namespace Umbraco.Core.Manifest
{
/// <summary>
/// Used to convert a parameter editor manifest to a property editor object
/// </summary>
internal class ParameterEditorConverter : JsonCreationConverter<ParameterEditor>
{
protected override ParameterEditor Create(Type objectType, JObject jObject)
{
return new ParameterEditor();
}
protected override void Deserialize(JObject jObject, ParameterEditor target, JsonSerializer serializer)
{
//since it's a manifest editor, we need to create it's instance.
//we need to specify the view value for the editor here otherwise we'll get an exception.
target.ManifestDefinedParameterValueEditor = new ParameterValueEditor
{
View = jObject["view"].ToString()
};
base.Deserialize(jObject, target, serializer);
}
}
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Serialization;
namespace Umbraco.Core.Manifest
{
/// <summary>
/// Used to convert a parameter editor manifest to a property editor object
/// </summary>
internal class ParameterEditorConverter : JsonCreationConverter<ParameterEditor>
{
protected override ParameterEditor Create(Type objectType, JObject jObject)
{
return new ParameterEditor();
}
protected override void Deserialize(JObject jObject, ParameterEditor target, JsonSerializer serializer)
{
//since it's a manifest editor, we need to create it's instance.
//we need to specify the view value for the editor here otherwise we'll get an exception.
target.ManifestDefinedParameterValueEditor = new ParameterValueEditor
{
View = jObject["view"].ToString()
};
base.Deserialize(jObject, target, serializer);
}
}
}
+144 -144
View File
@@ -1,144 +1,144 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
namespace Umbraco.Core.Media
{
/// <summary>
/// A helper class used for imaging
/// </summary>
internal static class ImageHelper
{
public static string GetMimeType(this Image image)
{
var format = image.RawFormat;
var codec = ImageCodecInfo.GetImageDecoders().First(c => c.FormatID == format.Guid);
return codec.MimeType;
}
internal static IEnumerable<ResizedImage> GenerateMediaThumbnails(
IFileSystem fs,
string fileName,
string extension,
Image originalImage,
IEnumerable<int> additionalThumbSizes)
{
// Make default thumbnails
var thumbs = new List<ResizedImage>
{
Resize(fs, fileName, extension, 100, "thumb", originalImage),
Resize(fs, fileName, extension, 500, "big-thumb", originalImage)
};
//make custom ones
foreach (var thumb in additionalThumbSizes.Where(x => x > 0).Distinct())
{
thumbs.Add(Resize(fs, fileName, extension, thumb, string.Format("thumb_{0}", thumb), originalImage));
}
return thumbs;
}
private static ResizedImage Resize(IFileSystem fileSystem, string path, string extension, int maxWidthHeight, string fileNameAddition, Image originalImage)
{
var fileNameThumb = String.IsNullOrEmpty(fileNameAddition)
? string.Format("{0}_UMBRACOSYSTHUMBNAIL.jpg", path.Substring(0, path.LastIndexOf(".")))
: string.Format("{0}_{1}.jpg", path.Substring(0, path.LastIndexOf(".")), fileNameAddition);
var thumb = GenerateThumbnail(
originalImage,
maxWidthHeight,
fileNameThumb,
extension,
fileSystem);
return thumb;
}
internal static ResizedImage GenerateThumbnail(Image image, int maxWidthHeight, string thumbnailFileName, string extension, IFileSystem fs)
{
return GenerateThumbnail(image, maxWidthHeight, -1, -1, thumbnailFileName, extension, fs);
}
internal static ResizedImage GenerateThumbnail(Image image, int fixedWidth, int fixedHeight, string thumbnailFileName, string extension, IFileSystem fs)
{
return GenerateThumbnail(image, -1, fixedWidth, fixedHeight, thumbnailFileName, extension, fs);
}
private static ResizedImage GenerateThumbnail(Image image, int maxWidthHeight, int fixedWidth, int fixedHeight, string thumbnailFileName, string extension, IFileSystem fs)
{
// Generate thumbnail
float f = 1;
if (maxWidthHeight >= 0)
{
var fx = (float)image.Size.Width / maxWidthHeight;
var fy = (float)image.Size.Height / maxWidthHeight;
// must fit in thumbnail size
f = Math.Max(fx, fy);
}
//depending on if we are doing fixed width resizing or not.
fixedWidth = (maxWidthHeight > 0) ? image.Width : fixedWidth;
fixedHeight = (maxWidthHeight > 0) ? image.Height : fixedHeight;
var widthTh = (int)Math.Round(fixedWidth / f);
var heightTh = (int)Math.Round(fixedHeight / f);
// fixes for empty width or height
if (widthTh == 0)
widthTh = 1;
if (heightTh == 0)
heightTh = 1;
// Create new image with best quality settings
using (var bp = new Bitmap(widthTh, heightTh))
{
using (var g = Graphics.FromImage(bp))
{
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.CompositingQuality = CompositingQuality.HighQuality;
// Copy the old image to the new and resized
var rect = new Rectangle(0, 0, widthTh, heightTh);
g.DrawImage(image, rect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);
// Copy metadata
var imageEncoders = ImageCodecInfo.GetImageEncoders();
var codec = extension.ToLower() == "png" || extension.ToLower() == "gif"
? imageEncoders.Single(t => t.MimeType.Equals("image/png"))
: imageEncoders.Single(t => t.MimeType.Equals("image/jpeg"));
// Set compresion ratio to 90%
var ep = new EncoderParameters();
ep.Param[0] = new EncoderParameter(Encoder.Quality, 90L);
// Save the new image using the dimensions of the image
var newFileName = thumbnailFileName.Replace("UMBRACOSYSTHUMBNAIL", string.Format("{0}x{1}", widthTh, heightTh));
using (var ms = new MemoryStream())
{
bp.Save(ms, codec, ep);
ms.Seek(0, 0);
fs.AddFile(newFileName, ms);
}
return new ResizedImage(widthTh, heightTh, newFileName);
}
}
}
}
}
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
namespace Umbraco.Core.Media
{
/// <summary>
/// A helper class used for imaging
/// </summary>
internal static class ImageHelper
{
public static string GetMimeType(this Image image)
{
var format = image.RawFormat;
var codec = ImageCodecInfo.GetImageDecoders().First(c => c.FormatID == format.Guid);
return codec.MimeType;
}
internal static IEnumerable<ResizedImage> GenerateMediaThumbnails(
IFileSystem fs,
string fileName,
string extension,
Image originalImage,
IEnumerable<int> additionalThumbSizes)
{
// Make default thumbnails
var thumbs = new List<ResizedImage>
{
Resize(fs, fileName, extension, 100, "thumb", originalImage),
Resize(fs, fileName, extension, 500, "big-thumb", originalImage)
};
//make custom ones
foreach (var thumb in additionalThumbSizes.Where(x => x > 0).Distinct())
{
thumbs.Add(Resize(fs, fileName, extension, thumb, string.Format("thumb_{0}", thumb), originalImage));
}
return thumbs;
}
private static ResizedImage Resize(IFileSystem fileSystem, string path, string extension, int maxWidthHeight, string fileNameAddition, Image originalImage)
{
var fileNameThumb = String.IsNullOrEmpty(fileNameAddition)
? string.Format("{0}_UMBRACOSYSTHUMBNAIL.jpg", path.Substring(0, path.LastIndexOf(".")))
: string.Format("{0}_{1}.jpg", path.Substring(0, path.LastIndexOf(".")), fileNameAddition);
var thumb = GenerateThumbnail(
originalImage,
maxWidthHeight,
fileNameThumb,
extension,
fileSystem);
return thumb;
}
internal static ResizedImage GenerateThumbnail(Image image, int maxWidthHeight, string thumbnailFileName, string extension, IFileSystem fs)
{
return GenerateThumbnail(image, maxWidthHeight, -1, -1, thumbnailFileName, extension, fs);
}
internal static ResizedImage GenerateThumbnail(Image image, int fixedWidth, int fixedHeight, string thumbnailFileName, string extension, IFileSystem fs)
{
return GenerateThumbnail(image, -1, fixedWidth, fixedHeight, thumbnailFileName, extension, fs);
}
private static ResizedImage GenerateThumbnail(Image image, int maxWidthHeight, int fixedWidth, int fixedHeight, string thumbnailFileName, string extension, IFileSystem fs)
{
// Generate thumbnail
float f = 1;
if (maxWidthHeight >= 0)
{
var fx = (float)image.Size.Width / maxWidthHeight;
var fy = (float)image.Size.Height / maxWidthHeight;
// must fit in thumbnail size
f = Math.Max(fx, fy);
}
//depending on if we are doing fixed width resizing or not.
fixedWidth = (maxWidthHeight > 0) ? image.Width : fixedWidth;
fixedHeight = (maxWidthHeight > 0) ? image.Height : fixedHeight;
var widthTh = (int)Math.Round(fixedWidth / f);
var heightTh = (int)Math.Round(fixedHeight / f);
// fixes for empty width or height
if (widthTh == 0)
widthTh = 1;
if (heightTh == 0)
heightTh = 1;
// Create new image with best quality settings
using (var bp = new Bitmap(widthTh, heightTh))
{
using (var g = Graphics.FromImage(bp))
{
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.CompositingQuality = CompositingQuality.HighQuality;
// Copy the old image to the new and resized
var rect = new Rectangle(0, 0, widthTh, heightTh);
g.DrawImage(image, rect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);
// Copy metadata
var imageEncoders = ImageCodecInfo.GetImageEncoders();
var codec = extension.ToLower() == "png" || extension.ToLower() == "gif"
? imageEncoders.Single(t => t.MimeType.Equals("image/png"))
: imageEncoders.Single(t => t.MimeType.Equals("image/jpeg"));
// Set compresion ratio to 90%
var ep = new EncoderParameters();
ep.Param[0] = new EncoderParameter(Encoder.Quality, 90L);
// Save the new image using the dimensions of the image
var newFileName = thumbnailFileName.Replace("UMBRACOSYSTHUMBNAIL", string.Format("{0}x{1}", widthTh, heightTh));
using (var ms = new MemoryStream())
{
bp.Save(ms, codec, ep);
ms.Seek(0, 0);
fs.AddFile(newFileName, ms);
}
return new ResizedImage(widthTh, heightTh, newFileName);
}
}
}
}
}
+92 -92
View File
@@ -1,93 +1,93 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Models
{
/// <summary>
/// Defines a Macro
/// </summary>
public interface IMacro : IAggregateRoot
{
/// <summary>
/// Gets or sets the alias of the Macro
/// </summary>
[DataMember]
string Alias { get; set; }
/// <summary>
/// Gets or sets the name of the Macro
/// </summary>
[DataMember]
string Name { get; set; }
/// <summary>
/// Gets or sets a boolean indicating whether the Macro can be used in an Editor
/// </summary>
[DataMember]
bool UseInEditor { get; set; }
/// <summary>
/// Gets or sets the Cache Duration for the Macro
/// </summary>
[DataMember]
int CacheDuration { get; set; }
/// <summary>
/// Gets or sets a boolean indicating whether the Macro should be Cached by Page
/// </summary>
[DataMember]
bool CacheByPage { get; set; }
/// <summary>
/// Gets or sets a boolean indicating whether the Macro should be Cached Personally
/// </summary>
[DataMember]
bool CacheByMember { get; set; }
/// <summary>
/// Gets or sets a boolean indicating whether the Macro should be rendered in an Editor
/// </summary>
[DataMember]
bool DontRender { get; set; }
/// <summary>
/// Gets or sets the path to user control or the Control Type to render
/// </summary>
[DataMember]
string ControlType { get; set; }
/// <summary>
/// Gets or sets the name of the assembly, which should be used by the Macro
/// </summary>
/// <remarks>Will usually only be filled if the ScriptFile is a Usercontrol</remarks>
[DataMember]
string ControlAssembly { get; set; }
/// <summary>
/// Gets or set the path to the Python file in use
/// </summary>
/// <remarks>Optional: Can only be one of three Script, Python or Xslt</remarks>
[DataMember]
string ScriptPath { get; set; }
/// <summary>
/// Gets or sets the path to the Xslt file in use
/// </summary>
/// <remarks>Optional: Can only be one of three Script, Python or Xslt</remarks>
[DataMember]
string XsltPath { get; set; }
/// <summary>
/// Gets or sets a list of Macro Properties
/// </summary>
[DataMember]
MacroPropertyCollection Properties { get; }
///// <summary>
///// Returns an enum <see cref="MacroTypes"/> based on the properties on the Macro
///// </summary>
///// <returns><see cref="MacroTypes"/></returns>
//MacroTypes MacroType();
}
using System.Collections.Generic;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Models
{
/// <summary>
/// Defines a Macro
/// </summary>
public interface IMacro : IAggregateRoot
{
/// <summary>
/// Gets or sets the alias of the Macro
/// </summary>
[DataMember]
string Alias { get; set; }
/// <summary>
/// Gets or sets the name of the Macro
/// </summary>
[DataMember]
string Name { get; set; }
/// <summary>
/// Gets or sets a boolean indicating whether the Macro can be used in an Editor
/// </summary>
[DataMember]
bool UseInEditor { get; set; }
/// <summary>
/// Gets or sets the Cache Duration for the Macro
/// </summary>
[DataMember]
int CacheDuration { get; set; }
/// <summary>
/// Gets or sets a boolean indicating whether the Macro should be Cached by Page
/// </summary>
[DataMember]
bool CacheByPage { get; set; }
/// <summary>
/// Gets or sets a boolean indicating whether the Macro should be Cached Personally
/// </summary>
[DataMember]
bool CacheByMember { get; set; }
/// <summary>
/// Gets or sets a boolean indicating whether the Macro should be rendered in an Editor
/// </summary>
[DataMember]
bool DontRender { get; set; }
/// <summary>
/// Gets or sets the path to user control or the Control Type to render
/// </summary>
[DataMember]
string ControlType { get; set; }
/// <summary>
/// Gets or sets the name of the assembly, which should be used by the Macro
/// </summary>
/// <remarks>Will usually only be filled if the ScriptFile is a Usercontrol</remarks>
[DataMember]
string ControlAssembly { get; set; }
/// <summary>
/// Gets or set the path to the Python file in use
/// </summary>
/// <remarks>Optional: Can only be one of three Script, Python or Xslt</remarks>
[DataMember]
string ScriptPath { get; set; }
/// <summary>
/// Gets or sets the path to the Xslt file in use
/// </summary>
/// <remarks>Optional: Can only be one of three Script, Python or Xslt</remarks>
[DataMember]
string XsltPath { get; set; }
/// <summary>
/// Gets or sets a list of Macro Properties
/// </summary>
[DataMember]
MacroPropertyCollection Properties { get; }
///// <summary>
///// Returns an enum <see cref="MacroTypes"/> based on the properties on the Macro
///// </summary>
///// <returns><see cref="MacroTypes"/></returns>
//MacroTypes MacroType();
}
}
+37 -37
View File
@@ -1,38 +1,38 @@
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Models
{
/// <summary>
/// Defines a Property for a Macro
/// </summary>
public interface IMacroProperty : IValueObject
{
[DataMember]
int Id { get; set; }
/// <summary>
/// Gets or sets the Alias of the Property
/// </summary>
[DataMember]
string Alias { get; set; }
/// <summary>
/// Gets or sets the Name of the Property
/// </summary>
[DataMember]
string Name { get; set; }
/// <summary>
/// Gets or sets the Sort Order of the Property
/// </summary>
[DataMember]
int SortOrder { get; set; }
/// <summary>
/// Gets or sets the parameter editor alias
/// </summary>
[DataMember]
string EditorAlias { get; set; }
}
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Models
{
/// <summary>
/// Defines a Property for a Macro
/// </summary>
public interface IMacroProperty : IValueObject
{
[DataMember]
int Id { get; set; }
/// <summary>
/// Gets or sets the Alias of the Property
/// </summary>
[DataMember]
string Alias { get; set; }
/// <summary>
/// Gets or sets the Name of the Property
/// </summary>
[DataMember]
string Name { get; set; }
/// <summary>
/// Gets or sets the Sort Order of the Property
/// </summary>
[DataMember]
int SortOrder { get; set; }
/// <summary>
/// Gets or sets the parameter editor alias
/// </summary>
[DataMember]
string EditorAlias { get; set; }
}
}
+27 -27
View File
@@ -1,28 +1,28 @@
namespace Umbraco.Core.Models
{
/// <summary>
/// Defines a PropertyType (plugin) for a Macro
/// </summary>
internal interface IMacroPropertyType
{
/// <summary>
/// Gets the unique Alias of the Property Type
/// </summary>
string Alias { get; }
/// <summary>
/// Gets the name of the Assembly used to render the Property Type
/// </summary>
string RenderingAssembly { get; }
/// <summary>
/// Gets the name of the Type used to render the Property Type
/// </summary>
string RenderingType { get; }
/// <summary>
/// Gets the Base Type for storing the PropertyType (Int32, String, Boolean)
/// </summary>
MacroPropertyTypeBaseTypes BaseType { get; }
}
namespace Umbraco.Core.Models
{
/// <summary>
/// Defines a PropertyType (plugin) for a Macro
/// </summary>
internal interface IMacroPropertyType
{
/// <summary>
/// Gets the unique Alias of the Property Type
/// </summary>
string Alias { get; }
/// <summary>
/// Gets the name of the Assembly used to render the Property Type
/// </summary>
string RenderingAssembly { get; }
/// <summary>
/// Gets the name of the Type used to render the Property Type
/// </summary>
string RenderingType { get; }
/// <summary>
/// Gets the Base Type for storing the PropertyType (Int32, String, Boolean)
/// </summary>
MacroPropertyTypeBaseTypes BaseType { get; }
}
}
+113 -113
View File
@@ -1,114 +1,114 @@
using System;
namespace Umbraco.Core.Models
{
public interface IMember : IContentBase
{
/// <summary>
/// Gets or sets the Username
/// </summary>
string Username { get; set; }
/// <summary>
/// Gets or sets the Email
/// </summary>
string Email { get; set; }
/// <summary>
/// Gets or sets the Password
/// </summary>
string Password { get; set; }
/// <summary>
/// Gets or sets the Password Question
/// </summary>
/// <remarks>
/// Alias: umbracoPasswordRetrievalQuestionPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
string PasswordQuestion { get; set; }
/// <summary>
/// Gets or sets the Password Answer
/// </summary>
/// <remarks>
/// Alias: umbracoPasswordRetrievalAnswerPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
string PasswordAnswer { get; set; }
/// <summary>
/// Gets or set the comments for the member
/// </summary>
/// <remarks>
/// Alias: umbracoCommentPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
string Comments { get; set; }
/// <summary>
/// Gets or sets a boolean indicating whether the Member is approved
/// </summary>
/// <remarks>
/// Alias: umbracoApprovePropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
bool IsApproved { get; set; }
/// <summary>
/// Gets or sets a boolean indicating whether the Member is locked out
/// </summary>
/// <remarks>
/// Alias: umbracoLockPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
bool IsLockedOut { get; set; }
/// <summary>
/// Gets or sets the date for last login
/// </summary>
/// <remarks>
/// Alias: umbracoLastLoginPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
DateTime LastLoginDate { get; set; }
/// <summary>
/// Gest or sets the date for last password change
/// </summary>
/// <remarks>
/// Alias: umbracoMemberLastPasswordChange
/// Part of the standard properties collection.
/// </remarks>
DateTime LastPasswordChangeDate { get; set; }
/// <summary>
/// Gets or sets the date for when Member was locked out
/// </summary>
/// <remarks>
/// Alias: umbracoMemberLastLockout
/// Part of the standard properties collection.
/// </remarks>
DateTime LastLockoutDate { get; set; }
/// <summary>
/// Gets or sets the number of failed password attempts.
/// This is the number of times the password was entered incorrectly upon login.
/// </summary>
/// <remarks>
/// Alias: umbracoFailedPasswordAttemptsPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
int FailedPasswordAttempts { get; set; }
/// <summary>
/// String alias of the default ContentType
/// </summary>
string ContentTypeAlias { get; }
/// <summary>
/// Gets the ContentType used by this content object
/// </summary>
IMemberType ContentType { get; }
}
using System;
namespace Umbraco.Core.Models
{
public interface IMember : IContentBase
{
/// <summary>
/// Gets or sets the Username
/// </summary>
string Username { get; set; }
/// <summary>
/// Gets or sets the Email
/// </summary>
string Email { get; set; }
/// <summary>
/// Gets or sets the Password
/// </summary>
string Password { get; set; }
/// <summary>
/// Gets or sets the Password Question
/// </summary>
/// <remarks>
/// Alias: umbracoPasswordRetrievalQuestionPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
string PasswordQuestion { get; set; }
/// <summary>
/// Gets or sets the Password Answer
/// </summary>
/// <remarks>
/// Alias: umbracoPasswordRetrievalAnswerPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
string PasswordAnswer { get; set; }
/// <summary>
/// Gets or set the comments for the member
/// </summary>
/// <remarks>
/// Alias: umbracoCommentPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
string Comments { get; set; }
/// <summary>
/// Gets or sets a boolean indicating whether the Member is approved
/// </summary>
/// <remarks>
/// Alias: umbracoApprovePropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
bool IsApproved { get; set; }
/// <summary>
/// Gets or sets a boolean indicating whether the Member is locked out
/// </summary>
/// <remarks>
/// Alias: umbracoLockPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
bool IsLockedOut { get; set; }
/// <summary>
/// Gets or sets the date for last login
/// </summary>
/// <remarks>
/// Alias: umbracoLastLoginPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
DateTime LastLoginDate { get; set; }
/// <summary>
/// Gest or sets the date for last password change
/// </summary>
/// <remarks>
/// Alias: umbracoMemberLastPasswordChange
/// Part of the standard properties collection.
/// </remarks>
DateTime LastPasswordChangeDate { get; set; }
/// <summary>
/// Gets or sets the date for when Member was locked out
/// </summary>
/// <remarks>
/// Alias: umbracoMemberLastLockout
/// Part of the standard properties collection.
/// </remarks>
DateTime LastLockoutDate { get; set; }
/// <summary>
/// Gets or sets the number of failed password attempts.
/// This is the number of times the password was entered incorrectly upon login.
/// </summary>
/// <remarks>
/// Alias: umbracoFailedPasswordAttemptsPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
int FailedPasswordAttempts { get; set; }
/// <summary>
/// String alias of the default ContentType
/// </summary>
string ContentTypeAlias { get; }
/// <summary>
/// Gets the ContentType used by this content object
/// </summary>
IMemberType ContentType { get; }
}
}
+35 -35
View File
@@ -1,36 +1,36 @@
namespace Umbraco.Core.Models
{
/// <summary>
/// Defines a MemberType, which Member is based on
/// </summary>
public interface IMemberType : IContentTypeComposition
{
/// <summary>
/// Gets a boolean indicating whether a Property is editable by the Member.
/// </summary>
/// <param name="propertyTypeAlias">PropertyType Alias of the Property to check</param>
/// <returns></returns>
bool MemberCanEditProperty(string propertyTypeAlias);
/// <summary>
/// Gets a boolean indicating whether a Property is visible on the Members profile.
/// </summary>
/// <param name="propertyTypeAlias">PropertyType Alias of the Property to check</param>
/// <returns></returns>
bool MemberCanViewProperty(string propertyTypeAlias);
/// <summary>
/// Sets a boolean indicating whether a Property is editable by the Member.
/// </summary>
/// <param name="propertyTypeAlias">PropertyType Alias of the Property to set</param>
/// <param name="value">Boolean value, true or false</param>
void SetMemberCanEditProperty(string propertyTypeAlias, bool value);
/// <summary>
/// Sets a boolean indicating whether a Property is visible on the Members profile.
/// </summary>
/// <param name="propertyTypeAlias">PropertyType Alias of the Property to set</param>
/// <param name="value">Boolean value, true or false</param>
void SetMemberCanViewProperty(string propertyTypeAlias, bool value);
}
namespace Umbraco.Core.Models
{
/// <summary>
/// Defines a MemberType, which Member is based on
/// </summary>
public interface IMemberType : IContentTypeComposition
{
/// <summary>
/// Gets a boolean indicating whether a Property is editable by the Member.
/// </summary>
/// <param name="propertyTypeAlias">PropertyType Alias of the Property to check</param>
/// <returns></returns>
bool MemberCanEditProperty(string propertyTypeAlias);
/// <summary>
/// Gets a boolean indicating whether a Property is visible on the Members profile.
/// </summary>
/// <param name="propertyTypeAlias">PropertyType Alias of the Property to check</param>
/// <returns></returns>
bool MemberCanViewProperty(string propertyTypeAlias);
/// <summary>
/// Sets a boolean indicating whether a Property is editable by the Member.
/// </summary>
/// <param name="propertyTypeAlias">PropertyType Alias of the Property to set</param>
/// <param name="value">Boolean value, true or false</param>
void SetMemberCanEditProperty(string propertyTypeAlias, bool value);
/// <summary>
/// Sets a boolean indicating whether a Property is visible on the Members profile.
/// </summary>
/// <param name="propertyTypeAlias">PropertyType Alias of the Property to set</param>
/// <param name="value">Boolean value, true or false</param>
void SetMemberCanViewProperty(string propertyTypeAlias, bool value);
}
}
+59 -59
View File
@@ -1,60 +1,60 @@
namespace Umbraco.Core.Models
{
/// <summary>
/// Represents a property of an <c>IPublishedContent</c>.
/// </summary>
public interface IPublishedProperty
{
/// <summary>
/// Gets the alias of the property.
/// </summary>
string PropertyTypeAlias { get; }
/// <summary>
/// Gets a value indicating whether the property has a value.
/// </summary>
/// <remarks>
/// <para>This is somewhat implementation-dependent -- depending on whatever IPublishedCache considers
/// a missing value.</para>
/// <para>The XmlPublishedCache raw values are strings, and it will consider missing, null or empty (and
/// that includes whitespace-only) strings as "no value".</para>
/// <para>Other caches that get their raw value from the database would consider that a property has "no
/// value" if it is missing, null, or an empty string (including whitespace-only).</para>
/// </remarks>
bool HasValue { get; }
/// <summary>
/// Gets the data value of the property.
/// </summary>
/// <remarks>
/// <para>The data value is whatever was passed to the property when it was instanciated, and it is
/// somewhat implementation-dependent -- depending on how the IPublishedCache is implemented.</para>
/// <para>The XmlPublishedCache raw values are strings exclusively since they come from the Xml cache.</para>
/// <para>For other caches that get their raw value from the database, it would be either a string,
/// an integer (Int32), or a date and time (DateTime).</para>
/// <para>If you're using that value, you're probably wrong, unless you're doing some internal
/// Umbraco stuff.</para>
/// </remarks>
object DataValue { get; }
/// <summary>
/// Gets the object value of the property.
/// </summary>
/// <remarks>
/// <para>The value is what you want to use when rendering content in an MVC view ie in C#.</para>
/// <para>It can be null, or any type of CLR object.</para>
/// <para>It has been fully prepared and processed by the appropriate converter.</para>
/// </remarks>
object Value { get; }
/// <summary>
/// Gets the XPath value of the property.
/// </summary>
/// <remarks>
/// <para>The XPath value is what you want to use when navigating content via XPath eg in the XSLT engine.</para>
/// <para>It must be either null, or a string, or an XPathNavigator.</para>
/// <para>It has been fully prepared and processed by the appropriate converter.</para>
/// </remarks>
object XPathValue { get; }
}
namespace Umbraco.Core.Models
{
/// <summary>
/// Represents a property of an <c>IPublishedContent</c>.
/// </summary>
public interface IPublishedProperty
{
/// <summary>
/// Gets the alias of the property.
/// </summary>
string PropertyTypeAlias { get; }
/// <summary>
/// Gets a value indicating whether the property has a value.
/// </summary>
/// <remarks>
/// <para>This is somewhat implementation-dependent -- depending on whatever IPublishedCache considers
/// a missing value.</para>
/// <para>The XmlPublishedCache raw values are strings, and it will consider missing, null or empty (and
/// that includes whitespace-only) strings as "no value".</para>
/// <para>Other caches that get their raw value from the database would consider that a property has "no
/// value" if it is missing, null, or an empty string (including whitespace-only).</para>
/// </remarks>
bool HasValue { get; }
/// <summary>
/// Gets the data value of the property.
/// </summary>
/// <remarks>
/// <para>The data value is whatever was passed to the property when it was instanciated, and it is
/// somewhat implementation-dependent -- depending on how the IPublishedCache is implemented.</para>
/// <para>The XmlPublishedCache raw values are strings exclusively since they come from the Xml cache.</para>
/// <para>For other caches that get their raw value from the database, it would be either a string,
/// an integer (Int32), or a date and time (DateTime).</para>
/// <para>If you're using that value, you're probably wrong, unless you're doing some internal
/// Umbraco stuff.</para>
/// </remarks>
object DataValue { get; }
/// <summary>
/// Gets the object value of the property.
/// </summary>
/// <remarks>
/// <para>The value is what you want to use when rendering content in an MVC view ie in C#.</para>
/// <para>It can be null, or any type of CLR object.</para>
/// <para>It has been fully prepared and processed by the appropriate converter.</para>
/// </remarks>
object Value { get; }
/// <summary>
/// Gets the XPath value of the property.
/// </summary>
/// <remarks>
/// <para>The XPath value is what you want to use when navigating content via XPath eg in the XSLT engine.</para>
/// <para>It must be either null, or a string, or an XPathNavigator.</para>
/// <para>It has been fully prepared and processed by the appropriate converter.</para>
/// </remarks>
object XPathValue { get; }
}
}
+37 -37
View File
@@ -1,38 +1,38 @@
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Models
{
public interface IRelation : IAggregateRoot
{
/// <summary>
/// Gets or sets the Parent Id of the Relation (Source)
/// </summary>
[DataMember]
int ParentId { get; set; }
/// <summary>
/// Gets or sets the Child Id of the Relation (Destination)
/// </summary>
[DataMember]
int ChildId { get; set; }
/// <summary>
/// Gets or sets the <see cref="RelationType"/> for the Relation
/// </summary>
[DataMember]
IRelationType RelationType { get; set; }
/// <summary>
/// Gets or sets a comment for the Relation
/// </summary>
[DataMember]
string Comment { get; set; }
/// <summary>
/// Gets the Id of the <see cref="RelationType"/> that this Relation is based on.
/// </summary>
[IgnoreDataMember]
int RelationTypeId { get; }
}
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Models
{
public interface IRelation : IAggregateRoot
{
/// <summary>
/// Gets or sets the Parent Id of the Relation (Source)
/// </summary>
[DataMember]
int ParentId { get; set; }
/// <summary>
/// Gets or sets the Child Id of the Relation (Destination)
/// </summary>
[DataMember]
int ChildId { get; set; }
/// <summary>
/// Gets or sets the <see cref="RelationType"/> for the Relation
/// </summary>
[DataMember]
IRelationType RelationType { get; set; }
/// <summary>
/// Gets or sets a comment for the Relation
/// </summary>
[DataMember]
string Comment { get; set; }
/// <summary>
/// Gets the Id of the <see cref="RelationType"/> that this Relation is based on.
/// </summary>
[IgnoreDataMember]
int RelationTypeId { get; }
}
}
+40 -40
View File
@@ -1,41 +1,41 @@
using System;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Models
{
public interface IRelationType : IAggregateRoot
{
/// <summary>
/// Gets or sets the Name of the RelationType
/// </summary>
[DataMember]
string Name { get; set; }
/// <summary>
/// Gets or sets the Alias of the RelationType
/// </summary>
[DataMember]
string Alias { get; set; }
/// <summary>
/// Gets or sets a boolean indicating whether the RelationType is Bidirectional (true) or Parent to Child (false)
/// </summary>
[DataMember]
bool IsBidirectional { get; set; }
/// <summary>
/// Gets or sets the Parents object type id
/// </summary>
/// <remarks>Corresponds to the NodeObjectType in the umbracoNode table</remarks>
[DataMember]
Guid ParentObjectType { get; set; }
/// <summary>
/// Gets or sets the Childs object type id
/// </summary>
/// <remarks>Corresponds to the NodeObjectType in the umbracoNode table</remarks>
[DataMember]
Guid ChildObjectType { get; set; }
}
using System;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Models
{
public interface IRelationType : IAggregateRoot
{
/// <summary>
/// Gets or sets the Name of the RelationType
/// </summary>
[DataMember]
string Name { get; set; }
/// <summary>
/// Gets or sets the Alias of the RelationType
/// </summary>
[DataMember]
string Alias { get; set; }
/// <summary>
/// Gets or sets a boolean indicating whether the RelationType is Bidirectional (true) or Parent to Child (false)
/// </summary>
[DataMember]
bool IsBidirectional { get; set; }
/// <summary>
/// Gets or sets the Parents object type id
/// </summary>
/// <remarks>Corresponds to the NodeObjectType in the umbracoNode table</remarks>
[DataMember]
Guid ParentObjectType { get; set; }
/// <summary>
/// Gets or sets the Childs object type id
/// </summary>
/// <remarks>Corresponds to the NodeObjectType in the umbracoNode table</remarks>
[DataMember]
Guid ChildObjectType { get; set; }
}
}
+16 -16
View File
@@ -1,17 +1,17 @@
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Models
{
public interface ITag : IAggregateRoot
{
[DataMember]
string Text { get; set; }
[DataMember]
string Group { get; set; }
//TODO: enable this at some stage
//int ParentId { get; set; }
}
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Models
{
public interface ITag : IAggregateRoot
{
[DataMember]
string Text { get; set; }
[DataMember]
string Group { get; set; }
//TODO: enable this at some stage
//int ParentId { get; set; }
}
}
+402 -402
View File
@@ -1,403 +1,403 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using Umbraco.Core.IO;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Models
{
/// <summary>
/// Represents a Macro
/// </summary>
[Serializable]
[DataContract(IsReference = true)]
internal class Macro : Entity, IMacro
{
public Macro()
{
_properties = new MacroPropertyCollection();
_properties.CollectionChanged += PropertiesChanged;
_addedProperties = new List<string>();
_removedProperties = new List<string>();
}
/// <summary>
/// Creates an item with pre-filled properties
/// </summary>
/// <param name="id"></param>
/// <param name="useInEditor"></param>
/// <param name="cacheDuration"></param>
/// <param name="alias"></param>
/// <param name="name"></param>
/// <param name="controlType"></param>
/// <param name="controlAssembly"></param>
/// <param name="xsltPath"></param>
/// <param name="cacheByPage"></param>
/// <param name="cacheByMember"></param>
/// <param name="dontRender"></param>
/// <param name="scriptPath"></param>
public Macro(int id, bool useInEditor, int cacheDuration, string @alias, string name, string controlType, string controlAssembly, string xsltPath, bool cacheByPage, bool cacheByMember, bool dontRender, string scriptPath)
: this()
{
Id = id;
UseInEditor = useInEditor;
CacheDuration = cacheDuration;
Alias = alias;
Name = name;
ControlType = controlType;
ControlAssembly = controlAssembly;
XsltPath = xsltPath;
CacheByPage = cacheByPage;
CacheByMember = cacheByMember;
DontRender = dontRender;
ScriptPath = scriptPath;
}
/// <summary>
/// Creates an instance for persisting a new item
/// </summary>
/// <param name="useInEditor"></param>
/// <param name="cacheDuration"></param>
/// <param name="alias"></param>
/// <param name="name"></param>
/// <param name="controlType"></param>
/// <param name="controlAssembly"></param>
/// <param name="xsltPath"></param>
/// <param name="cacheByPage"></param>
/// <param name="cacheByMember"></param>
/// <param name="dontRender"></param>
/// <param name="scriptPath"></param>
public Macro(string @alias, string name,
string controlType = "",
string controlAssembly = "",
string xsltPath = "",
string scriptPath = "",
bool cacheByPage = false,
bool cacheByMember = false,
bool dontRender = true,
bool useInEditor = false,
int cacheDuration = 0)
: this()
{
UseInEditor = useInEditor;
CacheDuration = cacheDuration;
Alias = alias;
Name = name;
ControlType = controlType;
ControlAssembly = controlAssembly;
XsltPath = xsltPath;
CacheByPage = cacheByPage;
CacheByMember = cacheByMember;
DontRender = dontRender;
ScriptPath = scriptPath;
}
private string _alias;
private string _name;
private bool _useInEditor;
private int _cacheDuration;
private bool _cacheByPage;
private bool _cacheByMember;
private bool _dontRender;
private string _scriptFile;
private string _scriptAssembly;
private string _python;
private string _xslt;
private readonly MacroPropertyCollection _properties;
private readonly List<string> _addedProperties;
private readonly List<string> _removedProperties;
private static readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.Alias);
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.Name);
private static readonly PropertyInfo UseInEditorSelector = ExpressionHelper.GetPropertyInfo<Macro, bool>(x => x.UseInEditor);
private static readonly PropertyInfo CacheDurationSelector = ExpressionHelper.GetPropertyInfo<Macro, int>(x => x.CacheDuration);
private static readonly PropertyInfo CacheByPageSelector = ExpressionHelper.GetPropertyInfo<Macro, bool>(x => x.CacheByPage);
private static readonly PropertyInfo CacheByMemberSelector = ExpressionHelper.GetPropertyInfo<Macro, bool>(x => x.CacheByMember);
private static readonly PropertyInfo DontRenderSelector = ExpressionHelper.GetPropertyInfo<Macro, bool>(x => x.DontRender);
private static readonly PropertyInfo ControlPathSelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.ControlType);
private static readonly PropertyInfo ControlAssemblySelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.ControlAssembly);
private static readonly PropertyInfo ScriptPathSelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.ScriptPath);
private static readonly PropertyInfo XsltPathSelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.XsltPath);
private static readonly PropertyInfo PropertiesSelector = ExpressionHelper.GetPropertyInfo<Macro, MacroPropertyCollection>(x => x.Properties);
void PropertiesChanged(object sender, NotifyCollectionChangedEventArgs e)
{
OnPropertyChanged(PropertiesSelector);
if (e.Action == NotifyCollectionChangedAction.Add)
{
//listen for changes
var prop = e.NewItems.Cast<MacroProperty>().First();
prop.PropertyChanged += PropertyDataChanged;
var alias = prop.Alias;
//remove from the removed/added props (since people could add/remove all they want in one request)
_removedProperties.RemoveAll(s => s == alias);
_addedProperties.RemoveAll(s => s == alias);
//add to the added props
_addedProperties.Add(alias);
}
else if (e.Action == NotifyCollectionChangedAction.Remove)
{
//remove listening for changes
var prop = e.OldItems.Cast<MacroProperty>().First();
prop.PropertyChanged -= PropertyDataChanged;
var alias = prop.Alias;
//remove from the removed/added props (since people could add/remove all they want in one request)
_removedProperties.RemoveAll(s => s == alias);
_addedProperties.RemoveAll(s => s == alias);
//add to the added props
_removedProperties.Add(alias);
}
}
/// <summary>
/// When some data of a property has changed ensure our Properties flag is dirty
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void PropertyDataChanged(object sender, PropertyChangedEventArgs e)
{
OnPropertyChanged(PropertiesSelector);
}
public override void ResetDirtyProperties(bool rememberPreviouslyChangedProperties)
{
_addedProperties.Clear();
_removedProperties.Clear();
base.ResetDirtyProperties(rememberPreviouslyChangedProperties);
foreach (var prop in Properties)
{
((TracksChangesEntityBase)prop).ResetDirtyProperties(rememberPreviouslyChangedProperties);
}
}
/// <summary>
/// Used internally to check if we need to add a section in the repository to the db
/// </summary>
internal IEnumerable<string> AddedProperties
{
get { return _addedProperties; }
}
/// <summary>
/// Used internally to check if we need to remove a section in the repository to the db
/// </summary>
internal IEnumerable<string> RemovedProperties
{
get { return _removedProperties; }
}
/// <summary>
/// Gets or sets the alias of the Macro
/// </summary>
[DataMember]
public string Alias
{
get { return _alias; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_alias = value;
return _alias;
}, _alias, AliasSelector);
}
}
/// <summary>
/// Gets or sets the name of the Macro
/// </summary>
[DataMember]
public string Name
{
get { return _name; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_name = value;
return _name;
}, _name, NameSelector);
}
}
/// <summary>
/// Gets or sets a boolean indicating whether the Macro can be used in an Editor
/// </summary>
[DataMember]
public bool UseInEditor
{
get { return _useInEditor; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_useInEditor = value;
return _useInEditor;
}, _useInEditor, UseInEditorSelector);
}
}
/// <summary>
/// Gets or sets the Cache Duration for the Macro
/// </summary>
[DataMember]
public int CacheDuration
{
get { return _cacheDuration; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_cacheDuration = value;
return _cacheDuration;
}, _cacheDuration, CacheDurationSelector);
}
}
/// <summary>
/// Gets or sets a boolean indicating whether the Macro should be Cached by Page
/// </summary>
[DataMember]
public bool CacheByPage
{
get { return _cacheByPage; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_cacheByPage = value;
return _cacheByPage;
}, _cacheByPage, CacheByPageSelector);
}
}
/// <summary>
/// Gets or sets a boolean indicating whether the Macro should be Cached Personally
/// </summary>
[DataMember]
public bool CacheByMember
{
get { return _cacheByMember; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_cacheByMember = value;
return _cacheByMember;
}, _cacheByMember, CacheByMemberSelector);
}
}
/// <summary>
/// Gets or sets a boolean indicating whether the Macro should be rendered in an Editor
/// </summary>
[DataMember]
public bool DontRender
{
get { return _dontRender; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_dontRender = value;
return _dontRender;
}, _dontRender, DontRenderSelector);
}
}
/// <summary>
/// Gets or sets the path to user control or the Control Type to render
/// </summary>
[DataMember]
public string ControlType
{
get { return _scriptFile; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_scriptFile = value;
return _scriptFile;
}, _scriptFile, ControlPathSelector);
}
}
/// <summary>
/// Gets or sets the name of the assembly, which should be used by the Macro
/// </summary>
/// <remarks>Will usually only be filled if the ControlType is a Usercontrol</remarks>
[DataMember]
public string ControlAssembly
{
get { return _scriptAssembly; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_scriptAssembly = value;
return _scriptAssembly;
}, _scriptAssembly, ControlAssemblySelector);
}
}
/// <summary>
/// Gets or set the path to the Python file in use
/// </summary>
/// <remarks>Optional: Can only be one of three Script, Python or Xslt</remarks>
[DataMember]
public string ScriptPath
{
get { return _python; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_python = value;
return _python;
}, _python, ScriptPathSelector);
}
}
/// <summary>
/// Gets or sets the path to the Xslt file in use
/// </summary>
/// <remarks>Optional: Can only be one of three Script, Python or Xslt</remarks>
[DataMember]
public string XsltPath
{
get { return _xslt; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_xslt = value;
return _xslt;
}, _xslt, XsltPathSelector);
}
}
/// <summary>
/// Gets or sets a list of Macro Properties
/// </summary>
[DataMember]
public MacroPropertyCollection Properties
{
get { return _properties; }
}
}
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using Umbraco.Core.IO;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Models
{
/// <summary>
/// Represents a Macro
/// </summary>
[Serializable]
[DataContract(IsReference = true)]
internal class Macro : Entity, IMacro
{
public Macro()
{
_properties = new MacroPropertyCollection();
_properties.CollectionChanged += PropertiesChanged;
_addedProperties = new List<string>();
_removedProperties = new List<string>();
}
/// <summary>
/// Creates an item with pre-filled properties
/// </summary>
/// <param name="id"></param>
/// <param name="useInEditor"></param>
/// <param name="cacheDuration"></param>
/// <param name="alias"></param>
/// <param name="name"></param>
/// <param name="controlType"></param>
/// <param name="controlAssembly"></param>
/// <param name="xsltPath"></param>
/// <param name="cacheByPage"></param>
/// <param name="cacheByMember"></param>
/// <param name="dontRender"></param>
/// <param name="scriptPath"></param>
public Macro(int id, bool useInEditor, int cacheDuration, string @alias, string name, string controlType, string controlAssembly, string xsltPath, bool cacheByPage, bool cacheByMember, bool dontRender, string scriptPath)
: this()
{
Id = id;
UseInEditor = useInEditor;
CacheDuration = cacheDuration;
Alias = alias;
Name = name;
ControlType = controlType;
ControlAssembly = controlAssembly;
XsltPath = xsltPath;
CacheByPage = cacheByPage;
CacheByMember = cacheByMember;
DontRender = dontRender;
ScriptPath = scriptPath;
}
/// <summary>
/// Creates an instance for persisting a new item
/// </summary>
/// <param name="useInEditor"></param>
/// <param name="cacheDuration"></param>
/// <param name="alias"></param>
/// <param name="name"></param>
/// <param name="controlType"></param>
/// <param name="controlAssembly"></param>
/// <param name="xsltPath"></param>
/// <param name="cacheByPage"></param>
/// <param name="cacheByMember"></param>
/// <param name="dontRender"></param>
/// <param name="scriptPath"></param>
public Macro(string @alias, string name,
string controlType = "",
string controlAssembly = "",
string xsltPath = "",
string scriptPath = "",
bool cacheByPage = false,
bool cacheByMember = false,
bool dontRender = true,
bool useInEditor = false,
int cacheDuration = 0)
: this()
{
UseInEditor = useInEditor;
CacheDuration = cacheDuration;
Alias = alias;
Name = name;
ControlType = controlType;
ControlAssembly = controlAssembly;
XsltPath = xsltPath;
CacheByPage = cacheByPage;
CacheByMember = cacheByMember;
DontRender = dontRender;
ScriptPath = scriptPath;
}
private string _alias;
private string _name;
private bool _useInEditor;
private int _cacheDuration;
private bool _cacheByPage;
private bool _cacheByMember;
private bool _dontRender;
private string _scriptFile;
private string _scriptAssembly;
private string _python;
private string _xslt;
private readonly MacroPropertyCollection _properties;
private readonly List<string> _addedProperties;
private readonly List<string> _removedProperties;
private static readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.Alias);
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.Name);
private static readonly PropertyInfo UseInEditorSelector = ExpressionHelper.GetPropertyInfo<Macro, bool>(x => x.UseInEditor);
private static readonly PropertyInfo CacheDurationSelector = ExpressionHelper.GetPropertyInfo<Macro, int>(x => x.CacheDuration);
private static readonly PropertyInfo CacheByPageSelector = ExpressionHelper.GetPropertyInfo<Macro, bool>(x => x.CacheByPage);
private static readonly PropertyInfo CacheByMemberSelector = ExpressionHelper.GetPropertyInfo<Macro, bool>(x => x.CacheByMember);
private static readonly PropertyInfo DontRenderSelector = ExpressionHelper.GetPropertyInfo<Macro, bool>(x => x.DontRender);
private static readonly PropertyInfo ControlPathSelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.ControlType);
private static readonly PropertyInfo ControlAssemblySelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.ControlAssembly);
private static readonly PropertyInfo ScriptPathSelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.ScriptPath);
private static readonly PropertyInfo XsltPathSelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.XsltPath);
private static readonly PropertyInfo PropertiesSelector = ExpressionHelper.GetPropertyInfo<Macro, MacroPropertyCollection>(x => x.Properties);
void PropertiesChanged(object sender, NotifyCollectionChangedEventArgs e)
{
OnPropertyChanged(PropertiesSelector);
if (e.Action == NotifyCollectionChangedAction.Add)
{
//listen for changes
var prop = e.NewItems.Cast<MacroProperty>().First();
prop.PropertyChanged += PropertyDataChanged;
var alias = prop.Alias;
//remove from the removed/added props (since people could add/remove all they want in one request)
_removedProperties.RemoveAll(s => s == alias);
_addedProperties.RemoveAll(s => s == alias);
//add to the added props
_addedProperties.Add(alias);
}
else if (e.Action == NotifyCollectionChangedAction.Remove)
{
//remove listening for changes
var prop = e.OldItems.Cast<MacroProperty>().First();
prop.PropertyChanged -= PropertyDataChanged;
var alias = prop.Alias;
//remove from the removed/added props (since people could add/remove all they want in one request)
_removedProperties.RemoveAll(s => s == alias);
_addedProperties.RemoveAll(s => s == alias);
//add to the added props
_removedProperties.Add(alias);
}
}
/// <summary>
/// When some data of a property has changed ensure our Properties flag is dirty
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void PropertyDataChanged(object sender, PropertyChangedEventArgs e)
{
OnPropertyChanged(PropertiesSelector);
}
public override void ResetDirtyProperties(bool rememberPreviouslyChangedProperties)
{
_addedProperties.Clear();
_removedProperties.Clear();
base.ResetDirtyProperties(rememberPreviouslyChangedProperties);
foreach (var prop in Properties)
{
((TracksChangesEntityBase)prop).ResetDirtyProperties(rememberPreviouslyChangedProperties);
}
}
/// <summary>
/// Used internally to check if we need to add a section in the repository to the db
/// </summary>
internal IEnumerable<string> AddedProperties
{
get { return _addedProperties; }
}
/// <summary>
/// Used internally to check if we need to remove a section in the repository to the db
/// </summary>
internal IEnumerable<string> RemovedProperties
{
get { return _removedProperties; }
}
/// <summary>
/// Gets or sets the alias of the Macro
/// </summary>
[DataMember]
public string Alias
{
get { return _alias; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_alias = value;
return _alias;
}, _alias, AliasSelector);
}
}
/// <summary>
/// Gets or sets the name of the Macro
/// </summary>
[DataMember]
public string Name
{
get { return _name; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_name = value;
return _name;
}, _name, NameSelector);
}
}
/// <summary>
/// Gets or sets a boolean indicating whether the Macro can be used in an Editor
/// </summary>
[DataMember]
public bool UseInEditor
{
get { return _useInEditor; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_useInEditor = value;
return _useInEditor;
}, _useInEditor, UseInEditorSelector);
}
}
/// <summary>
/// Gets or sets the Cache Duration for the Macro
/// </summary>
[DataMember]
public int CacheDuration
{
get { return _cacheDuration; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_cacheDuration = value;
return _cacheDuration;
}, _cacheDuration, CacheDurationSelector);
}
}
/// <summary>
/// Gets or sets a boolean indicating whether the Macro should be Cached by Page
/// </summary>
[DataMember]
public bool CacheByPage
{
get { return _cacheByPage; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_cacheByPage = value;
return _cacheByPage;
}, _cacheByPage, CacheByPageSelector);
}
}
/// <summary>
/// Gets or sets a boolean indicating whether the Macro should be Cached Personally
/// </summary>
[DataMember]
public bool CacheByMember
{
get { return _cacheByMember; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_cacheByMember = value;
return _cacheByMember;
}, _cacheByMember, CacheByMemberSelector);
}
}
/// <summary>
/// Gets or sets a boolean indicating whether the Macro should be rendered in an Editor
/// </summary>
[DataMember]
public bool DontRender
{
get { return _dontRender; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_dontRender = value;
return _dontRender;
}, _dontRender, DontRenderSelector);
}
}
/// <summary>
/// Gets or sets the path to user control or the Control Type to render
/// </summary>
[DataMember]
public string ControlType
{
get { return _scriptFile; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_scriptFile = value;
return _scriptFile;
}, _scriptFile, ControlPathSelector);
}
}
/// <summary>
/// Gets or sets the name of the assembly, which should be used by the Macro
/// </summary>
/// <remarks>Will usually only be filled if the ControlType is a Usercontrol</remarks>
[DataMember]
public string ControlAssembly
{
get { return _scriptAssembly; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_scriptAssembly = value;
return _scriptAssembly;
}, _scriptAssembly, ControlAssemblySelector);
}
}
/// <summary>
/// Gets or set the path to the Python file in use
/// </summary>
/// <remarks>Optional: Can only be one of three Script, Python or Xslt</remarks>
[DataMember]
public string ScriptPath
{
get { return _python; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_python = value;
return _python;
}, _python, ScriptPathSelector);
}
}
/// <summary>
/// Gets or sets the path to the Xslt file in use
/// </summary>
/// <remarks>Optional: Can only be one of three Script, Python or Xslt</remarks>
[DataMember]
public string XsltPath
{
get { return _xslt; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_xslt = value;
return _xslt;
}, _xslt, XsltPathSelector);
}
}
/// <summary>
/// Gets or sets a list of Macro Properties
/// </summary>
[DataMember]
public MacroPropertyCollection Properties
{
get { return _properties; }
}
}
}
+180 -153
View File
@@ -1,154 +1,181 @@
using System;
using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Models
{
/// <summary>
/// Represents a Macro Property
/// </summary>
[Serializable]
[DataContract(IsReference = true)]
internal class MacroProperty : TracksChangesEntityBase, IMacroProperty, IRememberBeingDirty
{
public MacroProperty()
{
}
/// <summary>
/// Ctor for creating a new property
/// </summary>
/// <param name="alias"></param>
/// <param name="name"></param>
/// <param name="sortOrder"></param>
/// <param name="editorAlias"></param>
public MacroProperty(string @alias, string name, int sortOrder, string editorAlias)
{
_alias = alias;
_name = name;
_sortOrder = sortOrder;
_editorAlias = editorAlias;
}
/// <summary>
/// Ctor for creating an existing property
/// </summary>
/// <param name="id"></param>
/// <param name="alias"></param>
/// <param name="name"></param>
/// <param name="sortOrder"></param>
/// <param name="editorAlias"></param>
internal MacroProperty(int id, string @alias, string name, int sortOrder, string editorAlias)
{
_id = id;
_alias = alias;
_name = name;
_sortOrder = sortOrder;
_editorAlias = editorAlias;
}
private string _alias;
private string _name;
private int _sortOrder;
private int _id;
private string _editorAlias;
private static readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo<MacroProperty, string>(x => x.Alias);
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<MacroProperty, string>(x => x.Name);
private static readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo<MacroProperty, int>(x => x.SortOrder);
private static readonly PropertyInfo IdSelector = ExpressionHelper.GetPropertyInfo<Entity, int>(x => x.Id);
private static readonly PropertyInfo PropertyTypeSelector = ExpressionHelper.GetPropertyInfo<MacroProperty, string>(x => x.EditorAlias);
/// <summary>
/// Gets or sets the Alias of the Property
/// </summary>
[DataMember]
public int Id
{
get { return _id; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_id = value;
return _alias;
}, _alias, IdSelector);
}
}
/// <summary>
/// Gets or sets the Alias of the Property
/// </summary>
[DataMember]
public string Alias
{
get { return _alias; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_alias = value;
return _alias;
}, _alias, AliasSelector);
}
}
/// <summary>
/// Gets or sets the Name of the Property
/// </summary>
[DataMember]
public string Name
{
get { return _name; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_name = value;
return _name;
}, _name, NameSelector);
}
}
/// <summary>
/// Gets or sets the Sort Order of the Property
/// </summary>
[DataMember]
public int SortOrder
{
get { return _sortOrder; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_sortOrder = value;
return _sortOrder;
}, _sortOrder, SortOrderSelector);
}
}
/// <summary>
/// Gets or sets the Type for this Property
/// </summary>
/// <remarks>
/// The MacroPropertyTypes acts as a plugin for Macros.
/// All types was previously contained in the database, but has been ported to code.
/// </remarks>
[DataMember]
public string EditorAlias
{
get { return _editorAlias; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_editorAlias = value;
return _editorAlias;
}, _editorAlias, PropertyTypeSelector);
}
}
}
using System;
using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Core.Models
{
/// <summary>
/// Represents a Macro Property
/// </summary>
[Serializable]
[DataContract(IsReference = true)]
internal class MacroProperty : TracksChangesEntityBase, IMacroProperty, IRememberBeingDirty
{
public MacroProperty()
{
}
/// <summary>
/// Ctor for creating a new property
/// </summary>
/// <param name="alias"></param>
/// <param name="name"></param>
/// <param name="sortOrder"></param>
/// <param name="editorAlias"></param>
public MacroProperty(string @alias, string name, int sortOrder, string editorAlias)
{
_alias = alias;
_name = name;
_sortOrder = sortOrder;
//try to get the new mapped parameter editor
var mapped = LegacyParameterEditorAliasConverter.GetNewAliasFromLegacyAlias(editorAlias, false);
if (mapped.IsNullOrWhiteSpace() == false)
{
editorAlias = mapped;
}
_editorAlias = editorAlias;
}
/// <summary>
/// Ctor for creating an existing property
/// </summary>
/// <param name="id"></param>
/// <param name="alias"></param>
/// <param name="name"></param>
/// <param name="sortOrder"></param>
/// <param name="editorAlias"></param>
internal MacroProperty(int id, string @alias, string name, int sortOrder, string editorAlias)
{
_id = id;
_alias = alias;
_name = name;
_sortOrder = sortOrder;
//try to get the new mapped parameter editor
var mapped = LegacyParameterEditorAliasConverter.GetNewAliasFromLegacyAlias(editorAlias, false);
if (mapped.IsNullOrWhiteSpace() == false)
{
editorAlias = mapped;
}
_editorAlias = editorAlias;
}
private string _alias;
private string _name;
private int _sortOrder;
private int _id;
private string _editorAlias;
private static readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo<MacroProperty, string>(x => x.Alias);
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<MacroProperty, string>(x => x.Name);
private static readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo<MacroProperty, int>(x => x.SortOrder);
private static readonly PropertyInfo IdSelector = ExpressionHelper.GetPropertyInfo<Entity, int>(x => x.Id);
private static readonly PropertyInfo PropertyTypeSelector = ExpressionHelper.GetPropertyInfo<MacroProperty, string>(x => x.EditorAlias);
/// <summary>
/// Gets or sets the Alias of the Property
/// </summary>
[DataMember]
public int Id
{
get { return _id; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_id = value;
return _alias;
}, _alias, IdSelector);
}
}
/// <summary>
/// Gets or sets the Alias of the Property
/// </summary>
[DataMember]
public string Alias
{
get { return _alias; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_alias = value;
return _alias;
}, _alias, AliasSelector);
}
}
/// <summary>
/// Gets or sets the Name of the Property
/// </summary>
[DataMember]
public string Name
{
get { return _name; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_name = value;
return _name;
}, _name, NameSelector);
}
}
/// <summary>
/// Gets or sets the Sort Order of the Property
/// </summary>
[DataMember]
public int SortOrder
{
get { return _sortOrder; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_sortOrder = value;
return _sortOrder;
}, _sortOrder, SortOrderSelector);
}
}
/// <summary>
/// Gets or sets the Type for this Property
/// </summary>
/// <remarks>
/// The MacroPropertyTypes acts as a plugin for Macros.
/// All types was previously contained in the database, but has been ported to code.
/// </remarks>
[DataMember]
public string EditorAlias
{
get { return _editorAlias; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
//try to get the new mapped parameter editor
var mapped = LegacyParameterEditorAliasConverter.GetNewAliasFromLegacyAlias(value, false);
if (mapped.IsNullOrWhiteSpace() == false)
{
_editorAlias = mapped;
}
else
{
_editorAlias = value;
}
return _editorAlias;
}, _editorAlias, PropertyTypeSelector);
}
}
}
}
@@ -1,20 +1,20 @@
using System;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Linq;
namespace Umbraco.Core.Models
{
/// <summary>
/// A macro's property collection
/// </summary>
public class MacroPropertyCollection : ObservableDictionary<string, IMacroProperty>
{
public MacroPropertyCollection()
: base(property => property.Alias)
{
}
}
using System;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Linq;
namespace Umbraco.Core.Models
{
/// <summary>
/// A macro's property collection
/// </summary>
public class MacroPropertyCollection : ObservableDictionary<string, IMacroProperty>
{
public MacroPropertyCollection()
: base(property => property.Alias)
{
}
}
}
@@ -1,20 +1,20 @@
using System;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models
{
/// <summary>
/// Enum for the three allowed BaseTypes
/// </summary>
[Serializable]
[DataContract(IsReference = true)]
internal enum MacroPropertyTypeBaseTypes
{
[EnumMember]
Int32,
[EnumMember]
Boolean,
[EnumMember]
String
}
using System;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models
{
/// <summary>
/// Enum for the three allowed BaseTypes
/// </summary>
[Serializable]
[DataContract(IsReference = true)]
internal enum MacroPropertyTypeBaseTypes
{
[EnumMember]
Int32,
[EnumMember]
Boolean,
[EnumMember]
String
}
}
+27 -27
View File
@@ -1,28 +1,28 @@
using System;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models
{
/// <summary>
/// Enum for the various types of Macros
/// </summary>
[Serializable]
[DataContract(IsReference = true)]
internal enum MacroTypes
{
[EnumMember]
Xslt = 1,
[EnumMember]
CustomControl = 2,
[EnumMember]
UserControl = 3,
[EnumMember]
Unknown = 4,
[EnumMember]
Python = 5,
[EnumMember]
Script = 6,
[EnumMember]
PartialView = 7
}
using System;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models
{
/// <summary>
/// Enum for the various types of Macros
/// </summary>
[Serializable]
[DataContract(IsReference = true)]
internal enum MacroTypes
{
[EnumMember]
Xslt = 1,
[EnumMember]
CustomControl = 2,
[EnumMember]
UserControl = 3,
[EnumMember]
Unknown = 4,
[EnumMember]
Python = 5,
[EnumMember]
Script = 6,
[EnumMember]
PartialView = 7
}
}
+463 -453
View File
@@ -1,454 +1,464 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models
{
/// <summary>
/// Represents a Member object
/// </summary>
[Serializable]
[DataContract(IsReference = true)]
public class Member : ContentBase, IMember
{
private readonly IMemberType _contentType;
private string _contentTypeAlias;
private string _username;
private string _email;
private string _password;
private object _providerUserKey;
private Type _userTypeKey;
/// <summary>
/// Constructor for creating a Member object
/// </summary>
/// <param name="name">Name of the content</param>
/// <param name="contentType">ContentType for the current Content object</param>
public Member(string name, IMemberType contentType)
: base(name, -1, contentType, new PropertyCollection())
{
_contentType = contentType;
}
public Member(string name, string email, string username, string password, int parentId, IMemberType contentType)
: base(name, parentId, contentType, new PropertyCollection())
{
Mandate.ParameterNotNull(contentType, "contentType");
_contentType = contentType;
_email = email;
_username = username;
_password = password;
}
public Member(string name, string email, string username, string password, IContentBase parent, IMemberType contentType)
: base(name, parent, contentType, new PropertyCollection())
{
Mandate.ParameterNotNull(contentType, "contentType");
_contentType = contentType;
_email = email;
_username = username;
_password = password;
}
private static readonly PropertyInfo DefaultContentTypeAliasSelector = ExpressionHelper.GetPropertyInfo<Member, string>(x => x.ContentTypeAlias);
private static readonly PropertyInfo UsernameSelector = ExpressionHelper.GetPropertyInfo<Member, string>(x => x.Username);
private static readonly PropertyInfo EmailSelector = ExpressionHelper.GetPropertyInfo<Member, string>(x => x.Email);
private static readonly PropertyInfo PasswordSelector = ExpressionHelper.GetPropertyInfo<Member, string>(x => x.Password);
private static readonly PropertyInfo ProviderUserKeySelector = ExpressionHelper.GetPropertyInfo<Member, object>(x => x.ProviderUserKey);
private static readonly PropertyInfo UserTypeKeySelector = ExpressionHelper.GetPropertyInfo<Member, Type>(x => x.ProviderUserKeyType);
/// <summary>
/// Gets or sets the Username
/// </summary>
[DataMember]
public string Username
{
get { return _username; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_username = value;
return _username;
}, _username, UsernameSelector);
}
}
/// <summary>
/// Gets or sets the Email
/// </summary>
[DataMember]
public string Email
{
get { return _email; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_email = value;
return _email;
}, _email, EmailSelector);
}
}
/// <summary>
/// Gets or sets the Password
/// </summary>
[DataMember]
public string Password
{
get { return _password; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_password = value;
return _password;
}, _password, PasswordSelector);
}
}
/// <summary>
/// Gets or sets the Groups that Member is part of
/// </summary>
[DataMember]
public IEnumerable<string> Groups { get; set; }
/// <summary>
/// Gets or sets the Password Question
/// </summary>
/// <remarks>
/// Alias: umbracoPasswordRetrievalQuestionPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
[IgnoreDataMember]
public string PasswordQuestion
{
get
{
return Properties[Constants.Conventions.Member.PasswordQuestion].Value == null
? string.Empty
: Properties[Constants.Conventions.Member.PasswordQuestion].Value.ToString();
}
set
{
Properties[Constants.Conventions.Member.PasswordQuestion].Value = value;
}
}
/// <summary>
/// Gets or sets the Password Answer
/// </summary>
/// <remarks>
/// Alias: umbracoPasswordRetrievalAnswerPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
[IgnoreDataMember]
public string PasswordAnswer
{
get
{
return Properties[Constants.Conventions.Member.PasswordAnswer].Value == null
? string.Empty
: Properties[Constants.Conventions.Member.PasswordAnswer].Value.ToString();
}
set
{
Properties[Constants.Conventions.Member.PasswordAnswer].Value = value;
}
}
/// <summary>
/// Gets or set the comments for the member
/// </summary>
/// <remarks>
/// Alias: umbracoCommentPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
[IgnoreDataMember]
public string Comments
{
get
{
return Properties[Constants.Conventions.Member.Comments].Value == null
? string.Empty
: Properties[Constants.Conventions.Member.Comments].Value.ToString();
}
set
{
Properties[Constants.Conventions.Member.Comments].Value = value;
}
}
/// <summary>
/// Gets or sets a boolean indicating whether the Member is approved
/// </summary>
/// <remarks>
/// Alias: umbracoApprovePropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
[IgnoreDataMember]
public bool IsApproved
{
get
{
if (Properties[Constants.Conventions.Member.IsApproved].Value == null)
return default(bool);
if (Properties[Constants.Conventions.Member.IsApproved].Value is bool)
return (bool)Properties[Constants.Conventions.Member.IsApproved].Value;
return (bool)Convert.ChangeType(Properties[Constants.Conventions.Member.IsApproved].Value, typeof(bool));
}
set
{
Properties[Constants.Conventions.Member.IsApproved].Value = value;
}
}
/// <summary>
/// Gets or sets a boolean indicating whether the Member is locked out
/// </summary>
/// <remarks>
/// Alias: umbracoLockPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
[IgnoreDataMember]
public bool IsLockedOut
{
get
{
if (Properties[Constants.Conventions.Member.IsLockedOut].Value == null)
return default(bool);
if (Properties[Constants.Conventions.Member.IsLockedOut].Value is bool)
return (bool)Properties[Constants.Conventions.Member.IsLockedOut].Value;
return (bool)Convert.ChangeType(Properties[Constants.Conventions.Member.IsLockedOut].Value, typeof(bool));
}
set
{
Properties[Constants.Conventions.Member.IsLockedOut].Value = value;
}
}
/// <summary>
/// Gets or sets the date for last login
/// </summary>
/// <remarks>
/// Alias: umbracoLastLoginPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
[IgnoreDataMember]
public DateTime LastLoginDate
{
get
{
if (Properties[Constants.Conventions.Member.LastLoginDate].Value == null)
return default(DateTime);
if (Properties[Constants.Conventions.Member.LastLoginDate].Value is DateTime)
return (DateTime)Properties[Constants.Conventions.Member.LastLoginDate].Value;
return (DateTime)Convert.ChangeType(Properties[Constants.Conventions.Member.LastLoginDate].Value, typeof(DateTime));
}
set
{
Properties[Constants.Conventions.Member.LastLoginDate].Value = value;
}
}
/// <summary>
/// Gest or sets the date for last password change
/// </summary>
/// <remarks>
/// Alias: umbracoMemberLastPasswordChange
/// Part of the standard properties collection.
/// </remarks>
[IgnoreDataMember]
public DateTime LastPasswordChangeDate
{
get
{
if (Properties[Constants.Conventions.Member.LastPasswordChangeDate].Value == null)
return default(DateTime);
if (Properties[Constants.Conventions.Member.LastPasswordChangeDate].Value is DateTime)
return (DateTime)Properties[Constants.Conventions.Member.LastPasswordChangeDate].Value;
return (DateTime)Convert.ChangeType(Properties[Constants.Conventions.Member.LastPasswordChangeDate].Value, typeof(DateTime));
}
set
{
Properties[Constants.Conventions.Member.LastPasswordChangeDate].Value = value;
}
}
/// <summary>
/// Gets or sets the date for when Member was locked out
/// </summary>
/// <remarks>
/// Alias: umbracoMemberLastLockout
/// Part of the standard properties collection.
/// </remarks>
[IgnoreDataMember]
public DateTime LastLockoutDate
{
get
{
if (Properties[Constants.Conventions.Member.LastLockoutDate].Value == null)
return default(DateTime);
if (Properties[Constants.Conventions.Member.LastLockoutDate].Value is DateTime)
return (DateTime)Properties[Constants.Conventions.Member.LastLockoutDate].Value;
return (DateTime)Convert.ChangeType(Properties[Constants.Conventions.Member.LastLockoutDate].Value, typeof(DateTime));
}
set
{
Properties[Constants.Conventions.Member.LastLockoutDate].Value = value;
}
}
/// <summary>
/// Gets or sets the number of failed password attempts.
/// This is the number of times the password was entered incorrectly upon login.
/// </summary>
/// <remarks>
/// Alias: umbracoFailedPasswordAttemptsPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
[IgnoreDataMember]
public int FailedPasswordAttempts
{
get
{
if (Properties[Constants.Conventions.Member.FailedPasswordAttempts].Value == null)
return default(int);
if (Properties[Constants.Conventions.Member.FailedPasswordAttempts].Value is int)
return (int)Properties[Constants.Conventions.Member.FailedPasswordAttempts].Value;
return (int)Convert.ChangeType(Properties[Constants.Conventions.Member.FailedPasswordAttempts].Value, typeof(int));
}
set
{
Properties[Constants.Conventions.Member.LastLockoutDate].Value = value;
}
}
/// <summary>
/// String alias of the default ContentType
/// </summary>
[DataMember]
public virtual string ContentTypeAlias
{
get { return _contentTypeAlias; }
internal set
{
SetPropertyValueAndDetectChanges(o =>
{
_contentTypeAlias = value;
return _contentTypeAlias;
}, _contentTypeAlias, DefaultContentTypeAliasSelector);
}
}
/// <summary>
/// User key from the Provider.
/// </summary>
/// <remarks>
/// When using standard umbraco provider this key will
/// correspond to the guid UniqueId/Key.
/// Otherwise it will the one available from the asp.net
/// membership provider.
/// </remarks>
[DataMember]
internal virtual object ProviderUserKey
{
get
{
return _providerUserKey;
}
set
{
SetPropertyValueAndDetectChanges(o =>
{
_providerUserKey = value;
return _providerUserKey;
}, _providerUserKey, ProviderUserKeySelector);
}
}
/// <summary>
/// Gets or sets the type of the provider user key.
/// </summary>
/// <value>
/// The type of the provider user key.
/// </value>
[IgnoreDataMember]
internal Type ProviderUserKeyType
{
get
{
return _userTypeKey;
}
private set
{
SetPropertyValueAndDetectChanges(o =>
{
_userTypeKey = value;
return _userTypeKey;
}, _userTypeKey, UserTypeKeySelector);
}
}
/// <summary>
/// Sets the type of the provider user key.
/// </summary>
/// <param name="type">The type.</param>
internal void SetProviderUserKeyType(Type type)
{
ProviderUserKeyType = type;
}
/// <summary>
/// Method to call when Entity is being saved
/// </summary>
/// <remarks>Created date is set and a Unique key is assigned</remarks>
internal override void AddingEntity()
{
base.AddingEntity();
if (Key == Guid.Empty)
Key = Guid.NewGuid();
}
/// <summary>
/// Gets the ContentType used by this content object
/// </summary>
[IgnoreDataMember]
public IMemberType ContentType
{
get { return _contentType; }
}
public override void ChangeTrashedState(bool isTrashed, int parentId = -20)
{
throw new NotSupportedException("Members can't be trashed as no Recycle Bin exists, so use of this method is invalid");
}
/* Internal experiment - only used for mapping queries.
* Adding these to have first level properties instead of the Properties collection.
*/
internal string LongStringPropertyValue { get; set; }
internal string ShortStringPropertyValue { get; set; }
internal int IntegerropertyValue { get; set; }
internal bool BoolPropertyValue { get; set; }
internal DateTime DateTimePropertyValue { get; set; }
internal string PropertyTypeAlias { get; set; }
}
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models
{
/// <summary>
/// Represents a Member object
/// </summary>
[Serializable]
[DataContract(IsReference = true)]
public class Member : ContentBase, IMember
{
private readonly IMemberType _contentType;
private string _contentTypeAlias;
private string _username;
private string _email;
private string _password;
private object _providerUserKey;
private Type _userTypeKey;
/// <summary>
/// Constructor for creating a Member object
/// </summary>
/// <param name="name">Name of the content</param>
/// <param name="contentType">ContentType for the current Content object</param>
public Member(string name, IMemberType contentType)
: base(name, -1, contentType, new PropertyCollection())
{
_contentType = contentType;
}
public Member(string name, string email, string username, string password, int parentId, IMemberType contentType)
: base(name, parentId, contentType, new PropertyCollection())
{
Mandate.ParameterNotNull(contentType, "contentType");
_contentType = contentType;
_email = email;
_username = username;
_password = password;
}
public Member(string name, string email, string username, string password, IContentBase parent, IMemberType contentType)
: base(name, parent, contentType, new PropertyCollection())
{
Mandate.ParameterNotNull(contentType, "contentType");
_contentType = contentType;
_email = email;
_username = username;
_password = password;
}
private static readonly PropertyInfo DefaultContentTypeAliasSelector = ExpressionHelper.GetPropertyInfo<Member, string>(x => x.ContentTypeAlias);
private static readonly PropertyInfo UsernameSelector = ExpressionHelper.GetPropertyInfo<Member, string>(x => x.Username);
private static readonly PropertyInfo EmailSelector = ExpressionHelper.GetPropertyInfo<Member, string>(x => x.Email);
private static readonly PropertyInfo PasswordSelector = ExpressionHelper.GetPropertyInfo<Member, string>(x => x.Password);
private static readonly PropertyInfo ProviderUserKeySelector = ExpressionHelper.GetPropertyInfo<Member, object>(x => x.ProviderUserKey);
private static readonly PropertyInfo UserTypeKeySelector = ExpressionHelper.GetPropertyInfo<Member, Type>(x => x.ProviderUserKeyType);
/// <summary>
/// Gets or sets the Username
/// </summary>
[DataMember]
public string Username
{
get { return _username; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_username = value;
return _username;
}, _username, UsernameSelector);
}
}
/// <summary>
/// Gets or sets the Email
/// </summary>
[DataMember]
public string Email
{
get { return _email; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_email = value;
return _email;
}, _email, EmailSelector);
}
}
/// <summary>
/// Gets or sets the Password
/// </summary>
[DataMember]
public string Password
{
get { return _password; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_password = value;
return _password;
}, _password, PasswordSelector);
}
}
/// <summary>
/// Gets or sets the Groups that Member is part of
/// </summary>
[DataMember]
public IEnumerable<string> Groups { get; set; }
//TODO: When get/setting all of these properties we MUST:
// * Check if we are using the umbraco membership provider, if so then we need to use the configured fields - not the explicit fields below
// * If any of the fields don't exist, what should we do? Currently it will throw an exception!
/// <summary>
/// Gets or sets the Password Question
/// </summary>
/// <remarks>
/// Alias: umbracoPasswordRetrievalQuestionPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
[IgnoreDataMember]
public string PasswordQuestion
{
get
{
return Properties[Constants.Conventions.Member.PasswordQuestion].Value == null
? string.Empty
: Properties[Constants.Conventions.Member.PasswordQuestion].Value.ToString();
}
set
{
Properties[Constants.Conventions.Member.PasswordQuestion].Value = value;
}
}
/// <summary>
/// Gets or sets the Password Answer
/// </summary>
/// <remarks>
/// Alias: umbracoPasswordRetrievalAnswerPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
[IgnoreDataMember]
public string PasswordAnswer
{
get
{
return Properties[Constants.Conventions.Member.PasswordAnswer].Value == null
? string.Empty
: Properties[Constants.Conventions.Member.PasswordAnswer].Value.ToString();
}
set
{
Properties[Constants.Conventions.Member.PasswordAnswer].Value = value;
}
}
/// <summary>
/// Gets or set the comments for the member
/// </summary>
/// <remarks>
/// Alias: umbracoCommentPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
[IgnoreDataMember]
public string Comments
{
get
{
return Properties[Constants.Conventions.Member.Comments].Value == null
? string.Empty
: Properties[Constants.Conventions.Member.Comments].Value.ToString();
}
set
{
Properties[Constants.Conventions.Member.Comments].Value = value;
}
}
/// <summary>
/// Gets or sets a boolean indicating whether the Member is approved
/// </summary>
/// <remarks>
/// Alias: umbracoApprovePropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
[IgnoreDataMember]
public bool IsApproved
{
get
{
if (Properties[Constants.Conventions.Member.IsApproved].Value == null)
return default(bool);
if (Properties[Constants.Conventions.Member.IsApproved].Value is bool)
return (bool)Properties[Constants.Conventions.Member.IsApproved].Value;
//TODO: Use TryConvertTo<T> instead
return (bool)Convert.ChangeType(Properties[Constants.Conventions.Member.IsApproved].Value, typeof(bool));
}
set
{
Properties[Constants.Conventions.Member.IsApproved].Value = value;
}
}
/// <summary>
/// Gets or sets a boolean indicating whether the Member is locked out
/// </summary>
/// <remarks>
/// Alias: umbracoLockPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
[IgnoreDataMember]
public bool IsLockedOut
{
get
{
if (Properties[Constants.Conventions.Member.IsLockedOut].Value == null)
return default(bool);
if (Properties[Constants.Conventions.Member.IsLockedOut].Value is bool)
return (bool)Properties[Constants.Conventions.Member.IsLockedOut].Value;
//TODO: Use TryConvertTo<T> instead
return (bool)Convert.ChangeType(Properties[Constants.Conventions.Member.IsLockedOut].Value, typeof(bool));
}
set
{
Properties[Constants.Conventions.Member.IsLockedOut].Value = value;
}
}
/// <summary>
/// Gets or sets the date for last login
/// </summary>
/// <remarks>
/// Alias: umbracoLastLoginPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
[IgnoreDataMember]
public DateTime LastLoginDate
{
get
{
if (Properties[Constants.Conventions.Member.LastLoginDate].Value == null)
return default(DateTime);
if (Properties[Constants.Conventions.Member.LastLoginDate].Value is DateTime)
return (DateTime)Properties[Constants.Conventions.Member.LastLoginDate].Value;
//TODO: Use TryConvertTo<T> instead
return (DateTime)Convert.ChangeType(Properties[Constants.Conventions.Member.LastLoginDate].Value, typeof(DateTime));
}
set
{
Properties[Constants.Conventions.Member.LastLoginDate].Value = value;
}
}
/// <summary>
/// Gest or sets the date for last password change
/// </summary>
/// <remarks>
/// Alias: umbracoMemberLastPasswordChange
/// Part of the standard properties collection.
/// </remarks>
[IgnoreDataMember]
public DateTime LastPasswordChangeDate
{
get
{
if (Properties[Constants.Conventions.Member.LastPasswordChangeDate].Value == null)
return default(DateTime);
if (Properties[Constants.Conventions.Member.LastPasswordChangeDate].Value is DateTime)
return (DateTime)Properties[Constants.Conventions.Member.LastPasswordChangeDate].Value;
//TODO: Use TryConvertTo<T> instead
return (DateTime)Convert.ChangeType(Properties[Constants.Conventions.Member.LastPasswordChangeDate].Value, typeof(DateTime));
}
set
{
Properties[Constants.Conventions.Member.LastPasswordChangeDate].Value = value;
}
}
/// <summary>
/// Gets or sets the date for when Member was locked out
/// </summary>
/// <remarks>
/// Alias: umbracoMemberLastLockout
/// Part of the standard properties collection.
/// </remarks>
[IgnoreDataMember]
public DateTime LastLockoutDate
{
get
{
if (Properties[Constants.Conventions.Member.LastLockoutDate].Value == null)
return default(DateTime);
if (Properties[Constants.Conventions.Member.LastLockoutDate].Value is DateTime)
return (DateTime)Properties[Constants.Conventions.Member.LastLockoutDate].Value;
//TODO: Use TryConvertTo<T> instead
return (DateTime)Convert.ChangeType(Properties[Constants.Conventions.Member.LastLockoutDate].Value, typeof(DateTime));
}
set
{
Properties[Constants.Conventions.Member.LastLockoutDate].Value = value;
}
}
/// <summary>
/// Gets or sets the number of failed password attempts.
/// This is the number of times the password was entered incorrectly upon login.
/// </summary>
/// <remarks>
/// Alias: umbracoFailedPasswordAttemptsPropertyTypeAlias
/// Part of the standard properties collection.
/// </remarks>
[IgnoreDataMember]
public int FailedPasswordAttempts
{
get
{
if (Properties[Constants.Conventions.Member.FailedPasswordAttempts].Value == null)
return default(int);
if (Properties[Constants.Conventions.Member.FailedPasswordAttempts].Value is int)
return (int)Properties[Constants.Conventions.Member.FailedPasswordAttempts].Value;
//TODO: Use TryConvertTo<T> instead
return (int)Convert.ChangeType(Properties[Constants.Conventions.Member.FailedPasswordAttempts].Value, typeof(int));
}
set
{
Properties[Constants.Conventions.Member.LastLockoutDate].Value = value;
}
}
/// <summary>
/// String alias of the default ContentType
/// </summary>
[DataMember]
public virtual string ContentTypeAlias
{
get { return _contentTypeAlias; }
internal set
{
SetPropertyValueAndDetectChanges(o =>
{
_contentTypeAlias = value;
return _contentTypeAlias;
}, _contentTypeAlias, DefaultContentTypeAliasSelector);
}
}
/// <summary>
/// User key from the Provider.
/// </summary>
/// <remarks>
/// When using standard umbraco provider this key will
/// correspond to the guid UniqueId/Key.
/// Otherwise it will the one available from the asp.net
/// membership provider.
/// </remarks>
[DataMember]
internal virtual object ProviderUserKey
{
get
{
return _providerUserKey;
}
set
{
SetPropertyValueAndDetectChanges(o =>
{
_providerUserKey = value;
return _providerUserKey;
}, _providerUserKey, ProviderUserKeySelector);
}
}
/// <summary>
/// Gets or sets the type of the provider user key.
/// </summary>
/// <value>
/// The type of the provider user key.
/// </value>
[IgnoreDataMember]
internal Type ProviderUserKeyType
{
get
{
return _userTypeKey;
}
private set
{
SetPropertyValueAndDetectChanges(o =>
{
_userTypeKey = value;
return _userTypeKey;
}, _userTypeKey, UserTypeKeySelector);
}
}
/// <summary>
/// Sets the type of the provider user key.
/// </summary>
/// <param name="type">The type.</param>
internal void SetProviderUserKeyType(Type type)
{
ProviderUserKeyType = type;
}
/// <summary>
/// Method to call when Entity is being saved
/// </summary>
/// <remarks>Created date is set and a Unique key is assigned</remarks>
internal override void AddingEntity()
{
base.AddingEntity();
if (Key == Guid.Empty)
Key = Guid.NewGuid();
}
/// <summary>
/// Gets the ContentType used by this content object
/// </summary>
[IgnoreDataMember]
public IMemberType ContentType
{
get { return _contentType; }
}
public override void ChangeTrashedState(bool isTrashed, int parentId = -20)
{
throw new NotSupportedException("Members can't be trashed as no Recycle Bin exists, so use of this method is invalid");
}
/* Internal experiment - only used for mapping queries.
* Adding these to have first level properties instead of the Properties collection.
*/
internal string LongStringPropertyValue { get; set; }
internal string ShortStringPropertyValue { get; set; }
internal int IntegerropertyValue { get; set; }
internal bool BoolPropertyValue { get; set; }
internal DateTime DateTimePropertyValue { get; set; }
internal string PropertyTypeAlias { get; set; }
}
}
+138 -138
View File
@@ -1,139 +1,139 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models
{
/// <summary>
/// Represents the content type that a <see cref="Member"/> object is based on
/// </summary>
[Serializable]
[DataContract(IsReference = true)]
public class MemberType : ContentTypeCompositionBase, IMemberType
{
//Dictionary is divided into string: PropertyTypeAlias, Tuple: MemberCanEdit, VisibleOnProfile, PropertyTypeId
private IDictionary<string, Tuple<bool, bool, int>> _memberTypePropertyTypes;
public MemberType(int parentId) : base(parentId)
{
_memberTypePropertyTypes = new Dictionary<string, Tuple<bool, bool, int>>();
}
public MemberType(IContentTypeComposition parent) : base(parent)
{
_memberTypePropertyTypes = new Dictionary<string, Tuple<bool, bool, int>>();
}
private static readonly PropertyInfo MemberTypePropertyTypesSelector = ExpressionHelper.GetPropertyInfo<MemberType, IDictionary<string, Tuple<bool, bool, int>>>(x => x.MemberTypePropertyTypes);
/// <summary>
/// Gets or Sets a Dictionary of Tuples (MemberCanEdit, VisibleOnProfile, PropertyTypeId) by the PropertyTypes' alias.
/// </summary>
[DataMember]
internal IDictionary<string, Tuple<bool, bool, int>> MemberTypePropertyTypes
{
get { return _memberTypePropertyTypes; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_memberTypePropertyTypes = value;
return _memberTypePropertyTypes;
}, _memberTypePropertyTypes, MemberTypePropertyTypesSelector);
}
}
/// <summary>
/// Gets a boolean indicating whether a Property is editable by the Member.
/// </summary>
/// <param name="propertyTypeAlias">PropertyType Alias of the Property to check</param>
/// <returns></returns>
public bool MemberCanEditProperty(string propertyTypeAlias)
{
if (MemberTypePropertyTypes.ContainsKey(propertyTypeAlias))
{
return MemberTypePropertyTypes[propertyTypeAlias].Item1;
}
return false;
}
/// <summary>
/// Gets a boolean indicating whether a Property is visible on the Members profile.
/// </summary>
/// <param name="propertyTypeAlias">PropertyType Alias of the Property to check</param>
/// <returns></returns>
public bool MemberCanViewProperty(string propertyTypeAlias)
{
if (MemberTypePropertyTypes.ContainsKey(propertyTypeAlias))
{
return MemberTypePropertyTypes[propertyTypeAlias].Item2;
}
return false;
}
/// <summary>
/// Sets a boolean indicating whether a Property is editable by the Member.
/// </summary>
/// <param name="propertyTypeAlias">PropertyType Alias of the Property to set</param>
/// <param name="value">Boolean value, true or false</param>
public void SetMemberCanEditProperty(string propertyTypeAlias, bool value)
{
if (MemberTypePropertyTypes.ContainsKey(propertyTypeAlias))
{
var tuple = MemberTypePropertyTypes[propertyTypeAlias];
MemberTypePropertyTypes[propertyTypeAlias] = new Tuple<bool, bool, int>(value, tuple.Item2, tuple.Item3);
}
else
{
var propertyType = PropertyTypes.First(x => x.Alias.Equals(propertyTypeAlias));
var tuple = new Tuple<bool, bool, int>(value, false, propertyType.Id);
MemberTypePropertyTypes.Add(propertyTypeAlias, tuple);
}
}
/// <summary>
/// Sets a boolean indicating whether a Property is visible on the Members profile.
/// </summary>
/// <param name="propertyTypeAlias">PropertyType Alias of the Property to set</param>
/// <param name="value">Boolean value, true or false</param>
public void SetMemberCanViewProperty(string propertyTypeAlias, bool value)
{
if (MemberTypePropertyTypes.ContainsKey(propertyTypeAlias))
{
var tuple = MemberTypePropertyTypes[propertyTypeAlias];
MemberTypePropertyTypes[propertyTypeAlias] = new Tuple<bool, bool, int>(tuple.Item1, value, tuple.Item3);
}
else
{
var propertyType = PropertyTypes.First(x => x.Alias.Equals(propertyTypeAlias));
var tuple = new Tuple<bool, bool, int>(false, value, propertyType.Id);
MemberTypePropertyTypes.Add(propertyTypeAlias, tuple);
}
}
/// <summary>
/// Method to call when Entity is being saved
/// </summary>
/// <remarks>Created date is set and a Unique key is assigned</remarks>
internal override void AddingEntity()
{
base.AddingEntity();
if (Key == Guid.Empty)
Key = Guid.NewGuid();
}
/// <summary>
/// Method to call when Entity is being updated
/// </summary>
/// <remarks>Modified Date is set and a new Version guid is set</remarks>
internal override void UpdatingEntity()
{
base.UpdatingEntity();
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models
{
/// <summary>
/// Represents the content type that a <see cref="Member"/> object is based on
/// </summary>
[Serializable]
[DataContract(IsReference = true)]
public class MemberType : ContentTypeCompositionBase, IMemberType
{
//Dictionary is divided into string: PropertyTypeAlias, Tuple: MemberCanEdit, VisibleOnProfile, PropertyTypeId
private IDictionary<string, Tuple<bool, bool, int>> _memberTypePropertyTypes;
public MemberType(int parentId) : base(parentId)
{
_memberTypePropertyTypes = new Dictionary<string, Tuple<bool, bool, int>>();
}
public MemberType(IContentTypeComposition parent) : base(parent)
{
_memberTypePropertyTypes = new Dictionary<string, Tuple<bool, bool, int>>();
}
private static readonly PropertyInfo MemberTypePropertyTypesSelector = ExpressionHelper.GetPropertyInfo<MemberType, IDictionary<string, Tuple<bool, bool, int>>>(x => x.MemberTypePropertyTypes);
/// <summary>
/// Gets or Sets a Dictionary of Tuples (MemberCanEdit, VisibleOnProfile, PropertyTypeId) by the PropertyTypes' alias.
/// </summary>
[DataMember]
internal IDictionary<string, Tuple<bool, bool, int>> MemberTypePropertyTypes
{
get { return _memberTypePropertyTypes; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_memberTypePropertyTypes = value;
return _memberTypePropertyTypes;
}, _memberTypePropertyTypes, MemberTypePropertyTypesSelector);
}
}
/// <summary>
/// Gets a boolean indicating whether a Property is editable by the Member.
/// </summary>
/// <param name="propertyTypeAlias">PropertyType Alias of the Property to check</param>
/// <returns></returns>
public bool MemberCanEditProperty(string propertyTypeAlias)
{
if (MemberTypePropertyTypes.ContainsKey(propertyTypeAlias))
{
return MemberTypePropertyTypes[propertyTypeAlias].Item1;
}
return false;
}
/// <summary>
/// Gets a boolean indicating whether a Property is visible on the Members profile.
/// </summary>
/// <param name="propertyTypeAlias">PropertyType Alias of the Property to check</param>
/// <returns></returns>
public bool MemberCanViewProperty(string propertyTypeAlias)
{
if (MemberTypePropertyTypes.ContainsKey(propertyTypeAlias))
{
return MemberTypePropertyTypes[propertyTypeAlias].Item2;
}
return false;
}
/// <summary>
/// Sets a boolean indicating whether a Property is editable by the Member.
/// </summary>
/// <param name="propertyTypeAlias">PropertyType Alias of the Property to set</param>
/// <param name="value">Boolean value, true or false</param>
public void SetMemberCanEditProperty(string propertyTypeAlias, bool value)
{
if (MemberTypePropertyTypes.ContainsKey(propertyTypeAlias))
{
var tuple = MemberTypePropertyTypes[propertyTypeAlias];
MemberTypePropertyTypes[propertyTypeAlias] = new Tuple<bool, bool, int>(value, tuple.Item2, tuple.Item3);
}
else
{
var propertyType = PropertyTypes.First(x => x.Alias.Equals(propertyTypeAlias));
var tuple = new Tuple<bool, bool, int>(value, false, propertyType.Id);
MemberTypePropertyTypes.Add(propertyTypeAlias, tuple);
}
}
/// <summary>
/// Sets a boolean indicating whether a Property is visible on the Members profile.
/// </summary>
/// <param name="propertyTypeAlias">PropertyType Alias of the Property to set</param>
/// <param name="value">Boolean value, true or false</param>
public void SetMemberCanViewProperty(string propertyTypeAlias, bool value)
{
if (MemberTypePropertyTypes.ContainsKey(propertyTypeAlias))
{
var tuple = MemberTypePropertyTypes[propertyTypeAlias];
MemberTypePropertyTypes[propertyTypeAlias] = new Tuple<bool, bool, int>(tuple.Item1, value, tuple.Item3);
}
else
{
var propertyType = PropertyTypes.First(x => x.Alias.Equals(propertyTypeAlias));
var tuple = new Tuple<bool, bool, int>(false, value, propertyType.Id);
MemberTypePropertyTypes.Add(propertyTypeAlias, tuple);
}
}
/// <summary>
/// Method to call when Entity is being saved
/// </summary>
/// <remarks>Created date is set and a Unique key is assigned</remarks>
internal override void AddingEntity()
{
base.AddingEntity();
if (Key == Guid.Empty)
Key = Guid.NewGuid();
}
/// <summary>
/// Method to call when Entity is being updated
/// </summary>
/// <remarks>Modified Date is set and a new Version guid is set</remarks>
internal override void UpdatingEntity()
{
base.UpdatingEntity();
}
}
}
@@ -1,25 +1,47 @@
using System;
using System.Web.Security;
namespace Umbraco.Core.Models.Membership
{
internal static class MembershipExtensions
{
internal static MembershipUser AsConcreteMembershipUser(this IMember member)
{
var membershipMember = new UmbracoMembershipMember(member);
return membershipMember;
}
internal static IMember AsIMember(this MembershipUser membershipMember)
{
var member = membershipMember as UmbracoMembershipMember;
if (member != null)
{
return member.Member;
}
throw new NotImplementedException();
}
}
using System;
using System.Web.Security;
using Umbraco.Core.Services;
namespace Umbraco.Core.Models.Membership
{
internal static class MembershipExtensions
{
internal static MembershipUser AsConcreteMembershipUser(this IMember member)
{
var membershipMember = new UmbracoMembershipMember(member);
return membershipMember;
}
internal static IMember AsIMember(this MembershipUser membershipMember)
{
var member = membershipMember as UmbracoMembershipMember;
if (member != null)
{
return member.Member;
}
throw new NotImplementedException();
}
private static MembershipScenario? _scenario = null;
/// <summary>
/// Returns the currently configured membership scenario for members in umbraco
/// </summary>
/// <value></value>
internal static MembershipScenario GetMembershipScenario(this IMemberService memberService)
{
if (_scenario.HasValue == false)
{
if (System.Web.Security.Membership.Provider.Name == Constants.Conventions.Member.UmbracoMemberProviderName)
{
return MembershipScenario.NativeUmbraco;
}
var memberType = ApplicationContext.Current.Services.MemberTypeService.GetMemberType(Constants.Conventions.MemberTypes.Member);
return memberType != null
? MembershipScenario.CustomProviderWithUmbracoLink
: MembershipScenario.StandaloneCustomProvider;
}
return _scenario.Value;
}
}
}
@@ -0,0 +1,33 @@
namespace Umbraco.Core.Models.Membership
{
/// <summary>
/// How membership is implemented in the current install.
/// </summary>
public enum MembershipScenario
{
/// <summary>
/// The member is based on the native Umbraco members (IMember + Umbraco membership provider)
/// </summary>
/// <remarks>
/// This supports custom member properties
/// </remarks>
NativeUmbraco,
/// <summary>
/// The member is based on a custom member provider but it is linked to an IMember
/// </summary>
/// <remarks>
/// This supports custom member properties (but that is not enabled yet)
/// </remarks>
CustomProviderWithUmbracoLink,
/// <summary>
/// The member is based purely on a custom member provider and is not linked to umbraco data
/// </summary>
/// <remarks>
/// This does not support custom member properties.
/// </remarks>
StandaloneCustomProvider
}
}
@@ -1,66 +1,66 @@
using System.Web.Security;
namespace Umbraco.Core.Models.Membership
{
//TODO: THere's still a bunch of properties that don't exist in this use that need to be mapped somehow.
internal class UmbracoMembershipMember : MembershipUser
{
private readonly IMember _member;
public UmbracoMembershipMember(IMember member)
{
_member = member;
}
internal IMember Member
{
get { return _member; }
}
public override string Email
{
get { return _member.Email; }
set { _member.Email = value; }
}
public override object ProviderUserKey
{
get { return _member.Key; }
}
public override System.DateTime CreationDate
{
get { return _member.CreateDate; }
}
public override string UserName
{
get { return _member.Username; }
}
public override string Comment
{
get { return _member.Comments; }
set { _member.Comments = value; }
}
public override bool IsApproved
{
get { return _member.IsApproved; }
set { _member.IsApproved = value; }
}
public override bool IsLockedOut
{
get { return _member.IsLockedOut; }
}
public override System.DateTime LastLoginDate
{
get { return _member.LastLoginDate; }
set { _member.LastLoginDate = value; }
}
}
using System.Web.Security;
namespace Umbraco.Core.Models.Membership
{
//TODO: THere's still a bunch of properties that don't exist in this use that need to be mapped somehow.
internal class UmbracoMembershipMember : MembershipUser
{
private readonly IMember _member;
public UmbracoMembershipMember(IMember member)
{
_member = member;
}
internal IMember Member
{
get { return _member; }
}
public override string Email
{
get { return _member.Email; }
set { _member.Email = value; }
}
public override object ProviderUserKey
{
get { return _member.Key; }
}
public override System.DateTime CreationDate
{
get { return _member.CreateDate; }
}
public override string UserName
{
get { return _member.Username; }
}
public override string Comment
{
get { return _member.Comments; }
set { _member.Comments = value; }
}
public override bool IsApproved
{
get { return _member.IsApproved; }
set { _member.IsApproved = value; }
}
public override bool IsLockedOut
{
get { return _member.IsLockedOut; }
}
public override System.DateTime LastLoginDate
{
get { return _member.LastLoginDate; }
set { _member.LastLoginDate = value; }
}
}
}
+62 -62
View File
@@ -1,63 +1,63 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models
{
/// <summary>
/// Represents a paged result for a model collection
/// </summary>
/// <typeparam name="T"></typeparam>
[DataContract(Name = "pagedCollection", Namespace = "")]
public class PagedResult<T>
{
public PagedResult(long totalItems, long pageNumber, long pageSize)
{
TotalItems = totalItems;
PageNumber = pageNumber;
PageSize = pageSize;
if (pageSize > 0)
{
TotalPages = (long) Math.Ceiling(totalItems/(Decimal) pageSize);
}
else
{
TotalPages = 1;
}
}
[DataMember(Name = "pageNumber")]
public long PageNumber { get; private set; }
[DataMember(Name = "pageSize")]
public long PageSize { get; private set; }
[DataMember(Name = "totalPages")]
public long TotalPages { get; private set; }
[DataMember(Name = "totalItems")]
public long TotalItems { get; private set; }
[DataMember(Name = "items")]
public IEnumerable<T> Items { get; set; }
/// <summary>
/// Calculates the skip size based on the paged parameters specified
/// </summary>
/// <remarks>
/// Returns 0 if the page number or page size is zero
/// </remarks>
internal int SkipSize
{
get
{
if (PageNumber > 0 && PageSize > 0)
{
return Convert.ToInt32((PageNumber - 1)*PageSize);
}
return 0;
}
}
}
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models
{
/// <summary>
/// Represents a paged result for a model collection
/// </summary>
/// <typeparam name="T"></typeparam>
[DataContract(Name = "pagedCollection", Namespace = "")]
public class PagedResult<T>
{
public PagedResult(long totalItems, long pageNumber, long pageSize)
{
TotalItems = totalItems;
PageNumber = pageNumber;
PageSize = pageSize;
if (pageSize > 0)
{
TotalPages = (long) Math.Ceiling(totalItems/(Decimal) pageSize);
}
else
{
TotalPages = 1;
}
}
[DataMember(Name = "pageNumber")]
public long PageNumber { get; private set; }
[DataMember(Name = "pageSize")]
public long PageSize { get; private set; }
[DataMember(Name = "totalPages")]
public long TotalPages { get; private set; }
[DataMember(Name = "totalItems")]
public long TotalItems { get; private set; }
[DataMember(Name = "items")]
public IEnumerable<T> Items { get; set; }
/// <summary>
/// Calculates the skip size based on the paged parameters specified
/// </summary>
/// <remarks>
/// Returns 0 if the page number or page size is zero
/// </remarks>
internal int SkipSize
{
get
{
if (PageNumber > 0 && PageSize > 0)
{
return Convert.ToInt32((PageNumber - 1)*PageSize);
}
return 0;
}
}
}
}
@@ -17,16 +17,17 @@ namespace Umbraco.Core.Models
/// <returns>Xml of the property and its value</returns>
public static XElement ToXml(this Property property)
{
return property.ToXml(ApplicationContext.Current.Services.DataTypeService);
return property.ToXml(property.PropertyType, ApplicationContext.Current.Services.DataTypeService);
}
/// <summary>
/// Creates the xml representation for the <see cref="Property"/> object
/// </summary>
/// <param name="property"><see cref="Property"/> to generate xml for</param>
/// <param name="propertyType"></param>
/// <param name="dataTypeService"></param>
/// <returns>Xml of the property and its value</returns>
internal static XElement ToXml(this Property property, IDataTypeService dataTypeService)
internal static XElement ToXml(this Property property, PropertyType propertyType, IDataTypeService dataTypeService)
{
var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "data" : property.Alias.ToSafeAlias();
@@ -43,7 +44,7 @@ namespace Umbraco.Core.Models
var propertyEditor = PropertyEditorResolver.Current.GetByAlias(property.PropertyType.PropertyEditorAlias);
if (propertyEditor != null)
{
var xmlValue = propertyEditor.ValueEditor.ConvertDbToXml(property);
var xmlValue = propertyEditor.ValueEditor.ConvertDbToXml(property, propertyType, dataTypeService);
xElement.Add(xmlValue);
}
+42 -42
View File
@@ -1,43 +1,43 @@
using System;
using System.Collections.Generic;
namespace Umbraco.Core.Models
{
/// <summary>
/// A property extension class that allows us to enable tags for any given property
/// </summary>
internal class PropertyTags
{
public PropertyTags()
{
Enable = false;
Behavior = PropertyTagBehavior.Merge;
}
/// <summary>
/// The behavior of how to save the tags assigned -
/// Merge (keep existing and append new),
/// Remove (remove any of the tags in the Tags property that are currently assigned,
/// Replace (replace the currently assigned tags with the ones specified)
/// </summary>
public PropertyTagBehavior Behavior { get; set; }
/// <summary>
/// Flags the property to have tagging enabled
/// </summary>
public bool Enable { get; set; }
/// <summary>
/// The actual tags to associate - tag/group
/// </summary>
public IEnumerable<Tuple<string, string>> Tags { get; set; }
}
internal enum PropertyTagBehavior
{
Replace,
Remove,
Merge
}
using System;
using System.Collections.Generic;
namespace Umbraco.Core.Models
{
/// <summary>
/// A property extension class that allows us to enable tags for any given property
/// </summary>
internal class PropertyTags
{
public PropertyTags()
{
Enable = false;
Behavior = PropertyTagBehavior.Merge;
}
/// <summary>
/// The behavior of how to save the tags assigned -
/// Merge (keep existing and append new),
/// Remove (remove any of the tags in the Tags property that are currently assigned,
/// Replace (replace the currently assigned tags with the ones specified)
/// </summary>
public PropertyTagBehavior Behavior { get; set; }
/// <summary>
/// Flags the property to have tagging enabled
/// </summary>
public bool Enable { get; set; }
/// <summary>
/// The actual tags to associate - tag/group
/// </summary>
public IEnumerable<Tuple<string, string>> Tags { get; set; }
}
internal enum PropertyTagBehavior
{
Replace,
Remove,
Merge
}
}
@@ -1,46 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Umbraco.Core.Models.PublishedContent
{
/// <summary>
/// Provides methods to handle extended content.
/// </summary>
internal interface IPublishedContentExtended : IPublishedContent
{
/// <summary>
/// Adds a property to the extended content.
/// </summary>
/// <param name="property">The property to add.</param>
void AddProperty(IPublishedProperty property);
/// <summary>
/// Gets a value indicating whether properties were added to the extended content.
/// </summary>
bool HasAddedProperties { get; }
/// <summary>
/// Sets the content set of the extended content.
/// </summary>
/// <param name="contentSet"></param>
void SetContentSet(IEnumerable<IPublishedContent> contentSet);
/// <summary>
/// Resets the content set of the extended content.
/// </summary>
void ClearContentSet();
/// <summary>
/// Sets the index of the extended content.
/// </summary>
/// <param name="value">The index value.</param>
void SetIndex(int value);
/// <summary>
/// Resets the index of the extended content.
/// </summary>
void ClearIndex();
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Umbraco.Core.Models.PublishedContent
{
/// <summary>
/// Provides methods to handle extended content.
/// </summary>
internal interface IPublishedContentExtended : IPublishedContent
{
/// <summary>
/// Adds a property to the extended content.
/// </summary>
/// <param name="property">The property to add.</param>
void AddProperty(IPublishedProperty property);
/// <summary>
/// Gets a value indicating whether properties were added to the extended content.
/// </summary>
bool HasAddedProperties { get; }
/// <summary>
/// Sets the content set of the extended content.
/// </summary>
/// <param name="contentSet"></param>
void SetContentSet(IEnumerable<IPublishedContent> contentSet);
/// <summary>
/// Resets the content set of the extended content.
/// </summary>
void ClearContentSet();
/// <summary>
/// Sets the index of the extended content.
/// </summary>
/// <param name="value">The index value.</param>
void SetIndex(int value);
/// <summary>
/// Resets the index of the extended content.
/// </summary>
void ClearIndex();
}
}
@@ -1,16 +1,16 @@
namespace Umbraco.Core.Models.PublishedContent
{
/// <summary>
/// Provides the model creation service.
/// </summary>
internal interface IPublishedContentModelFactory
{
/// <summary>
/// Creates a strongly-typed model representing a published content.
/// </summary>
/// <param name="content">The original published content.</param>
/// <returns>The strongly-typed model representing the published content, or the published content
/// itself it the factory has no model for that content type.</returns>
IPublishedContent CreateModel(IPublishedContent content);
}
namespace Umbraco.Core.Models.PublishedContent
{
/// <summary>
/// Provides the model creation service.
/// </summary>
internal interface IPublishedContentModelFactory
{
/// <summary>
/// Creates a strongly-typed model representing a published content.
/// </summary>
/// <param name="content">The original published content.</param>
/// <returns>The strongly-typed model representing the published content, or the published content
/// itself it the factory has no model for that content type.</returns>
IPublishedContent CreateModel(IPublishedContent content);
}
}
@@ -1,151 +1,151 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
namespace Umbraco.Core.Models.PublishedContent
{
public class PublishedContentExtended : PublishedContentWrapped, IPublishedContentExtended
{
#region Constructor
// protected for models, private for our static Extend method
protected PublishedContentExtended(IPublishedContent content)
: base(content)
{ }
#endregion
#region Index
private int? _index;
public override int GetIndex()
{
// fast
if (_index.HasValue) return _index.Value;
// slow -- and don't cache, not in a set
if (_contentSet == null) return Content.GetIndex();
// slow -- but cache for next time
var index = _contentSet.FindIndex(x => x.Id == Id);
if (index < 0)
throw new IndexOutOfRangeException("Could not find content in the content set.");
_index = index;
return index;
}
#endregion
#region Extend
internal static IPublishedContentExtended Extend(IPublishedContent content, IEnumerable<IPublishedContent> contentSet)
{
var wrapped = content as PublishedContentExtended;
while (wrapped != null && ((IPublishedContentExtended)wrapped).HasAddedProperties == false)
wrapped = (content = wrapped.Unwrap()) as PublishedContentExtended;
// if the factory returns something else than content it means it has created
// a model, and then that model has to inherit from PublishedContentExtended,
// => implements the internal IPublishedContentExtended.
var model = PublishedContentModelFactory.CreateModel(content);
var extended = model == content // == means the factory did not create a model
? new PublishedContentExtended(content) // so we have to extend
: model; // else we can use what the factory returned
var extended2 = extended as IPublishedContentExtended;
if (extended2 != null) // always true, but keeps Resharper happy
extended2.SetContentSet(contentSet);
return extended2;
}
#endregion
#region IPublishedContentExtended
void IPublishedContentExtended.AddProperty(IPublishedProperty property)
{
if (_properties == null)
_properties = new Collection<IPublishedProperty>();
_properties.Add(property);
}
bool IPublishedContentExtended.HasAddedProperties
{
get { return _properties != null; }
}
void IPublishedContentExtended.SetContentSet(IEnumerable<IPublishedContent> contentSet)
{
_contentSet = contentSet;
}
void IPublishedContentExtended.ClearContentSet()
{
_contentSet = null;
}
void IPublishedContentExtended.SetIndex(int value)
{
_index = value;
}
void IPublishedContentExtended.ClearIndex()
{
_index = null;
}
#endregion
#region Content set
private IEnumerable<IPublishedContent> _contentSet;
public override IEnumerable<IPublishedContent> ContentSet
{
get { return _contentSet ?? Content.ContentSet; }
}
#endregion
#region Properties
private ICollection<IPublishedProperty> _properties;
public override ICollection<IPublishedProperty> Properties
{
get
{
return _properties == null
? Content.Properties
: Content.Properties.Union(_properties).ToList();
}
}
public override object this[string alias]
{
get
{
if (_properties != null)
{
var property = _properties.FirstOrDefault(prop => prop.PropertyTypeAlias.InvariantEquals(alias));
if (property != null) return property.HasValue ? property.Value : null;
}
return Content[alias];
}
}
public override IPublishedProperty GetProperty(string alias)
{
return _properties == null
? Content.GetProperty(alias)
: _properties.FirstOrDefault(prop => prop.PropertyTypeAlias.InvariantEquals(alias)) ?? Content.GetProperty(alias);
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
namespace Umbraco.Core.Models.PublishedContent
{
public class PublishedContentExtended : PublishedContentWrapped, IPublishedContentExtended
{
#region Constructor
// protected for models, private for our static Extend method
protected PublishedContentExtended(IPublishedContent content)
: base(content)
{ }
#endregion
#region Index
private int? _index;
public override int GetIndex()
{
// fast
if (_index.HasValue) return _index.Value;
// slow -- and don't cache, not in a set
if (_contentSet == null) return Content.GetIndex();
// slow -- but cache for next time
var index = _contentSet.FindIndex(x => x.Id == Id);
if (index < 0)
throw new IndexOutOfRangeException("Could not find content in the content set.");
_index = index;
return index;
}
#endregion
#region Extend
internal static IPublishedContentExtended Extend(IPublishedContent content, IEnumerable<IPublishedContent> contentSet)
{
var wrapped = content as PublishedContentExtended;
while (wrapped != null && ((IPublishedContentExtended)wrapped).HasAddedProperties == false)
wrapped = (content = wrapped.Unwrap()) as PublishedContentExtended;
// if the factory returns something else than content it means it has created
// a model, and then that model has to inherit from PublishedContentExtended,
// => implements the internal IPublishedContentExtended.
var model = PublishedContentModelFactory.CreateModel(content);
var extended = model == content // == means the factory did not create a model
? new PublishedContentExtended(content) // so we have to extend
: model; // else we can use what the factory returned
var extended2 = extended as IPublishedContentExtended;
if (extended2 != null) // always true, but keeps Resharper happy
extended2.SetContentSet(contentSet);
return extended2;
}
#endregion
#region IPublishedContentExtended
void IPublishedContentExtended.AddProperty(IPublishedProperty property)
{
if (_properties == null)
_properties = new Collection<IPublishedProperty>();
_properties.Add(property);
}
bool IPublishedContentExtended.HasAddedProperties
{
get { return _properties != null; }
}
void IPublishedContentExtended.SetContentSet(IEnumerable<IPublishedContent> contentSet)
{
_contentSet = contentSet;
}
void IPublishedContentExtended.ClearContentSet()
{
_contentSet = null;
}
void IPublishedContentExtended.SetIndex(int value)
{
_index = value;
}
void IPublishedContentExtended.ClearIndex()
{
_index = null;
}
#endregion
#region Content set
private IEnumerable<IPublishedContent> _contentSet;
public override IEnumerable<IPublishedContent> ContentSet
{
get { return _contentSet ?? Content.ContentSet; }
}
#endregion
#region Properties
private ICollection<IPublishedProperty> _properties;
public override ICollection<IPublishedProperty> Properties
{
get
{
return _properties == null
? Content.Properties
: Content.Properties.Union(_properties).ToList();
}
}
public override object this[string alias]
{
get
{
if (_properties != null)
{
var property = _properties.FirstOrDefault(prop => prop.PropertyTypeAlias.InvariantEquals(alias));
if (property != null) return property.HasValue ? property.Value : null;
}
return Content[alias];
}
}
public override IPublishedProperty GetProperty(string alias)
{
return _properties == null
? Content.GetProperty(alias)
: _properties.FirstOrDefault(prop => prop.PropertyTypeAlias.InvariantEquals(alias)) ?? Content.GetProperty(alias);
}
#endregion
}
}
@@ -1,24 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Umbraco.Core.Models.PublishedContent
{
/// <summary>
/// Represents a strongly-typed published content.
/// </summary>
/// <remarks>Every strongly-typed published content class should inherit from <c>PublishedContentModel</c>
/// (or inherit from a class that inherits from... etc.) so they are picked by the factory.</remarks>
internal abstract class PublishedContentModel : PublishedContentExtended
{
/// <summary>
/// Initializes a new instance of the <see cref="PublishedContentModel"/> class with
/// an original <see cref="IPublishedContent"/> instance.
/// </summary>
/// <param name="content">The original content.</param>
protected PublishedContentModel(IPublishedContent content)
: base(content)
{ }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Umbraco.Core.Models.PublishedContent
{
/// <summary>
/// Represents a strongly-typed published content.
/// </summary>
/// <remarks>Every strongly-typed published content class should inherit from <c>PublishedContentModel</c>
/// (or inherit from a class that inherits from... etc.) so they are picked by the factory.</remarks>
internal abstract class PublishedContentModel : PublishedContentExtended
{
/// <summary>
/// Initializes a new instance of the <see cref="PublishedContentModel"/> class with
/// an original <see cref="IPublishedContent"/> instance.
/// </summary>
/// <param name="content">The original content.</param>
protected PublishedContentModel(IPublishedContent content)
: base(content)
{ }
}
}
@@ -1,29 +1,29 @@
using System;
namespace Umbraco.Core.Models.PublishedContent
{
/// <summary>
/// Indicates that the class is a published content model for a specified content type.
/// </summary>
/// <remarks>By default, the name of the class is assumed to be the content type alias. The
/// <c>PublishedContentModelAttribute</c> can be used to indicate a different alias.</remarks>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
internal sealed class PublishedContentModelAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="PublishedContentModelAttribute"/> class with a content type alias.
/// </summary>
/// <param name="contentTypeAlias">The content type alias.</param>
public PublishedContentModelAttribute(string contentTypeAlias)
{
if (string.IsNullOrWhiteSpace(contentTypeAlias))
throw new ArgumentException("Argument cannot be null nor empty.", "contentTypeAlias");
ContentTypeAlias = contentTypeAlias;
}
/// <summary>
/// Gets or sets the content type alias.
/// </summary>
public string ContentTypeAlias { get; private set; }
}
}
using System;
namespace Umbraco.Core.Models.PublishedContent
{
/// <summary>
/// Indicates that the class is a published content model for a specified content type.
/// </summary>
/// <remarks>By default, the name of the class is assumed to be the content type alias. The
/// <c>PublishedContentModelAttribute</c> can be used to indicate a different alias.</remarks>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
internal sealed class PublishedContentModelAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="PublishedContentModelAttribute"/> class with a content type alias.
/// </summary>
/// <param name="contentTypeAlias">The content type alias.</param>
public PublishedContentModelAttribute(string contentTypeAlias)
{
if (string.IsNullOrWhiteSpace(contentTypeAlias))
throw new ArgumentException("Argument cannot be null nor empty.", "contentTypeAlias");
ContentTypeAlias = contentTypeAlias;
}
/// <summary>
/// Gets or sets the content type alias.
/// </summary>
public string ContentTypeAlias { get; private set; }
}
}

Some files were not shown because too many files have changed in this diff Show More