Compare commits

...

897 Commits

Author SHA1 Message Date
Sebastiaan Janssen af0011f32a Fixes U4-1432 4.11.2 - Tinymce strips 'src' attribute from images 2013-01-11 08:23:31 -01:00
Sebastiaan Janssen ab6c5ac21a Added tag Release-4.11.2 for changeset 73711b806a40 2013-01-10 11:05:52 -01:00
Sebastiaan Janssen 227a38fb98 Removed tag 4.11.2 2013-01-10 11:05:43 -01:00
Sebastiaan Janssen 06f9dee649 Added tag 4.11.2 for changeset 73711b806a40 2013-01-10 11:05:34 -01:00
Sebastiaan Janssen 75680192bb Merge 4.11.2 into default 2013-01-10 11:05:13 -01:00
Sebastiaan Janssen a53efb394f Closing 4.11.2 branch 2013-01-10 10:54:56 -01:00
Sebastiaan Janssen 98ed32c8cf Include the new translation files in the project so they get in the build too 2013-01-10 09:55:35 -01:00
Sebastiaan Janssen df10ebebca Get latest translations in 2013-01-10 08:21:27 -01:00
Sebastiaan Janssen 88dc73cd66 Fix the unpublished/pendinchanges/published display 2013-01-10 07:29:04 -01:00
Sebastiaan Janssen cd0919aeeb Update version to 4.11.2 2013-01-09 16:03:56 -01:00
Sebastiaan Janssen ce6711b587 Duplicate fix (ce2f47c11322) #U4-1366 - conflict with partial view macro engine. 2013-01-09 13:58:55 -01:00
Sebastiaan Janssen e6178efcfb Duplicating fix for U4-483 so that this also fixes U4-1391 in the 4.11.x branch 2013-01-07 08:12:53 -01:00
Sebastiaan Janssen 30cf0e2040 Add some logging to PhysicalFileSystem 2012-12-26 06:49:54 -01:00
Sebastiaan Janssen 48d620cdb0 Cleanup RTE ImageHelper a little bit, still bad code but more readable now 2012-12-26 06:27:30 -01:00
Sebastiaan Janssen 3bd487d092 Fixed #U4-1323 Stripping umbraco path out of source is not needed any more 2012-12-26 05:54:34 -01:00
Sebastiaan Janssen 6c8c37256b Cleanup media uploader in RTE a little 2012-12-26 05:50:48 -01:00
Sebastiaan Janssen 37b1fcbaf0 Fix image uploader in RTE, when used in VDir it returns the right path now
no need for relative path hacks
2012-12-26 05:49:03 -01:00
Sebastiaan Janssen dc111768e3 Slight MediaFactory refactors, mostly to fix issue U4-1344 where files wouldn't
upload if the "magic" umbraco props don't exist (witdth, height, bytes)
2012-12-23 11:46:04 -01:00
leekelleher 6589d5d5d3 MNTP: Fixed an long-time CSS bug. Aligned the header with the right-panel. 2012-12-21 15:58:02 +00:00
Sebastiaan Janssen e6975a71d5 Additional fix for U4-1312 Cant publish child node, because parent not published
When you unpublish a node which it's descendants also get unpublished, but as
soon as you publish the parent node again, they don't end up in the XML cache
any more, leading to this error again. Now putting all previously published
documents back into the XML cache when the parent gets published
2012-12-20 14:05:28 -01:00
Sebastiaan Janssen 33b497e5f4 Additional fix for U4-1341 - nodes should appear dimmed when unpublished, but
they appeared as changed (and not dimmed, therefore looked published)
2012-12-20 13:42:30 -01:00
Sebastiaan Janssen c5e7c81c19 Notification and tree refresh when unpublishing content 2012-12-20 09:25:50 -01:00
Sebastiaan Janssen 47d1fe7082 Fixed U4-703 - Updating or re-installing package causes duplicate trees 2012-12-19 09:05:23 -01:00
Sebastiaan Janssen 735bd574ff Didn't mean to commit test code, sorry! 2012-12-17 12:29:43 -01:00
Sebastiaan Janssen 5c0d9785e0 Don't check log comment length if it is null.. helped with a broken recycle bin
not deleting content because sometimes the title of the content would be null
2012-12-17 09:25:55 -01:00
Sebastiaan Janssen db14868324 attributes["macroalias"] would YSOD instead of give back a null 2012-12-14 13:51:01 -01:00
Stephan 06952833ef U4-1212, U4-1312 - fix Document.PathPublished 2012-12-13 15:48:46 -01:00
Shannon Deminick 2a90e93a6f Updated partial view macro engine to support storing the files in the App_Plugins/[packagename]/Views/MacroPartials
so they can be stored with a package and not pollute the main file system.
2012-12-07 07:04:11 +05:00
Shannon Deminick 0d94ddb96e Got macro parameters working with Partial View Macros, changed PartialViewMacroPage to inherit from
UmbracoViewPage<PartialViewMacroModel> so that UmbracoHelper, etc... are available.
2012-12-07 06:31:53 +05:00
Shannon Deminick c7645b55ba Partial View Macros now being rendered, now to implement the remaining parts with things like
parameters, etc...
2012-12-04 22:06:55 +05:00
Shannon Deminick 208806c027 Updated more partial view macro engine and its rendering... nearly there. 2012-12-04 11:31:03 +05:00
Shannon Deminick 8024610364 Fixes up some logging API issues. Fixed up tracing in the macro class. Added support for Partial View macro rendering in the macro class. 2012-12-04 11:08:02 +05:00
Shannon Deminick 8e4644568b Updated loghelper to be able to Warn and also trace Warn with an exception. Updated the macro control to check for the
Partial View Macro, added Partial View macro to the enum.
2012-12-04 05:58:24 +05:00
Shannon Deminick e0a71830fa Updated macro editor to support Partial view macros. Improves the JS in the editor (no more c# based js) which auto clears
other fields and drop downs when other files are selected.
2012-12-04 05:42:15 +05:00
Shannon Deminick 5b0057c258 Added missing files. 2012-12-04 03:29:02 +05:00
Shannon Deminick fb61c55fa7 Started on PartialViewMacros 2012-12-04 03:26:04 +05:00
Stephan a70ef52964 fix xpath syntax error with legacy XML schema 2012-11-30 13:33:24 -01:00
Stephan 51204ee401 U4-1212 - bugfix Document.PathPublished 2012-12-11 17:37:33 -01:00
Sebastiaan Janssen 657f165ffb Created branch 4.11.2 2012-12-17 12:22:11 -01:00
Casey Neehouse 3bd98d851a Reverting the config files that inadvertently got committed. 2012-11-29 21:42:37 +05:00
Casey Neehouse 9eea46b19b Modification of UserControl usage to allow for Virtual Path to be used correctly. 2012-11-29 21:27:42 +05:00
Sebastiaan Janssen 76fb5d260f Moved tag Release-4.11.1 to changeset 6eb5f2fb5a88 (from changeset 7f827760cb49) 2012-11-28 13:35:30 -01:00
Sebastiaan Janssen 267cd46ea0 Another additional fix to make the reloading of trees work after package install 2012-11-28 13:34:35 -01:00
Sebastiaan Janssen 96f6a0161f Merge with 4.11.1 2012-11-28 13:08:13 -01:00
Sebastiaan Janssen 7bc53adc67 Closing 4.11.1 branch 2012-11-28 13:06:01 -01:00
Sebastiaan Janssen 8ecff73c18 Added tag Release-4.11.1 for changeset 7f827760cb49 2012-11-28 13:05:21 -01:00
Stephan 35e65ad18c add support for "/foo" hostnames ONLY for backward compat.
fix invalid hostname message
2012-11-28 12:43:19 -01:00
Sebastiaan Janssen 8def8eaa86 Bumping the version to 4.11.1 2012-11-28 09:44:03 -01:00
Sebastiaan Janssen c0774ad9b9 Merge 2012-11-28 09:24:54 -01:00
Sebastiaan Janssen f306cbe457 Move invalidDomain entry to the correct area. 2012-11-28 09:24:40 -01:00
Sebastiaan Janssen 577b989c4c Aha, string needs to start all the way to the left to appear nicely in the editor 2012-11-28 08:41:54 -01:00
Sebastiaan Janssen e6b162f4f6 Add translation for invalid hostname 2012-11-28 08:37:08 -01:00
Stephan b40cc1879f missing entry in language file 2012-11-28 07:36:08 -01:00
Shannon Deminick 8a7c7bf77d Merge 2012-11-27 21:47:20 +05:00
Shannon Deminick 38a1179de5 applied patch from rev 189f37a1dd63 which reverts the last minute changes before 4.11
release, namely changes to the ApplicationTreeRegistrar, TreeDefinitionCollection, theend installer step.
2012-11-27 21:45:57 +05:00
Sebastiaan Janssen f263b4d92b Fixes U4-1162 - In MVC mode, creating a child template doesn't set the layout
correctly (it's missing the .cshtml extension)
2012-11-27 15:36:54 -01:00
Sebastiaan Janssen c612727116 Add translations that got lost in merge, fixes U4-1254 2012-11-27 14:07:13 -01:00
Sebastiaan Janssen ab9c9df7d6 Reverting last minute hacks around the pluginmanager and adding Shannon's fixes
from changeset 85f9e5879e60
2012-11-27 13:27:33 -01:00
Stephan c607e50433 U4-1245, U4-1186... fix the mess I created with hostnames 2012-11-27 12:43:57 -01:00
Stephan df5555bdf1 Opened branch 4.11.1 2012-11-27 12:40:42 -01:00
Sebastiaan Janssen 9506339e6f Merge with 4.11.0 2012-11-23 13:37:17 -01:00
Sebastiaan Janssen 68605a7560 Closed branch 4.11.0 2012-11-23 13:36:14 -01:00
Sebastiaan Janssen 839dd7315a Added tag Release-4.11.0 for changeset 20e4dff821d8 2012-11-23 13:33:15 -01:00
Sebastiaan Janssen f1314628d7 One last hack to get the the macroengines to show up after install. 2012-11-23 12:01:43 -01:00
Sebastiaan Janssen e23ed30b0c Took out the temporary tree fixes and put another temp fix in (reverts to the 4.10.x code)
Also removed dependency on ClientDependency.Mvc for now to make upgrades easier (no requirement to do assembly redirects in web.config)
2012-11-23 11:45:51 -01:00
PerPloug 55cb46927e Changes to template and masterpages helper 2012-11-23 09:37:35 -01:00
Sebastiaan Janssen 654c3b7403 Another temporary fix for trees being unavailable after install, the context is null during upgrades in the installer, so would cause a YSOD 2012-11-23 08:02:23 -01:00
Sebastiaan Janssen 4195754b0c Pull in new translations before release 2012-11-23 07:36:58 -01:00
Sebastiaan Janssen 96a6f17bd7 Update for the WebPI build, should now automatically be good
Fixes U4-132
2012-11-22 16:06:06 -01:00
Sebastiaan Janssen 61d99c4061 Of course we also need the assembly redirect for MVC2 -> 3 in the template config to start with (so the build.bat picks it up as well) 2012-11-22 15:45:14 -01:00
Sebastiaan Janssen 0a6e91a2f9 Fixed U4-1235 Changing document type alias YSOD's on SQL CE 2012-11-22 15:04:27 -01:00
jeavonleopold cf9e786e45 U4-1241 Fix - BaseTreePicker GetItemBreadcrumbs causes YSOD for Property Editors that do not store numeric ID's 2012-11-22 15:17:12 +00:00
Sebastiaan Janssen ba1d3fd3e6 Fix Library.Search not giving back an list of DynamicNodes any more, breaking accessibility to custom properties 2012-11-22 13:23:20 -01:00
Sebastiaan Janssen ac01fd48fa Some refactoring of the Umbraco:image implementation after code review 2012-11-22 12:30:58 -01:00
Sebastiaan Janssen f53fb694be Tightened up and renamed the ReadPublished method (relating to pull request for U4-606) 2012-11-22 09:53:11 -01:00
Sebastiaan Janssen 1ecd8fa87d Temporary fix for trees being unavailable after install 2012-11-22 09:34:05 -01:00
Sebastiaan Janssen ce1c9d697b Add assemblyredirect for System.Web.Mvc because ClientDependency.Core.Mvc relies on Mvc v2 while we're using 3. 2012-11-22 09:30:07 -01:00
Sebastiaan Janssen c67a76fb03 json2.js was not included in VS, so not in the build 2012-11-22 08:06:39 -01:00
Shannon Deminick 3d72a4497c Merge 2012-11-22 02:56:53 +05:00
Sebastiaan Janssen 30cc8e0861 Merge 2012-11-21 11:05:38 -01:00
Sebastiaan Janssen 30ca3f6df9 Bump the version to 4.11.0 2012-11-21 11:05:30 -01:00
Stephan cccfed6efe U4-1222 - improve alternate template consistency 2012-11-21 10:12:04 -01:00
Sebastiaan Janssen 82c148e997 Fixed U4-596 with thanks to firepol! 2012-11-21 09:50:47 -01:00
Sebastiaan Janssen c50a3e7a27 I broke the build, oh noes! Sorry. :-) 2012-11-21 09:46:04 -01:00
callicj@M2UA1450WRW.us.maritz.net 811cbe2339 Added new method to the Document Service named readPublished() which returns the published version of the document.
Added new method to the Document class named GetPublishedVersion() which returns the published version of the document.
2012-11-21 08:03:53 -01:00
ksykora@ksykora-Win7 a8bf881ae1 * Fixed an umbraco bug where the macro editor, if it tried to enumerate over a
property whose value was null, would throw a null reference exception instead
 of just ignoring the property.
2012-11-21 07:53:29 -01:00
ksykora@ksykora-Win7 c446be734c Moved ParseMacros from Init into Load in ItemRenderer to fix an issue where the
NodeId property on the Item control was being set after the ItemRenderer had
already loaded it into memory.
2012-11-21 07:54:17 -01:00
Morten Bock f0f7f6af55 Include some missing files 2012-11-21 07:23:15 -01:00
Shannon Deminick 19bd8ae193 Fixes overloads for TypedMedia, TypedContent, Content, Media calls on UmbracoHelper now that
GetPropertyValue returns 'object'
2012-11-21 09:09:37 +05:00
Shannon Deminick 81d8f74e0d Small update to hashcodecombiner and pluginmanager 2012-11-21 08:39:10 +05:00
Shannon Deminick 0011d568c6 Fixes up HashCodeCombiner with correct long field intead of int with correct initialization.
Adds App_Code and global.asax to be monitored for changes to create the hash code.
2012-11-21 08:28:11 +05:00
Shannon Deminick 159718bf4f Updated sln to use Nuget for ClientDependency references, ensures that all config changes
are backward compatible. Have updated the new ClientDependency.config file with the new
features, though these are not required for existing installs but we should advise to merge
the new changes in.
Added ClientDependency.Core.Mvc to the UI project so that it will now ship with this library.
2012-11-21 08:01:23 +05:00
Shannon Deminick b9ff3ca729 updated proj references, was getting warnings in build that they could not be referenced. Might be a VS 2012 thing. 2012-11-20 07:41:12 +05:00
Shannon Deminick 4f3ac36d7f Merge 2012-11-19 19:57:23 +05:00
Shannon Deminick a9257ad366 Fixes #U4-1213, much better support for ignoring routes in route table. Fixes issue with LogHelper. Adds unit tests
for ignoring routes.
2012-11-19 19:56:52 +05:00
Sebastiaan Janssen 2218459877 Correcting the path for the targets file, should work now even if there are spaces in the path 2012-11-19 08:59:23 -01:00
Sebastiaan Janssen 8f5e2946d6 Merge 2012-11-19 08:10:16 -01:00
Sebastiaan Janssen 19c3b251a0 Include the VS targets file so that the build server can find it as well 2012-11-19 08:09:43 -01:00
Shannon Deminick ce4c855f00 Fixes up the resulting casts when invoking extension methods dynamically in our dynamic objects. 2012-11-19 05:47:34 +05:00
Shannon Deminick 48c45447e4 Fixes: #U4-1207, Enhancements to DynamicXml (legacy and new), now implements proper IEnumerable<T> interfaces.
Added DynamicInstanceHelper for any dynamic object that should find matches on methods, properties and
extension methods. Fixed ExtensionMethodFinder to find the Enumerable extensions (was previously set to IEnumerable which would
find nothing).
2012-11-18 10:28:53 +05:00
Shannon Deminick 4683144987 Changed CacheHelper to be public so it can be exposed publicly by the app context. 2012-11-18 03:34:31 +05:00
Shannon Deminick 238a237cb5 Merge 2012-11-18 03:31:15 +05:00
Shannon Deminick cde1ca9f83 updated some logging on content class. 2012-11-18 03:31:02 +05:00
Shannon Deminick 93e2d8d822 added missing file for tests. 2012-11-18 02:49:55 +05:00
Stephan 8609389bdb U4-1198 - publish dialog does not detect that a parent is not published 2012-11-17 14:55:58 -01:00
Stephan 48f985b70a U4-1212 - can publish grand-child of unpublished node
fixed by introducing Document PathPublished property
2012-11-17 14:37:41 -01:00
Stephan b02afb3af8 u4-1186 - Manage hostnames UI bug with validators 2012-11-17 13:45:53 -01:00
Stephan b9d814c3fb (michielvoo pull request) Consitent new lines in templates 2012-11-17 13:28:38 -01:00
Stephan 1b54ce1d48 U4-1210 - ysod on rollback 2012-11-17 12:29:05 -01:00
Stephan e3efc0d19b U4-1194 - Mvc templates do not work when running in a virtual directory 2012-11-16 15:52:14 -01:00
Sebastiaan Janssen 3ba9e09164 Update obsolete messages to point to the correct classes (instead of being misleading) :-) 2012-11-16 14:41:30 -01:00
NielsHartvig@UMBRACORATI.localdomain d148c10c66 Update to sanitizer 2012-11-16 14:24:24 -01:00
NielsHartvig@UMBRACORATI.localdomain 2b573b9070 The BOSS is fixing U4-367 2012-11-16 14:08:28 -01:00
Shannon Deminick 4cb03ab36c Fixes issue with ChildActions when inherting from UmbracoViewPage<T> and using the @Umbraco helper. 2012-11-16 10:08:12 +05:00
Shannon Deminick 3ebbcc77e9 Merge 2012-11-16 00:45:29 +05:00
Shannon Deminick 8be97295dc Added new method to RenderMvcController for easier return of the current template when hijacking routes.
Added better error checking for media handling in MVC.
2012-11-16 00:38:03 +05:00
Shannon Deminick 3dd411f159 Working on #U4-1174, lots of updates/fixes to media in MVC regarding loading data from the examine cache to return media + lots of unit tests. 2012-11-15 21:46:54 +05:00
Shannon Deminick 8b141dc51a Working on #U4-1174, lots of updates/fixes to media in MVC + unit tests. 2012-11-15 20:11:10 +05:00
Stephan 278aa3f820 U4-1203 - UmbracoHelper.RenderMacro displays trace output at the wrong place 2012-11-15 13:41:44 -01:00
Shannon Deminick a7a38478db Working on #U4-1174 - issue with TypedMedia in MVC, fixes a few things and ensures Children() works
as expected, adds unit tests.
2012-11-15 04:18:23 +05:00
Shannon Deminick b2e004b825 renamed namespace in test proj 2012-11-15 02:04:46 +05:00
Shannon Deminick 10df6e878c updated config 2012-11-14 22:05:58 +05:00
Shannon Deminick eac11c1b80 cleaned up some of the install auth attribute 2012-11-14 21:22:30 +05:00
Shannon Deminick 0ad5da67ea Merge with 4.10.1 2012-11-14 21:18:34 +05:00
Shannon Deminick 3fb9ffca5b Update for installer rest service, updates version 2012-11-14 19:50:39 +05:00
Stephan 8e7fe5ee55 fix f3a3bdaf6329 2012-11-14 06:40:09 -01:00
Shannon Deminick 9554c6a1c6 Fixes #U4-1174 - allows MVC views to render when using RenderTemplate. Added new UmbracoHelper method RenderTemplate. Cleaned up some code and
ensuring that the string writers are disposed. Moved TemplateRenderer to a better namespace.
2012-11-14 10:47:40 +05:00
Shannon Deminick 8597876c92 Fixed up the library calls to RenderTemplate, no longer a ton of duplicated code and removed
the requirement to build up query strings as this is completley not required since we use 'preserveForm'
in the Server.Execute.
2012-11-14 09:31:20 +05:00
Shannon Deminick 3df7d81bde Fixed up the webforms url gen 2012-11-14 09:19:39 +05:00
Shannon Deminick f82ae4fdda Fixes: #U4-1174, this now works for all webforms related templates, however RenderTemplate will currently not work for
MVC templates... this will come soon. If you try to it will just throw a NotImplementedException.
2012-11-14 09:13:53 +05:00
Shannon Deminick 4a981225b3 Merge 2012-11-14 03:52:34 +05:00
Shannon Deminick 0cd115c268 Fixees: #U4-1166, automatically adds parsable routes in the route table to the reserved paths
so you don't have to explicitly add reserved paths to Umbraco config that you are creating routes for.
2012-11-14 03:32:50 +05:00
Sebastiaan Janssen 291b0582e4 Merge 2012-11-12 07:41:40 -01:00
Sebastiaan Janssen f4e48872a2 Imported pull request by Michiel van Oosterhout (consistent line endings)
Removed some commented out code
Pull: http://umbraco.codeplex.com/SourceControl/network/forks/michielvoo/UmbracoU4451/contribution/3482
2012-11-12 07:40:58 -01:00
Shannon Deminick 9e320700e2 Fixes: #U4-1178, adds another strongly typed overload to GetPropertyValue<T> and adds more unit tests. 2012-11-12 10:50:23 +05:00
Shannon Deminick 7f0ff70ca9 Fixes: #U4-1132, this is a bit of a hack fix because the Media should include creatorName/id but it doesn't. 2012-11-12 09:20:54 +05:00
Shannon Deminick 65e3b7f951 Merge 2012-11-12 08:24:36 +05:00
Shannon Deminick 156f145c69 Updated the build manager to find instances based on persisted cache of previous lookups but uses BuildManager to do so, after
some benchmark unit tests against loading a type from an assembly this is about 100% faster. Updated the UmbracoModule to write more diagnostics
for benchmark debugging. Have basically reduced the startup time to approx 50% of what it used to be based on the current
benchmarks run. Previously app startup on my machine was about 5 seconds, now after the first startup it is about 2.5 seconds.
2012-11-12 08:10:12 +05:00
clausjensen a0c941dac2 Fixes U4-1092 - TinyMce breaks script tags by double wrapping in CDATA on save 2012-11-11 09:50:42 -01:00
Bitmapped 33eb9d40f3 Catches exception thrown by native ActiveDirectoryMembershipProvider when there
is no current user.
Fixes U4-709
2012-11-11 09:40:48 -01:00
Sebastiaan Janssen cf8186653c Merge 2012-11-11 09:19:02 -01:00
Sebastiaan Janssen 75403d3b94 Fix by Tom Witherington - U4-1167 tags not saving or deleting in Tags data type
Also cleaned up the usage of obsolete method calls
2012-11-11 09:17:20 -01:00
Shannon Deminick 083bab0528 Added HashCodeCombiner and unit tests to support. Added ability to create a hashed file based on scanned assemblies in the
PluginManager and added a cached plugin xml file to the PluginManager. Now we don't actually scan any assemblies on app startup
during plugin finding if none of the DLLs have changed. Added trace statements to the UmbracoModule for better benchmarking for
how long a full request takes to load from start to finish.
2012-11-11 09:09:06 +05:00
leekelleher ee3e3787a8 PropertyEditorConverters - reusing TryConvertTo<T>, removing duplicate code. 2012-11-10 21:41:40 +00:00
leekelleher a3895ab149 Added unit tests for PropertyEditorValueConverters. 2012-11-10 21:40:37 +00:00
Matt@MBP13-PC c590c6a265 Fixes issue #U4-1169 wherby Umbraco.Field always runs in the context of the current page regardless of whether a custom IPublishedContent is passed in 2012-11-10 16:40:00 +00:00
leekelleher 6c1bf4b85f Added unit test for ObjectExtensions TryConvertTo<DateTime>.
Modified CustomBooleanTypeConverter to accept an empty string as a FALSE.
2012-11-10 14:09:27 +00:00
Sebastiaan Janssen 3632d6b0c6 Opened branch 4.11.0 2012-11-08 15:31:41 -01:00
Sebastiaan Janssen bf95792524 Merge with 4.10.0 2012-11-08 15:00:52 -01:00
Sebastiaan Janssen 885b421201 Closed branch 4.10.0 2012-11-08 14:48:26 -01:00
Sebastiaan Janssen b11143e2c4 Added tag Release-4.10.0 for changeset f6da531fbb4c 2012-11-08 14:46:56 -01:00
Sebastiaan Janssen 00a625fb7f Recursion was wrong on this one.
Fixed #U4-1147
2012-11-08 12:41:18 -01:00
jeavonleopold e9ae11ff2b U4-366 - AllowThousands for Integer property editor 2012-11-08 09:28:41 +00:00
Sebastiaan Janssen bd4e6eaa62 Merge 2012-11-08 11:30:10 -01:00
Sebastiaan Janssen b2e4489e66 Umbraco.Web.UI is now the first project in the solution file, so you won't have
to manually do "Set as startup project"
2012-11-08 11:22:28 -01:00
Sebastiaan Janssen d27e32e918 Medium Trust on by default in debug web.configs
Don't overwrite root web.config on each build if already exists
Should make F5-debug a lot easier
2012-11-08 11:17:21 -01:00
pgregorynz 3a6dae9d0d Merge 2012-11-08 01:06:59 -10:00
sitereactor 9f95c48242 Updating swedish language file. 2012-11-08 08:26:24 -01:00
Sebastiaan Janssen e2934bb036 Merge 2012-11-08 07:06:07 -01:00
Sebastiaan Janssen 664a0ff4ec Add MVC3 dlls to bin folder so that hosts don't have to have MVC installed
Fixed #U4-1137
2012-11-08 07:05:29 -01:00
sitereactor 715f0ddac1 Updating Chinese language files from github. 2012-11-08 06:56:55 -01:00
pgregorynz 4d5f142a30 fix for ItemRenderer.cs to work with Partials 2012-11-07 21:19:35 -10:00
Shannon Deminick f4dc045561 Removed MediaFileSystemExtensions and just added the methods to the MediaFileSystem which are more discoverable.
Added Code Annotations to all file system classes pointing to the new #U4-1156 tracking item to publicize.
2012-11-08 08:27:38 +05:00
Shannon Deminick ca55372f89 Merge 2012-11-08 08:12:33 +05:00
Shannon Deminick 29c96c2c64 Converted QuickSearch over to use correct codebehind 2012-11-08 08:12:24 +05:00
pgregorynz 1a969d76e1 Revert change to Umbraco Helper as caused issues with the itemRender not being
able to process fallback or formating options.
2012-11-07 15:20:19 -10:00
Shannon Deminick fba31a0a6a Added Code annotations for IPublishedContentStore, etc... as experimental features with links to the
tracker.
2012-11-07 10:16:36 +05:00
Shannon Deminick 5132d66924 Created code annotation attributes and descriptions 2012-11-07 09:55:21 +05:00
Shannon Deminick 36f367f9d6 Added a unit test to confirm any ctor of a custom typed file system 2012-11-07 09:40:33 +05:00
Shannon Deminick 67d9e578f5 Fixes: #U4-919, we will just use real classes for extension methods and all custom file systems like the MediaFileSystem must inherit from
FileSystemWrapper
2012-11-07 09:30:40 +05:00
Shannon Deminick 306f0f9679 Merge 2012-11-07 03:50:32 +05:00
Shannon Deminick b9d53ceac8 Fixes more of U4-1140, ensure that only legacy objects are returned from the dynamic stuff in the razor macros. Adds unit test for it. 2012-11-07 03:49:32 +05:00
Søren Reinke@Windows-7 1bceb746fa Switched to non obsolete method call 2012-11-06 20:32:26 -01:00
Søren Reinke@Windows-7 d390a4c0a9 Made speech bubbles for MediaTypes act the same as for DocumentTypes 2012-11-06 20:24:48 -01:00
Søren Reinke@Windows-7 e4f8b5c586 Deleting a Tab now removes it from the list in the browser 2012-11-06 19:21:41 -01:00
Sebastiaan Janssen 869915f991 Updated to the Medium Trust-safe version of SQL CE SP1
(assembly version 4.0.0.0 instead of 4.0.0.1)
2012-11-07 12:12:57 -01:00
Sebastiaan Janssen 0cb4a9ad9c Fixes issue where upload will fail in medium trust due to use of FileInfo
Related to earrlier fixes for U4-919
2012-11-07 09:28:08 -01:00
Sebastiaan Janssen 8c7dbd7207 Merge 2012-11-06 09:50:28 -01:00
Sebastiaan Janssen 0110cf01f2 Removed unused variable that was causing problems, cleaned up the code a tiny bit
Fixed #U4-1119
2012-11-06 09:49:27 -01:00
Stephan fee1a0dd9e fix broken CreateXPathQuery in legacy requestHandler 2012-11-06 07:09:54 -01:00
Shannon Deminick 315e8b27a0 Migrated loadStarterKitDesigns to use the new codebehind structure. 2012-11-06 09:14:39 +06:00
Shannon Deminick fb0c9c3fbb Changed DynamicXml to public (somehow this wasn't checked in before) #U4-U4-1146
Added unit tests for DynamicXml.Find methods which are passing.
2012-11-06 08:32:21 +06:00
Sebastiaan Janssen 0df1ebb83e Merge 4.9.1 into default 2012-11-01 07:12:47 -01:00
Sebastiaan Janssen 204d7a79aa Closed branch 4.9.1 2012-11-01 07:10:42 -01:00
Sebastiaan Janssen e68629b8bc Added tag Release-4.9.1 for changeset 8d7d8609e2e4 2012-11-01 07:10:31 -01:00
Matt Watson f80fa2f373 Datatype Tags, multiple render when multiple instance on same doctype
Fixed #U4-915
2012-10-31 21:51:17 +00:00
Sebastiaan Janssen 55ac779bf2 Changed the Chines language files to have a zh prefix in the key instead of en.
Now the chinese translation files actually work.
Fixed #U4-1126
2012-11-05 10:07:51 -01:00
Sebastiaan Janssen f8732cd70b Removed the ExportCode dialog as it's not needed any more now that L2U is gone. 2012-11-05 09:19:20 -01:00
pgregorynz ff5c5c8a03 Relates to bud U4-1142 Umbraco helper in wrong context with used in a Partial.
Fix to context of Umbraco helper when used in partials.
2012-11-04 21:24:04 -10:00
Shannon Deminick 7df9921441 Fixes: #U4-1142, Changed ctor for RenderModel so people can actually create one to pass in to their views if they want.
Changed the way that UmbracoTemplatePage works in that if you pass in an IPublishedContent model instead of a RenderModel,
it will be generated for you without a YSOD. Changed the UmbracoHelper ctor so that it can be passed a custom IPublishedContent model
so that it's context is of that model and not the one routed to. Added Umbraco.Web.Mvc to the imported namespaces for Views.
2012-11-05 11:27:28 +06:00
Shannon Deminick 329431e6df Fixes: #U4-1141 - IPropertyEditorValueConverter is not a plugin type and is searched for on app startup. 2012-11-05 06:14:44 +06:00
Shannon Deminick 292ded852e Changed IPropertyEditorValueConverter to public #U4-1141
Changed the /umbraco folder in the UI project to be properly cased according to VS (this is initial, we need to
do this for everything but need to write a script, see https://groups.google.com/forum/?pli=1#!topic/umbraco-dev/_KDTHpPPFM8 )
2012-11-05 06:04:40 +06:00
Shannon Deminick a4a9b26d93 Committed first tests of strongly typed querying with strongly typed document types using what would be generated code and extension methods. 2012-11-04 09:24:24 +06:00
Shannon Deminick e4d4aa935a fixed attempt to initialize it's False property, changed IPublishedStore back to internal... was my mistake to make this public just yet. 2012-11-04 08:56:50 +06:00
Shannon Deminick b337f4e5e4 Fixes issue with installing starter kits in the back office after upgrading the installer to install
the starter kits properly. Not sure if this was actually working before 4.10 but in any case does work again
now and installs them the correct way whilst waiting for the app pool to restart (we need to put this in place
for the normal packages too!). Upgraded the StarterKits.aspx to have the correct code behind structure. Fixes issue
with missing or invalid referenced images.
2012-11-03 07:18:12 +06:00
Shannon Deminick 6f5689004d Fixes: #U4-1113 2012-11-03 05:48:23 +06:00
Sebastiaan Janssen ed5a0be20e Merge with updated language files 2012-11-02 09:32:54 -01:00
Sebastiaan Janssen 4e82d282bf Cleaned up and updated the web.Template.config before release
Also reformatted in hopes to keep the formatting consistent between releases from now on
2012-11-02 09:32:20 -01:00
sitereactor fe003edd02 Adding language files from github localization repo. 2012-11-02 09:23:59 -01:00
Sebastiaan Janssen 17f326dc89 Enable relationtypes tree in release version as well 2012-11-02 08:52:12 -01:00
Stephan 2c38f7ce7f fix BaseRest config management - would throw when missing config files 2012-11-01 16:46:04 -01:00
Sebastiaan Janssen 3ba31cc82c Fixed breaking change: method signature of Template.MakeNew changes when you add
optional params, breaking uSiteBuilder.
2012-11-01 12:51:46 -01:00
jeavonleopold e502ce4ff9 U4-1112 - Add Any() property to DynamicXml 2012-10-31 10:47:04 +00:00
Shannon Deminick 8fff66dcb7 Merge 2012-10-31 20:48:50 +06:00
Shannon Deminick bc47e0c4a6 Fixed the get enumerator method in the legacy DynamicXml so that it still returns the legacy class instead of the new one. 2012-10-31 20:42:06 +06:00
Shannon Deminick 85c110bad5 missing changed file 2012-10-31 11:46:02 +06:00
Shannon Deminick 8866607582 changed milliseconds to seconds 2012-10-31 11:43:14 +06:00
Shannon Deminick 0db6c2cc11 Fixed issue that locally declared SurfaceControllers are routed through 'umbraco' area, this should not have been the case.
Created new CacheHelper which replaces the old Cache class and is accessible via the UmbracoContext.
Added new CachedPartial extension method to be able to cache the output of your partials (also by page and by member)
Added mew CacheHelperApplicationEventListener in order to automatically clear the partials cache when content is published, media or members is saved.
2012-10-31 11:36:22 +06:00
Sebastiaan Janssen 84858bea65 Move the Umbraco.Web.UI project up to the first position in the .sln file so
that when you first clone the project and hit F5 it will actually start the
correct project (and not the class library)
2012-10-30 15:27:59 -01:00
Shannon Deminick c3795d7e5a Added some code comments and did a check for redirects (returns null if this is the case) 2012-10-30 06:49:36 +06:00
Shannon Deminick 36eea348ba changes the fix for U4-1097 to use an InvariantEquals instead of a direct equals just in case! 2012-10-30 06:23:29 +06:00
Stephan be3f95610b U4-1081 - treat missing template at 404 2012-10-29 12:35:39 -01:00
Stephan f9aa4b28af U4-889 - cancelling publish via an event caused a JavaScript error 2012-10-29 07:48:45 -01:00
Stephan 232c2292cb U4-1093 - fail to publish a node w/new content type
the way we added the new content type to the schema just could not work
also, stop reloading the whole XML from DB because the schema changes
2012-10-28 19:35:19 -01:00
Stephan 80dca1e3f2 U4-1089 - non-ascii chars in urls cause 404 2012-10-28 11:58:48 -01:00
Stephan 47b6f7f4d5 fix U4-1087 : preview badge does not show 2012-10-28 10:58:56 -01:00
pgregorynz 03af54b1d5 Merge 2012-10-25 14:21:16 -10:00
Casey Neehouse bbd62f20a9 Corrects a couple minor issue with Directory support when mapped to a
Virtual Directory and network shares.
2012-10-26 04:19:14 +04:00
pgregorynz 9738227189 Making the CTOR for UmbracoHelper public so it can be newed up for other uses 2012-10-25 14:18:53 -10:00
Shannon Deminick 6bf3a7a74a Merge 2012-10-26 03:01:21 +05:00
Shannon Deminick 07f8f79620 Fixes: #U4-1077, found an bug with both our code and Microsoft's code in that if you RemapPath with an incorrect URL which contains
2 '?' the internals of ASP.net actually force a secondary internal request which causes BeginRequest to fire but doesn't follow the normal
chain of the module. It was a bug with our code having two query strings, however its pretty strange behavior on their part!
Have removed UmbracoContext.ClientUrl since it is not necessary to have. Have renamed UmbracoContext.UmbracoUrl = CleanedUmbracoUrl and UmbracoContext.RequextUrl = OriginalRequestUrl
Have moved the route processing logic to a static method on PublishedContentRequest which auto assigns the request back to the UmbracoContext, plus this is a cleaner
way to do the processing, including allowing us to unit test this one aspect.
Lastly, we are now rewriting the path back to the original URL in the RenderRouteHandler so that in MVC controllers the HttpContext.Request actually
reflects the URL that the client requested, not the rewritten URL (we do this in webforms too)
2012-10-26 02:55:57 +05:00
Ismail Mayat f0690ec55f U4-1069 localize file umbraco.web.ui\umbraco 2012-10-25 14:47:00 -01:00
Tom Fulton e4bfccf974 U4-1057: Add localization of 'relate copied items' text 2012-10-25 19:42:16 +04:00
Hendy 51d08a353c U4-1084: media file links now updated after save 2012-10-25 14:33:50 -01:00
Hendy 982825dd56 Merge 2012-10-25 14:01:14 -01:00
NielsHartvig@UMBRACORATI.localdomain c8c4e2437b Implements U4-1022: Request: Disable Canvas mode by default 2012-10-25 13:00:31 -02:00
Hendy 1970b20eb9 Merge 2012-10-25 14:00:10 -01:00
Hendy a5499cff26 U4-1080 - updateDate value for media item pulled from it's xml fragment (as only verison in db for media is the created version) 2012-10-25 13:59:48 -01:00
Ismail Mayat d9c37a03b9 U4-989 Editing Macro Scripts should force any attached macros to refresh their cached code 2012-10-25 13:48:44 -01:00
Tim@MiniNinja e17b93bcfe Fixes issue U4-872 2012-10-25 14:04:32 -01:00
Stephan 6ffc231be0 bugfix UriUtility when running in a virtual directory 2012-10-25 12:28:33 -02:00
Tim@MiniNinja 99d8aca0c5 Fixes U4-864 also fixes similar issues for:
Xslt
Javascript
Stylesheets
Scripting Files
Macros
If file exists, will redirect to existing file instead of cretaing new
2012-10-25 13:24:44 -01:00
Sebastiaan Janssen 3c2ac0e90e Include new files for U4-858 Default icons for Media Types 2012-10-31 12:03:52 -01:00
AnthonyCogworks@Anthony-PC 7af10e3b67 Issue : http://issues.umbraco.org/issue/U4-858
Fixed media thumbnails for SQL CE
2012-10-25 14:00:33 -01:00
Stephan 62a48df421 bugfix NiceUrlProvider when running in a virtual directory 2012-10-25 12:14:21 -02:00
Hendy f146b8f6af Merge 2012-10-25 11:30:56 -01:00
NielsHartvig@UMBRACORATI.localdomain 946f905885 Fixes U4-1079, Installer database step gives no error on failure 2012-10-25 10:30:08 -02:00
Hendy 707eca930f U4-430 - saving a media item now updates the udpated date in the xml 2012-10-25 11:27:12 -01:00
Stephan e4a002c976 properly cleanup views/masterpages when changing the type of a template 2012-10-25 09:34:02 -02:00
AnthonyCogworks@Anthony-PC e731afadc9 Issue : http://issues.umbraco.org/issue/U4-858
Fixed media thumbnails for SQL Server, MySQL, & Azure
2012-10-25 10:23:53 -01:00
Tom Fulton a006a480f7 U4-855: Small update to allow Preview to work when pasting custom source, and fix Insert not highlighting right away if ctrl+v 2012-10-25 18:14:11 +04:00
Tom Fulton 674923468d U4-855 Embed Media - allow inserting custom HTML into Source tab 2012-10-25 17:52:50 +04:00
Sebastiaan Janssen afafcfbb7a Merge 2012-10-31 10:32:58 -01:00
Matt@MBP13-PC c489d910b8 Fixes issue #U4-322 "Custom section name is the name of the previous section" by passing through the app alias to shitApp if no key is found in uiKeys 2012-10-31 11:31:08 +00:00
Sebastiaan Janssen 6e226ef995 Update the tinyMCE release config as well for U4-717 and u4-1006 2012-10-31 10:11:02 -01:00
AnthonyCogworks@Anthony-PC 0b1c479428 Case: http://issues.umbraco.org/issue/U4-715
Removed 2nd call to cleanPropertiesOnDeletion(_contenttypeid); in PropertyType.delete()

Replaced multiple calls to db to get all documentTypes.
2012-10-25 13:35:47 -01:00
AnthonyCogworks@Anthony-PC 3f2ca8a823 Case: http://issues.umbraco.org/issue/U4-648
Fixed issue in CMSNode where Parent was being set twice.
The issue was due to logic in Move(CMSNode newParent).
I renamed the parameter to newParent as it is more clear.
Changed the logic to check againse ParentId, rather than Path, and deleted
the redundant assignment to Parent.
2012-10-25 14:55:46 -01:00
Tom Fulton 78d57e89d5 U4-408: Prevent dragging of toolbar icons by adding onmousedown="return false" 2012-10-25 16:36:21 +04:00
Tom Fulton d9049864f3 U4-395: Fix RTE in Members section (add ValidateRequest = false) 2012-10-25 19:21:46 +04:00
Hendy 21632d2ffc Merge 2012-10-25 10:14:50 -01:00
Hendy da3d20a5bb ImageCropper property alias now set via a drop down of all available aliases, and a safety check on the dataeditor to ensure the selected property was found 2012-10-25 10:14:24 -01:00
Anders Burla Johansen c0f0dcca3a Fixed some attributes in tinyMCEConfig.config U4-717 and U4-1006 2012-10-25 09:02:33 -02:00
Tom Fulton 22f7d8797c U4-377: Fix exception when attempting to access Value externally during a new dictionary item creation 2012-10-25 14:47:29 +04:00
Tom Fulton 25da44825e U4-377: Add code from michielvoo's pull request (trigger the dictionaryitem.saving event from dictionaryitem.setvalue() by calling
its Save() method.)
2012-10-25 14:46:12 +04:00
Sebastiaan@SEBTHINK 55d4a7e367 Merge 2012-10-25 08:53:41 -02:00
NielsHartvig@UMBRACORATI.localdomain 33e73ab965 Fixes U4-802, MacroEngine should sort the built in engine first 2012-10-25 08:37:55 -02:00
NielsHartvig@UMBRACORATI.localdomain 05db49c66d Merge 2012-10-25 07:56:34 -02:00
NielsHartvig@UMBRACORATI.localdomain 4cf2035039 Fixes U4-862, Hide Preview Button and "Link to Document" on content nodes that are not intended for display (e.g., those that have no templates) 2012-10-25 07:55:34 -02:00
Hendy 27f059bf58 Merge 2012-10-25 08:53:11 -01:00
Hendy aee8730315 Bugs: U4-902 & U4-366
Prevalue field removed from the integer datatype & regex validation now fires
2012-10-25 08:51:38 -01:00
Ismail Mayat b517d59bee U4-998Saving a User Type - speech bubble says "User Saved" 2012-10-25 08:38:25 -01:00
Ismail Mayat e4f3081da2 U4-998 Saving a User Type - speech bubble says "User Saved" 2012-10-25 08:21:47 -01:00
NielsHartvig@UMBRACORATI.localdomain 5cca506d20 The new Template.GetByAlias with optional useCache parameter breaks bw compat as method signature changes. Adding an overload and removing default value on overload 2012-10-25 07:13:34 -02:00
Shannon Deminick e3f9375fd2 changes template creator to use new UmbracoTemplatePage class instead of RenderViewPage 2012-10-24 11:10:27 +05:00
Shannon Deminick cbd8085675 Merge 2012-10-24 11:06:31 +05:00
Shannon Deminick a9d6c7872a Changed the PublishedContentRequestBuild to use the cached template lookup instead of going to the db each time,
added caching to the business logic template class's GetByAlias method. All of this will save db queries for each request meaning even
faster rendering. Fixed GetTemplateAlias extension method to use the correct Template class with caching.
2012-10-24 11:02:36 +05:00
Shannon Deminick d4d4272b1b Moved RenderModel to Models namespace. Created new base UmbracoViewPage to use for umbraco partial views, etc... and renamed
RenderViewPage to UmbracoTemplatePage which now inherits from UmbracoViewPage. Added NiceUrl and NiceUrlWithDomain as extension
methods to IPublishedContent.
2012-10-24 09:59:23 +05:00
Sebastiaan Janssen e9aef79747 Member search didn't work
#U4-643 Fixed
2012-10-23 18:38:27 -02:00
Sebastiaan Janssen 3b5a1ddcdd Fixed the build, forgot to remove file reference from the csproj file 2012-10-23 14:52:58 -02:00
Sebastiaan Janssen 14ad9f571c Upgrade to TinyMCE 3.5.7 2012-10-23 13:32:21 -02:00
Sebastiaan Janssen 258d19df22 Remove Container DocTypes for now 2012-10-23 10:40:22 -02:00
Stephan 8261fa2aea fix package installer, use encodeURIComponent() vs escape() to support utf8 2012-10-23 09:37:33 -02:00
Stephan c434790b2f do not validate input when live editing to support RTE 2012-10-23 09:05:57 -02:00
Sebastiaan Janssen 4397319ac3 Add z-index too treePickerToolTip to get it on top when media picker preview is on 2012-10-23 08:24:33 -02:00
Sebastiaan Janssen 7309c7c02f Templates that have a space in the alias will be created without spaces in the
file name, when determining if the template exists, remove spaces from the alias
2012-10-22 10:36:54 -02:00
Sebastiaan Janssen 12e9ab050a Rewrite some more references to the tabId column and cmsTab table 2012-10-22 08:29:18 -02:00
sitereactor d0fd7c1374 Merge 2012-10-22 05:59:20 -02:00
sitereactor f7ccad4269 Updating language files with updates from github 2012-10-22 05:58:42 -02:00
Sebastiaan Janssen 1bf20b9c97 Update the version tests for mysql installer 2012-10-22 05:27:47 -02:00
Sebastiaan Janssen f03d861942 Updated MySql update script for 4.10.0 2012-10-21 11:47:01 -02:00
Sebastiaan Janssen c0eb3e256b MySQL total script updated for 4.10.0 2012-10-21 11:31:32 -02:00
Sebastiaan Janssen 41d7571e29 Merge 2012-10-21 11:08:57 -02:00
Sebastiaan Janssen c2f420be7a Fix issue where installer would not create properties on the media types because
it was trying to put information in the tabId column that's no longer there
2012-10-21 11:07:48 -02:00
Stephan b0e083e8fc refactor nice urls in editContent (U4-1017 and other issues) 2012-10-19 08:50:49 -02:00
Sebastiaan Janssen 04197a5900 Updated query to tabId to use propertyTypeGroupId instead, removed unreachable code 2012-10-18 11:39:38 -02:00
Sebastiaan Janssen d2fd02315a Fix skin configurator in Chrome not working after install.
SORRY for the commit to both files, still need to dive into the ASCX seperation
2012-10-18 07:46:46 -02:00
Sebastiaan Janssen f654c67540 Fix skin configurator in Chrome not working after install. 2012-10-18 07:41:24 -02:00
Sebastiaan Janssen 9b28214c3e Merge 2012-10-18 06:44:20 -02:00
Sebastiaan Janssen 6a665efd7e Styles dropdown is not updated when styled text is highlighted in the rich text editor
#U4-659 Fixed
2012-10-18 06:41:16 -02:00
Shannon Deminick 5aee883bd2 Added TypedSearch methods to UmbracoHelper and Search extension methods to the IPublishedContent.
Added GetTemplateAlias() extension method to IPublishedContent and to DynamicPublishedContent.
2012-10-18 08:00:07 +05:00
Shannon Deminick c0f7493e70 Merge 2012-10-18 07:17:20 +05:00
Shannon Deminick 7d8524dd55 Added additional namespace imports for MVC views in the views web.config. 2012-10-18 06:55:41 +05:00
Sebastiaan Janssen 4c667a6a3e Set web.config output to none because it might not exist when running automated
builds like build.bat or teamcity
2012-10-17 06:11:31 -02:00
Shannon Deminick ce06a30e64 added additional timeout to installer to ensure DOM is updated before redirecting. 2012-10-17 09:28:02 +05:00
Shannon Deminick 1be891d05f Added Thread.Sleep hack during package installer to attempt to always fluke out that the app pool will be restarted after redirect.
Currently this has worked in the past but only by fluke, this hack just makes the fluke probably work more often. In the next release we'll
need to refactor the package installers (there are about 7 instances of them in the codebase) to all use the same ajax methodology to ensure
that the app pool is restarted properly (which is now done properly during the install process).
2012-10-17 08:51:58 +05:00
Shannon Deminick e85f594b84 Fixed issue with trees not showing up for some packages, was issue with PluginManager caching between finding global types or finding types with specific attributes.
In this case, we were finding attributed trees only which was cached against the type of ITree, then we were looking for all ITrees but previously we cached finding ITrees
but the cache value was only the attributed ones.
Removed the caching of some plugin finding since they are only found once and there's no reason for the additional mem overhead.
2012-10-17 08:44:32 +05:00
Shannon Deminick a3278be3fe updated .ignore again with casing 2012-10-17 07:31:01 +05:00
Shannon Deminick 90aa8c3b5a reverted web.config back to standard (without user defined values) and added it to .ignore so that
user changes don't keep changing it and 'forgot' it in the source control.
2012-10-17 07:30:08 +05:00
Shannon Deminick ea217edaae Merge 2012-10-17 07:25:15 +05:00
Shannon Deminick 3cf9a45724 Finalized initial refactor of package installation for the installer, ensures the app pool is properly restarted
before installing Business Logic.
2012-10-17 07:08:35 +05:00
funka@WETWIRED 38fc6c980d Resolves redundant BaseTreePicker script initialization (U4-192) 2012-10-17 05:36:22 +07:00
Shannon Deminick cc34208871 More work on installer update for packages, nearly there. 2012-10-16 03:12:16 +05:00
Shannon Deminick 6f778c26d1 Initial commit of refactoring of package installer for the installer process. Converted a few webforms pages/controls to the new format, created
new JS class to manage the installation, created new MVC controller for managing the ajax installation
2012-10-16 01:33:35 +05:00
Sebastiaan Janssen 29b978c1cd Fixes issue where scrubbing the log would fail because of wrong datetime format 2012-10-15 12:11:31 -02:00
Sebastiaan Janssen 346a2d4fc9 Whoops, logging a little bit too much now, should only log errors 2012-10-15 11:38:15 -02:00
Sebastiaan Janssen 02cc7e69ec Merge 2012-10-15 07:03:29 -02:00
Sebastiaan Janssen acb66f45ac Change query to use propertyTypeGroupId instead of tabId (which has been renamed) 2012-10-15 07:03:12 -02:00
Sebastiaan Janssen 487fdea34e Logging for the datalayer now properly uses the LogHelper in Umbraco.Core 2012-10-15 07:02:29 -02:00
Shannon Deminick 0e0c4fcb1f Fixed an issue with unit tests and not resetting settings. 2012-10-14 08:11:49 +05:00
Shannon Deminick f7868b2cf1 Updated some of the Object resolver code, adds new protected AddTypes method, renamed method on Legacy resolver.
Fixes yet another issue with templates and package installs.
2012-10-13 10:59:21 +05:00
Shannon Deminick 0368f2846e Removed erroneous logging on plugin manager. 2012-10-13 09:26:30 +05:00
Shannon Deminick ee94652a0c Added unhandled exception logging. Added error checking to the DataTypeDefinition class... trying to
pinpoint where/when this bug occurs.
2012-10-13 08:49:44 +05:00
Shannon Deminick a1da12f033 Fixed SQL and CE installer to have the proper version spec queries... only by pure fluke did it ever work for 4.8! Argh!
Modified the CE one so that it is consistent with the Sql one, we should be relying on the same scripts here (or at least the same logic)
the one for CE will not work because even if the db is not installed it would have still returned 0 which would pass and the installer would have
thought it was installed.
2012-10-13 07:05:11 +05:00
Shannon Deminick ea406d2d7c Fixed SqlServer and CE installers to flag their latest available install version as 4.9, looks like MySQL hasn't been done yet
so have left it's installer flagged as 4.8 (just means that the intall will just hang... not sure why we have this flag anyways??
shouldn't we always support the latest version for all dbs??)
2012-10-13 06:43:24 +05:00
Sebastiaan Janssen 093a33e495 Fixed last setup/teardown problem for SQLCE in the unit tests 2012-10-12 15:05:07 -02:00
Sebastiaan Janssen 7a4ccc825d Only reset the DataDirectory path after clearing the database, else it will
never clear as it can't find a database at path null
Updated PublishedContentTests with correct amount of expected results
2012-10-12 14:45:13 -02:00
Sebastiaan Janssen a22efcdb2b Renamed datalayer loghelper to TemporaryLogHelper so it will stand out like a sore thumb 2012-10-12 13:29:27 -02:00
Sebastiaan Janssen 1b71c66256 Corrected some of the counts in PluginManagerTests so we can see why they start
failing when they do start failing again (upon inspecton of the returned
collections the current counts seem to reflect reality)
2012-10-12 12:45:31 -02:00
Sebastiaan Janssen f6c51205fc Re-include splitbutton.js 2012-10-12 11:41:29 -02:00
Sebastiaan Janssen d45b5a3139 Re-include ItemEditing javascripts 2012-10-12 11:09:32 -02:00
Sebastiaan Janssen 15dd774229 The ISNULL function is not supported in SQL CE, changed to COALESCE 2012-10-12 10:15:18 -02:00
Sebastiaan Janssen b248604c0f Added logging to SqlHelper to debug install/upgrade and find obsoleted queries 2012-10-12 10:14:54 -02:00
Sebastiaan Janssen f01a195369 Updated total.sql for SQL CE - Installs with CE from scratch work again
Upgrade detection from 4.9 > 4.10 added
UNTESTED: Upgrades from 4.9 > 4.10 should perform the database upgrade now
2012-10-12 10:13:50 -02:00
NielsHartvig@UMBRACORATI.localdomain 75af1e9d7c Merge 2012-10-12 05:39:31 -02:00
Shannon Deminick 689fe2a44f Fixes issue with wrapping the UmbEditor init in doc ready causing template editing not to work. 2012-10-12 09:15:33 +05:00
NielsHartvig@UMBRACORATI.localdomain 06519ab238 Fixes U4-1018. 2012-10-11 11:38:11 -02:00
Sebastiaan Janssen 65d5bc9155 Change from enableMvcSupport to defaultRenderingEngine in the release config too 2012-10-11 08:42:20 -02:00
Casey Neehouse a3b87a1d8b Wraps Code Editor initialization in a document ready call to correct an IE7
sizing bug.
2012-10-11 13:02:36 +04:00
Shannon Deminick b6f7d99039 Fixed why all the unit tests were failing. Ported over a couple of unit tests from the legacy test project to see how
easy it would be and it looks pretty easy, just need the propery initialization data for the tests. Currently ported over the
Dictionary biz logic tests.... most fail but pretty sure it's due to init data.
2012-10-11 08:32:06 +05:00
Shannon Deminick c1aa60c1ac Merge 2012-10-11 07:55:00 +05:00
Shannon Deminick a2988a30c0 updated ignore. Fixed issue when media is not found and YSOD is displayed. 2012-10-11 07:54:04 +05:00
Casey Neehouse 23f2382947 Merge 2012-10-11 03:03:38 +04:00
Casey Neehouse 4d94909782 Folder Browser Enhancements - IE 7 Thumbnail list CSS corrections,
Added labels to the thumbnail size setter,
Capture/cancel the return key on the filter textbox.
2012-10-11 03:00:28 +04:00
Shannon Deminick 422a2a685c Fixes: U4-1015, U4-1014 2012-10-11 03:42:18 +05:00
Shannon Deminick c4f1235f0b Fixes issues with ApplicationRegistrar and ApplicationTreeRegistrar during install, they now check if the
application is configured, if not then they exit otherwise exceptions will be logged every time the app starts during install.
Added a log on application end with the reason for shutdown and nicer methods to override in global.asax.
2012-10-11 03:02:23 +05:00
Shannon Deminick ce4828d678 Fixes HasContent if there is actually no content (new install).
Fixes issue with TreeDefinitionCollection not initializing when accessing singleton... not sure how i overlooked that before. This fixes
issues with MNTP initialization and probably some other tree stuff.
Removes warning log in umbracomodule for not a document as this just takes up space in the log.
Fixes issue with logger that was logging 'Info' for our internal Debug calls.
2012-10-11 02:30:48 +05:00
Shannon Deminick 8e914e751c Fixes: U4-1013 - editing a View file in template edit ensures no duplicated files. 2012-10-11 00:46:19 +05:00
Shannon Deminick 7fefde4c8a Fixes: U4-1011, YSOD is generated if any created/installed packages files exist but they are empty. 2012-10-10 23:44:42 +05:00
Shannon Deminick 29614d6b03 Fixes: U4-1010, U4-1009 -> issues relating to template business logic changes which checks for default rendering engine (MVC vs WebForms) and fixes package
installation issues associated with them.
2012-10-10 23:31:54 +05:00
Shannon Deminick 16b47539b4 Fixes up an issue relating to U4-1010 but is only the initial fix, now need to look at the changing
the package installation process to ensure the templte files are there before the template db entries.
2012-10-10 22:33:49 +05:00
Shannon Deminick 83c53333c6 Removed GetDictionaryValue from RenderViewPage, this can be accessed through the @Umbraco property. 2012-10-10 20:45:51 +05:00
Shannon Deminick 77db6cad01 Fixes issues with last commmit. Fixes: U4-786 - made some things public 2012-10-10 20:44:29 +05:00
Shannon Deminick a10daaab52 Updated code from code review 2012-10-10 20:20:16 +05:00
Shannon Deminick 3ddb9785c7 added missing codebehinds. updated ignore file. 2012-10-10 20:04:11 +05:00
Sebastiaan Janssen 585eea1c6b Merge 2012-10-10 11:03:27 -02:00
Sebastiaan Janssen 10095a4ee7 Upgrade to CodeMirror 2.34 2012-10-10 11:02:59 -02:00
Shannon Deminick 8f4ccc53d5 Merge 2012-10-09 20:17:51 +05:00
Shannon Deminick f04db8c52c Converted umbracoPage.master to have the correct codebehind structure. Added base2 as a default lib in umbracoPage.
Converted EditView to use propery JS class so that we can now better support the editor for the new buttons (i.e. insert macro, etc...)
2012-10-09 20:17:27 +05:00
Sebastiaan Janssen e2283c2310 Made CodeMirror 100% height again 2012-10-09 12:25:36 -02:00
NielsHartvig@UMBRACORATI.localdomain 635f09fb75 Updates new Total.Sql for SQL Server to match the 4.10 db schema.
IMPORTANT: If you upgrade a previous 4.10 dev site, make sure to run the 'src\umbraco.datalayer\SqlHelpers\MySql\Sql\Version4_8_Upgrade.sql' script
IMPORTANT v2: The DB updates haven't been ported to SQL CE and MySQL yet, so they'll currently BREAK!
2012-10-09 06:56:18 -02:00
Shannon Deminick 9022894d23 Changed EnableMvcSupport config section and classes to be: DefaultRenderingEngine which uses an enum.
Added a real handy Enum<T> class for parsing/traversing enums.
2012-10-09 02:42:09 +05:00
Shannon Deminick 747675816d Changed editMacro over to use the correct codebehind structure. 2012-10-08 23:57:27 +05:00
Shannon Deminick 2833a8c5c7 Changed editTemplate over to use the correct codebehind structure 2012-10-08 23:52:37 +05:00
Shannon Deminick 75a686bc07 Changed umbracoDialog.master to have correct codebehind structure. 2012-10-08 23:46:49 +05:00
Shannon Deminick 76a521dd8b fixes script manager reference 2012-10-08 23:36:25 +05:00
Shannon Deminick 8fa36f3f22 Converted UmbracoField to use JS class Umbraco.Dialogs.UmbracoField.
Adds base2 lib o the default umbracoDialog.Master.
2012-10-08 23:32:43 +05:00
Shannon Deminick 18aef90017 Merge 2012-10-08 21:55:16 +05:00
Shannon Deminick 82bb410f4f Changed @Model.CurrentContent to @Model.Content, updated some ext methods for IPublishedContent. 2012-10-08 21:55:03 +05:00
pgregorynz caa937a4ef Updates to ViewEditor. Insert Page Field, Insert Dictionary Item,
Master Template Selector
2012-10-08 06:05:07 -10:00
pgregorynz d7103a3b83 Merge 2012-10-08 05:57:57 -10:00
pgregorynz e555520ddf Insert field Views. 2012-10-08 05:40:55 -10:00
Morten Bock a71961c35b Indenting 2012-10-08 13:33:18 -02:00
Niels Hartvig ed3f715988 Container Document Types 2012-10-08 11:53:35 -02:00
Casey Neehouse 26aca92337 Updates to the Change password dashboard UI - better language and corrected the
validation. Related to comments in issue U4-914.
2012-10-09 03:33:55 +04:00
tg@umbraco.com 406e3663f6 Merge 2012-10-08 08:43:38 -02:00
tg@umbraco.com 775b2192ff Fixes U4-680: insert Macro split buttons not working 2012-10-08 08:42:47 -02:00
PerPloug 458de6296e Wraps masterpages selector in try/catch
to avoid exceptions if masterpage is missing for some reason
2012-10-08 07:19:36 -02:00
PerPloug b55ce96d85 Changes to editView, editTemplate and loadTemplates
to fix wrong create dialog, and missing master pre-selection
in master template dropdown
2012-10-08 07:12:02 -02:00
Shannon Deminick 8ae867389d Merge 2012-10-08 00:15:51 +05:00
Shannon Deminick 5fc3d8e248 Fixes threading issue with Dynamicexpression... would have caused some strange behavior in the past!
Fixes: U4-995 - most methods will now work in dynamic expressions
2012-10-08 00:09:44 +05:00
Sebastiaan Janssen 227d910722 Merge 2012-10-07 15:27:47 -02:00
Sebastiaan Janssen a356552d2d Moved tree picker tooltip style to default.css so it also works in editMacro (and elsewhere) 2012-10-07 11:45:22 -02:00
Michiel van Oosterhout 5c6a595e48 Changed conditions to put the constant last, so (x == false) instead of (false == x).
Code now conforms to project coding standards.
2012-10-07 08:50:09 -02:00
Michiel van Oosterhout c1cfcaf9ea Deprecated MacroProperty.Public because its value is ignored. Removed the checkbox
for setting MacroProperty.Public from the macro editor.
2012-10-06 20:51:00 -02:00
callicj 40a413cd70 Added releaseDate, expireDate columns to the query defined on m_SQLOptimizedMany so the corresponding fields are populated when this query is used to load the object. 2012-10-07 11:28:43 -02:00
Michiel van Oosterhout c7c10b8ab6 Fixed typo for consistency and incorrect grammar. 2012-10-06 18:46:31 -02:00
Michiel van Oosterhout 2da0728b78 Do not call .Trim() on a string inside .IsNullOrEmpty(), the string may be null.
Instead use .IsNullOrWhiteSpace().

Saving a global setting will insert an appSetting in web.config if it does not
yet exist.
2012-10-06 18:46:12 -02:00
Casey Neehouse a71f3f8412 Updated SQLCE to 4.0.8876.1 (SP1) and closes u4-677 2012-10-07 00:39:04 +04:00
Casey Neehouse b21423efe2 Updates SQLCE to v.4.0.8854.1 to resolve a SQL issues related to Contour. 2012-10-07 00:02:38 +04:00
Shannon Deminick 5895858e6e Merge 2012-10-07 00:08:21 +05:00
Shannon Deminick cd38123fbd Fixes issue with DynamicExpression and parsing to ensure that it is using generic types, not hard coded types.
Ensures unit tests passing for Where, Single, SingleOrDefault with filters with dynamics.
2012-10-07 00:07:51 +05:00
Shannon Deminick 842d7120e6 Obsoletes DynamicQueryable in MacroEngines lib, proxies all calls to new DynamicQueryable in Umbraco.Web.
Adds more support for NodeTypeAlias and DocumentTypeAlias param names for compatibility.
Adds IsDocumentType is-helper method.
Adds unit tests for complex Linq using a Typed IPublishedContent object.
Adds unit tests for complex Linq using dynamics.
Adds support for Single, SingleOrDefault, First, FirstOrDefault, Last, LastOrDefault to dynamics for both DynamicNode and DynamicPublishedContent + unit tests.
Adds support for 'Children' on DynamicNode to keep things consistent, no longer required to have to do 'ChildrenAsList'.
DynamicNode now implements INode... not sure why this wasn't like that before.
2012-10-06 23:41:42 +05:00
Sebastiaan Janssen cae2183ab4 Merge 2012-10-06 11:47:55 -02:00
Sebastiaan Janssen 07e75dab15 BaseRestExtensions.Release.config should not be in the build package, output set to None 2012-10-06 11:47:01 -02:00
Sebastiaan Janssen 5cebbd8a91 Adds a nice tooltip when hovering over the content/media picker
#U4-192 Fixed
2012-10-06 11:46:37 -02:00
Stephan db59b08f58 fix config files for BaseRestExtension.config 2012-10-06 07:20:12 -02:00
funka@WETWIRED 2b2c75f5e4 Resolves feature request U4-192 Add more meta data to Content and Media pickers 2012-10-06 01:26:56 +07:00
Casey Neehouse 8c7b06fe2b U4-914 - Added additional security to the change password
dashboard control to require current password.
2012-10-05 21:12:12 +04:00
Sebastiaan Janssen 540db7137a Fixed config transform for BaseRestExtension.config 2012-10-05 13:45:06 -02:00
Stephan 079aae7e63 bugfix unit tests polluting each other - static settings issue 2012-10-05 08:23:43 -02:00
Stephan 6183e01642 bugfix xpath in DefaultPublishedContentStore for legacy XML schema 2012-10-05 08:00:06 -02:00
Sebastiaan Janssen cf91933791 Add some dummy files to ensure (empty) directories in the test project get created 2012-10-04 15:15:23 -02:00
Sebastiaan Janssen d10c3a960f Merge 2012-10-04 15:04:14 -02:00
Sebastiaan Janssen 4d6d89dbe7 Add Masterpages and Views folder in the unit tests to project so almost 250 more tests will run properly 2012-10-04 15:03:40 -02:00
Morten Bock c138c6643a Ignore casing, and avoid null http contexts 2012-10-04 14:48:14 -02:00
Morten Bock a2b876608f Refactoring to use object resolver, instead of ProviderBase 2012-11-21 07:14:40 -01:00
Shannon Deminick 9e113564fa Merge 2012-10-04 21:39:36 +05:00
Shannon Deminick f8848086fd Adds support for legacy schema to the DefaultPublishedContentStore, adds unit tests to support this. 2012-10-04 21:37:11 +05:00
Shannon Deminick 261a6af60a Fixes issue when xml file is corrupt and no doc type is registered, the mvc controller factory throws an exception. 2012-10-04 21:06:32 +05:00
Sebastiaan Janssen c66d70fbd8 Merge 2012-10-04 13:52:12 -02:00
Sebastiaan Janssen e8c7af8b25 Removed legacytests project for now. 2012-10-04 13:51:51 -02:00
Shannon Deminick 8804d912f2 More unit tests written and passing. 2012-10-04 06:00:47 +05:00
Shannon Deminick 54e5140d6a Added more extension methods to our strongly typed IPublishedContent object and IEnumerable<IPublishedContent> to match all of the available methods
that are on the DynamicPublishedContent object. Added more unit tests for all of these classes.
Moved some of the Dynamic objects into the web project which simplifies things quite a bit as some of these classes require access to the biz logic layer.
Now we have intellisense for all of the nice magical methods that were on DynamicPublishedContent on our strongly typed object!
2012-10-04 03:26:56 +05:00
Shannon Deminick c0102f1c71 Refactored the traversal, ishelper, etc... methods to be extension methods on IPublishedContent so now all of these methods are available on the Typed object not just the dynamic object which makes a whole lot more sense... and you can have intellisense.
Updated DynamicPublishedContent's methods to just proxy calls to the new extension methods so that all of the logic is contained in one place.
Added new GetRootDocuments to the IPublishedContentStore since we need this in order to get the root list of documents for many of these methods.
Fixed an issue with the DynamicNode to IPublishedContent converter.
Fixed many of the failing unit tests.
2012-10-04 01:31:08 +05:00
Shannon Deminick 831d1966dc Added IEnumerable extensions to TypedContent, TypedMedia, Content, and Media methods 2012-10-02 22:55:36 +05:00
Shannon Deminick ef5525e67f renamed DynamicDocumentList to DynamicPublishedContentList
simplified some of the DynamicPublishedContent methods to accept Func<IPublishedContent> instead of Func<DynamicPublishedContent>, made the IsHelper method private as this shouldn't be exposed.
renamed other objects starting with DynamicDocument to DynamicPublishedContent
2012-10-02 22:51:53 +05:00
Shannon Deminick f3e04ac871 Changed method name ContentTyped to TypedContent and MediaTyped to TypedMedia. 2012-10-02 22:10:18 +05:00
Shannon Deminick ba98f587b2 Changed query methods on UmbracoHelper to just Content, ContentTyped, Media, MediaTyped 2012-10-02 21:58:07 +05:00
Shannon Deminick 2753dbe5b4 ensures enctype attribute is added in BeginUmbracoForm.
Adds CurrentCulture to RenderModel
2012-10-02 21:19:21 +05:00
Shannon Deminick 56c93891a8 Fixes the ClearDatabase call in SqlCEHelper... pretty flukey that unit tests were even working with this bug for so long.
Fixes the RenderRouteHandlerTests.
2012-10-02 02:33:19 +05:00
Shannon Deminick 6bd005775d After talks with morten and stephane, this renames
DocumentNotFoundHandler  -> PublishedContentNotFoundHandler
2012-10-02 01:43:59 +05:00
Shannon Deminick 73c79e8528 After talks with morten and stephane, this renames
IDocumentLookup -> IPublishedContentLookup
2012-10-02 01:43:05 +05:00
Shannon Deminick 827d4dd6c0 After talks with morten and stephane, this renames
DocumentRequestBuilder -> PublishedContentRequestBuilder
2012-10-02 01:41:54 +05:00
Shannon Deminick ffd14c839b After talks with morten and stephane, this renames
DocumentRequest -> PublishedContentRequest
2012-10-02 01:40:19 +05:00
Shannon Deminick f8d8b767b8 update ignore file 2012-10-02 01:37:02 +05:00
Shannon Deminick 4f011e0390 Some naming tweaks to fix up from previous commit. 2012-10-02 01:36:42 +05:00
Shannon Deminick 053df24640 After talks with morten and stephane, this renames
IDocument -> IPublishedContent
DynamicDocument -> DynamicPublishedContent
2012-10-02 01:35:39 +05:00
Shannon Deminick 45c335702d Updated view engine to look only in App_Plugins/ not App_Plugins/Packages/.
Updated view engine to automatically create the required razor web.config in the packages
Views folder if it is not there already.
2012-10-01 23:43:47 +05:00
Shannon Deminick bc04d4f8da Added PluginViewEngine for App_Plugins 2012-10-01 23:22:23 +05:00
Shannon Deminick be5076783f Adds ~/App_Plugins/Packages folder to be created in build script 2012-10-01 23:10:27 +05:00
Shannon Deminick 5c20f4f6ec Fixes: U4-U4-917
Fixes: U4-821
2012-10-01 23:04:57 +05:00
Shannon Deminick 42da98e020 Moves codebehind for EditView into UI project 2012-10-01 22:09:49 +05:00
Stephan eeb305c740 fix uQuery.GetNodeIdByUrl 2012-10-01 13:08:10 -02:00
Stephan c19541cb11 handle routing cache corruption cases, more unit tests 2012-10-01 12:20:51 -02:00
Stephan dea22f22cb fix UriUtility, fix unit tests 2012-10-01 09:52:32 -02:00
Stephan 656c61d1e2 fix xpath for finding default node because sortOrder may not start at zero 2012-10-01 06:55:44 -02:00
Shannon Deminick bac038b82d Converted treeInit.aspx so that it's codebehind and designer files are in the UI project and only
the old TreeInit class exists in the Umbraco.Web project (not the aspx file). It needs to stay there
to maintain backwards compatibility for anyone that may have inherited from that file.
2012-10-01 03:57:57 +05:00
Shannon Deminick dd6d0e380e Updated the /umbraco/umbraco.aspx page to have all of it's aspx + codebehind + designer files in the UI project and
left the original class in the Umbraco.Web project as to not break backwards compatibility for anyone that may have inherited from that
class.
2012-10-01 03:41:37 +05:00
Morten Bock c95c1a7038 Add support for thumbs and crops from standard datatypes. 2012-09-30 20:37:05 -02:00
Morten Bock 9e1c5e71e4 Adding the umbraco:image control, and the ImageUrl feature with a some generic ProviderFeature classes, to make it easier to implement future provider based features. 2012-11-21 07:13:31 -01:00
Sebastiaan Janssen aba68720bb Localized the create window for new Scrips (js) 2012-11-21 06:54:52 -01:00
Sebastiaan Janssen 1b1722c875 Renamed method to remove characters that are illegal in XML and made the method internal for now 2012-11-21 06:23:31 -01:00
Michiel van Oosterhout 248af2eaa2 Correct code that validates the user name when the session times out by serializing
user name and password.

Adds a minified 4KB JSON library to umbraco.aspx to support older browsers, namely
https://github.com/douglascrockford/JSON-js (public domain)
2012-10-07 20:54:34 -02:00
Casey Neehouse 0709174560 Merge 2012-11-20 21:11:11 +05:00
Casey Neehouse b0c0ed050d Adds SQL to validate that a node is published before loading the xml.
U4-759, u4-590, U4-589
2012-11-20 21:09:19 +05:00
Sebastiaan Janssen e3a085774c Revert 5c828605ef65 / 8b3a266b2d00 because that would have nasty side effects,
see http://issues.umbraco.org/issue/U4-1061
2012-11-20 14:49:30 -01:00
Sebastiaan Janssen 6f0ddc37a0 Include System.Data.SqlServerCe* should do a copy local 2012-11-20 14:13:47 -01:00
Sebastiaan Janssen d3eb5ceabe Merge 2012-11-20 12:55:17 -01:00
Stephan 1bffb7395c U4-1192 - uQuery.GetNodeIdByUrl should not follow redirects etc 2012-11-20 09:12:45 -01:00
Stephan e636a42744 .hgignore ~/scripts and ~/images 2012-11-20 08:52:56 -01:00
Stephan d3927a1265 code annotation attributes TLC 2012-11-20 08:49:06 -01:00
Stephan d6fc106588 fix DisposableTimer so args can be evaluated _after_ completion 2012-11-20 08:34:32 -01:00
Stephan 68fc833280 U4-1186 - bugfix previous commit 2012-11-19 16:09:43 -01:00
David@David-PC 5a8443fe72 committed wrong version 2012-11-18 18:48:56 -01:00
David@David-PC 153fb4a248 Do a recursive unpublish (fixes U4-462, U4-594, U4-1061) 2012-11-17 14:25:04 -01:00
Michael Wulff Nielsen 72ef5b01d2 Fixes bug 383, inserting macro parameters with quotes fails in macrocontainer 2012-11-20 09:29:38 -01:00
NielsHartvig@UMBRACORATI.localdomain 0854fee4ee Update to sanitizer 2012-11-16 14:24:24 -01:00
NielsHartvig@UMBRACORATI.localdomain e122d40fb9 The BOSS is fixing U4-367 2012-11-16 14:08:28 -01:00
Sebastiaan Janssen b696aa4340 ApplicationContext.Current.ApplicationCache wasn't public due to an oversight, it is now. 2012-11-19 15:31:58 -01:00
Sebastiaan Janssen e32dd303e3 Have to revert Microsoft.WebApplication.target file change as we got weird
results (umbraco.presentation folder and a XmlSerializers dll in the root).
Copied the targets file to the appropriate Program Files folder on the build
server. :-(
2012-11-19 15:02:43 -01:00
Stephan 7c524abb84 U4-1186 - support wildcard domains to change the culture 2012-11-19 14:11:34 -01:00
Stephan 993bac8a29 bugfix LogHelper 2012-11-19 14:09:52 -01:00
Shannon Deminick b40dbf73ca Changes case back to the correct EditView 2012-10-01 03:00:05 +05:00
Shannon Deminick 0808665342 Changes editView to editViewTEMP so that we can change it back to the correct case. 2012-10-01 02:55:53 +05:00
Shannon Deminick 7623746f64 changed editViewTEMP to EditView with correct casing. 2012-10-01 02:52:58 +05:00
Shannon Deminick 3152427ff7 Changed name of editView to editViewTEMP in order to change it back to the correct case. 2012-10-01 02:52:28 +05:00
Shannon Deminick 85e88e5640 Merge 2012-10-01 02:48:39 +05:00
Shannon Deminick ea3d2f893f Added AsDynamic extension to IDocument.
Makes DynamicDocument explicitly implement IDocument as well.
Changes all ContentById methods, etc... back to returning just 'dynamic'
Removes valueAlias from the .Field method of UmbracoHelper which didn't actually do anything
removes altValueAlias from the .Field method of the UmbracoHelper which didn't actually do anything.
2012-10-01 02:48:08 +05:00
Stephan 3cddc5e4dc merge 2012-09-30 14:04:38 -02:00
Stephan 8cd49749ec fix routing, more unit tests 2012-09-30 14:02:11 -02:00
Stephan e45bf57632 fix how we resolve "default node", now using sortOrder 2012-09-30 12:25:47 -02:00
Stephan 3e99dd0d55 fix NiceUrl and add more tests 2012-09-30 12:24:23 -02:00
Sebastiaan Janssen be2ed3762b Merge 2012-09-30 06:46:37 -02:00
Sebastiaan Janssen e3abd49276 Fix regression bug 2012-09-30 06:46:08 -02:00
Shannon Deminick d76f6c1cdb {localLink} parsing in MVC is now all working. 2012-09-29 11:35:31 +07:00
Shannon Deminick 840109dc58 updates missing code block 2012-09-29 11:19:19 +07:00
Shannon Deminick 1aebce7ad6 makes SystemDirectories and SystemFiles public.
moves ResolveUrlsFromTextString to TemplateUtilities class and obsoletes other ones.
Fixes an issue if content cache is stored in codegen folder and not in med trust.
Updates the XmlDocument (IDocumentProperty) to always return a value with parsed {localLink} and resolved Urls and cache them so the parsing only happens once.
2012-09-29 11:11:48 +07:00
Shannon Deminick 11fd6553e9 Ensures that localLinks are parsed when rendering fields and macros using UmbracoHelper.
Added additional ControllerExtensions to render views as strings.
2012-09-29 08:49:21 +07:00
Shannon Deminick 690c4a165c Creates TemplateUtilities class for parsing local links and obsoletes the old method. 2012-09-29 08:13:49 +07:00
Shannon Deminick 8fb159ddc2 Changes IThumbnailProvider to exist under Umbraco.Core.Media instead of just Umbraco.Core.
Moves many of the MVC extension methods into the Umbraco.Web.Mvc namespace and tidies up a few other
class's namespaces
2012-09-29 08:07:00 +07:00
Shannon Deminick b3ca264af1 Explicitly loads webforms handler and remaps to it, now we can share this code somehow with the RenderRouteHandler when
we want to support having a no-template render as a 404.
2012-09-29 07:36:19 +07:00
Shannon Deminick 34e71027b3 Changed Is404 on DocumentRequest to internal as only the DocumentRequestBuilder should set this, removed the Is404 being set in the
DefaultLastChanceLookup as lookups shouldn't set the 404.
Cleaned up ObjectExtensions TryConvertValue method.
Ensures that the routes are created before the CoreBootManager complete is called.
2012-09-29 07:20:23 +07:00
Stephan 926427ff68 merge 2012-09-28 11:14:04 -02:00
Stephan abe4944843 routing - handle when umbraco is not ready or has no content 2012-09-28 11:11:47 -02:00
PerPloug 5f12767f48 Flet 2012-09-28 09:27:12 -02:00
PerPloug 04e0b35c7d Method Renaming to follow standards
Marking IOHelper methods as internal
Removing unneeded umbraco setting
Missing icon and missing folder in UI project
2012-09-28 09:19:16 -02:00
Stephan d82cbfccc5 remove a ref to requestHandler, fix DefaultRoutesCache management 2012-09-28 09:04:49 -02:00
Stephan 3ed1b4c77d remove unused setting option 2012-09-28 08:14:01 -02:00
Stephan 6c4869f931 merge 2012-09-28 07:08:37 -02:00
Stephan b0e336e01f routing, fix "no content" splash, fix "no template" handling, fix redirects 2012-09-28 07:04:33 -02:00
Shannon Deminick 05bdd42567 Fixes issue with UmbracoHelper in back office when there is not Document.
Adds another overload to BeginUmbracoForm.
2012-09-28 08:08:36 +07:00
Stephan d8c2a71531 bugfix document.GetPropertyValue and object.TryConvertTo 2012-09-27 15:41:24 -02:00
Stephan a469e3dbe3 fix base/rest service - cleanup + new config file 2012-09-27 15:37:21 -02:00
PerPloug b8b951f094 Missing UmbracoSettings change in umbraco.core
IOHelper in umbraco.core
Both related to mvc views in template tree
2012-09-27 06:30:59 -02:00
PerPloug c409cfa421 Create/Ui.xml file for templates
umbracoSettings.config file
2012-09-27 06:29:41 -02:00
PerPloug 9f7814591e Adds Seperate View Editor for mvc templates
Changes the template tree to look for existing views
to override the .master
2012-09-27 06:24:04 -02:00
PerPloug 2c995f7fa7 Moves masterpage and view creation away from the template
class and into seperate helpers.
2012-09-27 06:23:09 -02:00
PerPloug 7e5db90b3b Adds IO Helper overload for the views and masterpages
Adds UmbracoSettings to toggle mvc templating support
2012-09-27 06:21:59 -02:00
Shannon Deminick f7f83bc057 Changed IPublishedContentStore and IPublishedMediaStore back to internal as we don't need to expose these yet. Instead have added
an UmbracoHelper property to the PluginController class which will expose any methods needed by devs to retreive media or content.
Have updated UmbracoHelper with loads of new helpful methods and moved the Wrap methods to HtmlHelper extensions because this is purely to
do with rendering html (have written unit tests for it too).
Updated some 'library' methods to proxy calls to UmbracoHelper so we only have to maintain one set of code.
Added a convenience property to UmbracoContext to return the current NiceUrlProvider so you don't have to go through the RoutingContext to get it.
2012-09-27 08:30:35 +07:00
Shannon Deminick 530e7ae44e removed ref to missing template file 2012-09-27 07:06:14 +07:00
Stephan 126044cd48 bring back scheduled tasks - #U4-809 2012-09-26 12:51:27 -02:00
Sebastiaan Janssen f76e90990f Include packages.config anyway, just tell it to not output in the build 2012-09-26 11:58:52 -02:00
Sebastiaan Janssen 587542ace7 The build.bat file now won't exit when there's an error so you can inspect it, if there's no errors it will just exit
Excluded missing index.cshtml file from project (was giving build error)
2012-09-26 06:48:11 -02:00
Shannon Deminick d3676b376d Removed test route 2012-09-26 13:59:24 +07:00
Shannon Deminick 53a3ad24e6 comments out test surface controllers for now 2012-09-26 13:44:23 +07:00
Shannon Deminick 05add96294 Ensures web.config includes new namespace reference 2012-09-26 13:43:47 +07:00
Shannon Deminick 9b5fd3d67b Merge 2012-09-26 13:42:44 +07:00
Shannon Deminick 5ece0b5af0 Surface controllers now auto-routing, both locally declared and plugin types (which require a [PluginController] attribute and an Area Name assigned).
BeginUmbracoForm working for both local and plugin SurfaceControllers. SurfaceController class now inherits from PluginController which exposes all things a dev would
need including making IPublishedContentStore and IPublishedMediaStore public which can be accessed simply by properties on the controller.
Updated web.config for views to include Umbraco.Web namespace for all of our helper methods.
BeginUmbracoForm now has many more overrides for which you can specify a type or a generic type (we no longer require GUIDs :)
2012-09-26 13:42:03 +07:00
Shannon Deminick 332b42aa49 Changed how surface controllers are routed: because we don't load plugins in via App_Plugins/[PackageName] like we did in v5 which meant that we can autoroute all plugin controllers with their own areas, in v4 we have to do something different.
Instead (because we still want areas), we have an attribute called PluginControllerAttribute which allows a dev to assign an area name as a string. A package developer should always ensure that all of their plugin controllers are assigned to the same
area. This also lets us get rid of the GUID id part of the plugin (hopefully we can leave it out, just need to run some tests). Since we have areas, package devs can then put their views into
their own folders and not clutter up the local devs ~/Views folder. Perhaps we use App_Plugins/[PackageName] for the views like we did in v5 but need to ask on the mail list. Otherwise it will be the standard MVC:
~/Areas/[AreaName]/Views which will still also clutter up the local devs view folder if they are using Areas.
2012-09-26 11:04:07 +07:00
Sebastiaan Janssen 97472c6ce6 Ignore file excluded the web.config file in the views folder, which is why the build failed, not because it wasn't included 2012-09-25 11:56:33 -02:00
Sebastiaan Janssen 48a3a920d2 Web.config file was not included, making the build fail 2012-09-25 11:53:27 -02:00
Shannon Deminick 7b7e3b82f1 Started adding tests for surface controller routing. They are working but not quite correctly yet. 2012-09-25 13:33:47 +07:00
Shannon Deminick 0b7f04ab37 Added all code to support auto-routing surface controllers and started implementing the code for
BeginUmbracoForm.
2012-09-25 13:09:59 +07:00
Shannon Deminick 083b18139a Adds code to RenderViewEngine to ensure the /Views folder exists and also that the razor web.config file exists there too.
I've also added this web.config file to the sln so it should output in the build by default though it will still be created automatically if
its not there.
2012-09-25 11:20:05 +07:00
Shannon Deminick 1bc3943f33 Fixes: #U4-894 - moves the int Priority out of the IThumbnailProvider class as it is only metadata, moved
this into a new generic WeightedPluginAttribute which can be used for other resolves/objects that require a weight.
2012-09-25 11:06:32 +07:00
Hendy@Blueberry 449613de3e updated check for uQuery.IGetProperty
added XPathCheckBoxList return obj for uQuery .GetProperty<T>("alias")
2012-09-24 20:54:26 -01:00
Stephan 7d8ec2678c initialize Umbraco sooner in the request pipeline 2012-09-24 12:49:36 -02:00
Stephan 12c0ce258b fixing routing + add Lookup tests 2012-09-24 12:10:25 -02:00
Stephan 42317ec207 merge 2012-09-24 11:37:55 -02:00
Stephan 343c14db48 fixing routing, 404, domains + add NiceUrl and UriUtility tests 2012-09-24 11:36:25 -02:00
Hendy@Blueberry 2fcb9d7b30 added uQuery.IGetProperty - allows GetProperty<T> extension methods to pass T hydration to a method in T 2012-09-23 10:34:39 -01:00
Sebastiaan Janssen ccbcb991b1 Text for Alias is changed to Alternative link
#U4-891 Fixed
2012-09-22 12:14:42 -02:00
sebastiaan 33f4da875a Additional fix for #U4-306 - click to the right of the node still collapsed the tree 2012-09-22 10:54:22 -02:00
sebastiaan 0549e39a00 The ClientDependency and ExamineIndexes folder are not needed in /App_Data any more
They are automatically generated in /App_Data/TEMP
2012-09-22 10:34:03 -02:00
Shannon Deminick 6fb0fc643b Merge 2012-09-21 23:54:31 +07:00
Shannon Deminick 8824579dac Made IThumbnailProvider public which fixes 4.10 loading them, plus now people can make their own :)
However, I'd like to move the Priority flag onto an attribute instead of part of the interface because it
is metadata and not functionality of the class itself. Will make a tracking issue for it.
2012-09-21 23:54:14 +07:00
Stephan 94b6a9df8d fix base/rest service - loading assemblies & caching methods 2012-09-21 10:10:03 -02:00
Stephan cb8a8b997f bugfix TypeFinder.GetAllAssemblies duplicate App_Code 2012-09-21 10:01:51 -02:00
Casey Neehouse fe99c22022 Merge 2012-09-21 01:56:19 +04:00
Casey Neehouse 0225047a52 Removes .ChildNode calls for .SelectNodes() with correct element selection. Allows comments in configuration.
Also updates some Macro Properties to work with new schema.
2012-09-21 01:53:43 +04:00
sebastiaan d89a24d96b Tree disappears if you click slightly below the root node
#U4-306 Fixed
2012-09-20 17:02:07 -02:00
sebastiaan c5535ddbc2 Improved SafeFileName method to include all valid characters as listed by RFC 3986 section 2.2 Reserved Characters (January 2005) and character data chars that could be ambiguous
Now characters like Chinese characters are allowed in the filenames, which addresses the issue below
#U4-885 Fixed
2012-09-20 16:46:55 -02:00
Stephan 3a21d48dbc merge 2012-09-20 14:38:08 -02:00
Stephan ea8ff709c2 further refactor base/rest service into Umbraco.Web 2012-09-20 14:37:23 -02:00
sebastiaan eb9937c33a Packages.config should not be included in the project as it shouldn't be in the builds 2012-09-20 10:24:56 -02:00
sebastiaan 777c7dd683 Update to 4.10.0 for the nuspec files as well 2012-09-20 09:16:03 -02:00
sebastiaan 10963fe3c4 Remove .nupkg files 2012-09-20 09:13:11 -02:00
sebastiaan 3e5d684333 Update version number to 4.10.0 2012-09-20 09:10:50 -02:00
greystate 6a9b2b260b Applied pull request: 3402 - typo on starter kit install screen 2012-09-20 09:09:55 -01:00
Morten@Thinkpad-X220 7a38d7f845 Adding TinyMCE language files for plugins and themes. There are still a few missing for the umbraco theme though. 2012-09-20 06:45:23 -02:00
Morten@Thinkpad-X220 745707dc4b Removing TinyMCE3 language files before they can be properly attached 2012-09-20 06:36:34 -02:00
sebastiaan 1f4ceaa75c Included the tinyMCE language files in the project so they'll actually be in the build
#U4-277 Fixed
2012-09-20 06:27:09 -02:00
Shannon Deminick a16f28eb26 Re-implemented GetProperty on IDocument, had removed it because I didn't see a need for it because we already have a Properties collection, however we do require it
for specific implementations where the IDocument needs to search for the specified property based on alias since it might not already know about it. This is true for the
DefaultPublishedMediaStore where a property may not exist in the Examine cache so we need to fallback to the db in that case.
2012-09-20 14:17:40 +07:00
Shannon Deminick fa36ff3662 removed erroneous Wrap methods that were hidden by other overloads based on optional parameters. 2012-09-20 13:32:08 +07:00
Shannon Deminick ae4cb00bbc Got Wrap methods on UmbracoHelper, deprecated old classes in the macroEngines project that Wrap utilizes and proxies
all calles in RazorLibraryCore for Wrap to UmbracoHelper. Fixed up the HtmlTagWrapper classes so they have immutable properties and replaced
public fields with Properties.
2012-09-20 13:16:38 +07:00
Shannon Deminick fd166389c4 Changed the MVC view class to expose the UmbracoHelper as just @Umbraco instead of @UmbracoHelper, this
follows the same naming conventions as MVC with HtmlHelper is exposed just as @Html, plus it is less to type
2012-09-20 12:47:37 +07:00
Shannon Deminick a48b996571 Got ChildrenAsTable working as extensions on DynamicDocument with supporting unit tests.
Have updated the ChildrenAsTable code for Node as well to use the same base code, this should
also fix some issues with generating a datatable correctly when a content type is changed, previously
the cache was not cleared for Alias to name mapping.
2012-09-20 12:42:43 +07:00
Shannon Deminick 6e4929b84d Fixes recent commits and aspx files not being edited in the correct place and split the aspx files + codebehinds properly so there's no confusion over
which one to edit.
2012-09-20 07:31:32 +07:00
Shannon Deminick f912d465c5 Moved BaseRestHandler out of the BaseRest namespace.
Updated PublishedMediaStore and wrote a bunch of unit tests for it which are all now passing.
2012-09-20 07:13:45 +07:00
Shannon Deminick 3e292b77ad Merge 2012-09-20 03:47:34 +07:00
Shannon Deminick dc000ea33c Update to DefaultPublishedMediaStore, changed namespace for some unit tests. 2012-09-20 03:47:24 +07:00
sebastiaan aaa8cafd0b Merge 2012-09-19 12:45:24 -02:00
sebastiaan ce0923cfc6 Uploading media with hyphens get a space added before the hyphen
New media uploader: illegal characters in the filename are not filtered
New media uploader: IE in intranet mode stores the whole path
Fixed U4-882 U4-883 U4-874
2012-09-19 12:45:11 -02:00
Casey Neehouse 7473557580 Removed umbracoApp and umbracoAppTree Foreign Keys from SqlAzure install script. 2012-09-19 15:02:02 +04:00
sebastiaan 982ba0f4b0 Corrected bug where PropertiesPane was only shown on media items 2012-09-19 07:49:51 -02:00
sebastiaan 278c1fefaa Merge 2012-09-19 06:20:09 -02:00
Matt@MBP13-PC 71b2137513 Merge 2012-09-18 13:25:56 -01:00
Matt@MBP13-PC 2952992ffe Fixed "inception" media tree bug due to recycle bin auto initializing when it shouldn't 2012-09-18 13:25:17 -01:00
sebastiaan 0dbd214b00 Merge 2012-09-18 09:16:22 -02:00
sebastiaan 90ca566e53 Little cleanup of some left-behind files 2012-09-18 09:14:38 -02:00
Stephan aa633bbbb2 merge 2012-09-18 08:55:39 -02:00
Stephan 2c204d9d9e refactor base/rest module into a handler so that it works again with the new UmbracoModule 2012-09-18 08:54:54 -02:00
Hendy@Blueberry 8307da1a87 XPath CBL / DDL prevalue descriptions for the XPath fields, and fix for CBL to load defaults 2012-09-17 21:21:33 -01:00
sebastiaan d339f74e95 Thanks to Darren Ferguson - Media items should indicate which Media Type (in Properties tab)
#U4-679 Fixed
Add "url to this file" label to property tab in media
#U4-173 Fixed
2012-09-17 10:53:22 -02:00
sebastiaan 59fe173933 Removed old and completely unused GraphicHeadlineFormat config setting
Some updates to umbracoSettings.config
Thanks to Jan Skovgaard for the help!
2012-09-17 07:47:13 -02:00
dseefeld ca55579982 Error: Delete media item with upload property - empty recycle bin fails
Fixed #U4-771
2012-09-17 04:06:53 -02:00
Darren@Darren-VAIO b5099c37c7 Standard doc type properties no longer prefixed with @ in "Insert Umbraco page field" dialogue
Fixed #U4-859
2012-09-16 10:49:19 -02:00
Macke@MacsonServer 2826fbd807 Fixes #U4-840 Changed the blog url in MetaWeblog API. Url-property of getUsersBlogs, will now contain the full url to the blog, not just the "server_name". 2012-09-16 09:41:53 -02:00
sebastiaan b5d209677e Changed scriptDisableEditor comment to reflect new js lib and it's now also working in IE
Thanks to Jan Skovgaard for noticing it was wrong!
2012-09-16 09:16:26 -02:00
sebastiaan b15d03a54d #U4-784 Fixed
Member.MakeNew duplicate LoginName exception message uses wrong data
2012-09-15 08:43:06 -02:00
sebastiaan 247aa08d57 Fixes U4-778 - Visualize XSLT is not working. 2012-09-15 08:32:25 -02:00
Shannon Deminick 394078d470 Merge 2012-09-15 12:19:53 +07:00
Shannon Deminick 91834e8f53 Migrated logic to create a DataTable from a Node or pretty much any other object in to a central place so we only have to maintain code in one place.
Now need to just test it with Node and create the DynamicNode extension methods for returning as a DataTable.
2012-09-15 12:17:42 +07:00
sebastiaan 201bc2d1ab Merge 2012-09-14 11:23:42 -02:00
sebastiaan 29ed7bf8ae Fixes U4-776 umbraco:item xslt property not rendering in template - Thanks to Michael Wulff Nielsen for the quick spot and contribution! 2012-09-14 11:19:57 -02:00
leekelleher 26f32bab8e Dashboard controls: Tidied up the UI.
Made use of ClientDependency for CSS/JS includes.
CSS tweaks for success/notice/error messages.
Removed from "Umbraco.Web.UI" project, master version now in "Umbraco.Web"; (confirmed with Seb)
(MediaDashboardFolderBrowser.ascx was missing from "Umbraco.Web" - added)
2012-09-14 11:41:30 -01:00
Shannon Deminick 1566b16f0f Migrated most of the functionality from RazorLibraryCore to UmbracoHelper and updated RazorLibraryCore to call
the methods in UmbracoHelper so we only have to maintain one set of code. Didn't port over the Wrap methods because
I need feedback on these as to what they do/are supposed to do.
Added the Media methods to UmbracoHelper using the media store stuff.
2012-09-14 09:09:23 +07:00
Shannon Deminick 0a8b1cc784 Big cleanup of DynamicDocument, removed DynamicBackingItem for this implementation as it is not required.
Removd DynamicBackingItemType since media and content are the same.
2012-09-14 07:28:44 +07:00
Matt@MBP13-PC c441887a96 Updated treePicker dialog to allow the passing in of a NodeKey via querystring 2012-09-13 18:00:25 -01:00
Matt@MBP13-PC 32d76cc143 Fixed issue with AbstractPrevalueEditor throwing WebResource 404s when implemented by a type outside of the umbraco.editorControl namespace 2012-09-13 17:58:18 -01:00
sebastiaan 4340df53fd U4-843 Number of "Last Edits" is now configurable. 2012-09-13 14:42:59 -02:00
sebastiaan f6c6f4f0c0 U4-55 Remove Linq to Umbraco from the core - Removes the menu item as well 2012-09-13 11:23:19 -02:00
Shannon Deminick 18713fe513 Fixes one test with DynamicNode 2012-09-13 13:38:51 +07:00
Shannon Deminick a1edad4e08 Fixed DynamicNodeTests with db support 2012-09-13 13:02:02 +07:00
Shannon Deminick 1c040912f6 Exposes the IDocument property as CurrentDocument on the Model for MVC pages. 2012-09-13 12:28:08 +07:00
Shannon Deminick 458f1d3b8f Fixed setting the Is404 flag 2012-09-13 12:23:58 +07:00
Shannon Deminick 9e5f2f3c9a Fixed template engine selection... oops :) Should all work now!
Fixed DefaultPublishedContentStore to correctly find a secondary root document that doesn't have a domain assigned.
2012-09-13 12:19:56 +07:00
Shannon Deminick f6022c8dda Merge 2012-09-13 11:48:16 +07:00
Shannon Deminick 0ed15db408 Fixed the NiceUrlProvider as it some refactor on a previous commit broke some stuff.
Fixed up some unit tests with NiceUrlProvider to ensure that the second node under the root get's
the correct URL assigned.
Added unit test to ensure that route caches are persisted correctly.
2012-09-13 11:45:06 +07:00
Shannon Deminick c742c6c249 Created new GlobalSettings unit tests to validate reserved paths as well as updated the umbraco module tests with an install path without
the suffixed '/'. Fixed a bug with the reserved paths which was caused by code written in 4.9 to the new code written in 4.10 and the combined
effort was not working. Added more logic to cleanup the URL before comparing too.
Cleaned up GlobalSettings to not have any reliance whatsoever on httpcontext (which of course it shouldn't and not sure why it even did before).
Obsoleted a few methods on the legacy GlobalSettings that aren't used anywhere and should be removed in the future.
Cleaned up a bit of the UmbracoModule with the URLs used.
2012-09-13 09:00:21 +07:00
Shannon Deminick b06a4d2e13 Merge 2012-09-13 06:48:16 +07:00
Shannon Deminick 89cd2772dc add note 2012-09-13 06:48:06 +07:00
Morten@Thinkpad-X220 48c69b9335 Fixes U4-781 Removed duplicate swedish language file. 2012-09-12 05:57:27 -02:00
sebastiaan e8d6f694e7 Added back missing translation trees 2012-09-12 04:22:39 -02:00
sebastiaan 253b58aafb Corrected bad merge (again) 2012-09-11 06:42:00 -02:00
sebastiaan a864fc1fe8 Fix merge problem 2012-09-11 05:29:36 -02:00
sebastiaan 8a5cd21603 Merge with default 2012-09-11 05:02:33 -02:00
Shannon Deminick f2a7b3b255 Updated the published content stores so that content doesn't inherit from media, instead there is a base
interface IPublishedDataStore.
Simplified the interface structure and removed the GetDocumentProperty method as it is not needed and i think existed
before we updated the codebase to not rely on xml.
2012-09-11 05:58:16 +07:00
Shannon Deminick d5ca5e32b4 Fixes the issue with trailing slashes and the comparison in GlobalSettings and updated unit tests
to support the fix.
2012-09-11 05:27:39 +07:00
Shannon Deminick 37969909ca Updated the DynamicDocument and node unit tests to not init a db each time, runs much faster though in the future
we might have to re-enable this in a smart way.
2012-09-11 04:43:30 +07:00
sebastiaan fe92947d72 TeamCity build fails on missing Views\Home.cshtml in Umbraco.Web.UI, removed it. 2012-09-10 12:15:03 -02:00
sebastiaan b9165a8b70 TeamCity build fails on missing App_Code\TestClass.cs in Umbraco.Web.UI, removed it. 2012-09-10 12:10:17 -02:00
Shannon Deminick 27bcea78d2 Started implementing new IPublishedMediaStore which will replace the notion of the legacy ExamineBackedMedia and
moving forward will open up many nice opportunities. This will be used for the media accessor in the new DynamicDocument.
Renamed XmlPublishedContentStore to just DefaultPublishedContentStore.
Made GetProperty an extension method for IDocument and removed from the interface as it is not needed there.
2012-09-08 13:22:45 +07:00
Shannon Deminick ce9be79ec6 Added the Examine Search methods to DynamicDocument as extension methods.
Renamed a few things.
2012-09-08 11:59:01 +07:00
Shannon Deminick d83887e314 Ported updates to DynamicDocument to allow dynamic access to RTE content and still have it
render all embedded macro content without resorting to use some other mechanism.
Fixes the .Field method of the UmbracoHelper.
2012-09-08 11:30:19 +07:00
Shannon Deminick 59fa733156 Created MacroTagParser and updated ItemRenderer to use it. Have DynamicDocument rendering RTE content
with macro content without having to use any special methods, we just use a new custom Property Editor value converter.
Now just need to port this over to DynamicNode too.
Obsoleted a method on the 'helper' class to something much more meaningful... hopefully we can do that with the rest of that class too.
2012-09-08 07:13:03 +07:00
sebastiaan 534c28046a Added tag Release-4.9.0 for changeset 09f5a69cf19e 2012-09-07 07:10:51 -02:00
sebastiaan 4056b47d32 Removed tag Release-4.9.0 2012-09-07 07:10:32 -02:00
Shannon Deminick 5e9d791523 Moved the DocumentNotFoundHandler to diff namespace, created new NoTemplateHandler and updated the engine
to route to it when no template is selected and when there are no hijacked routes.
2012-09-07 08:28:18 +07:00
Shannon Deminick 9127061194 Added support for determining rendering engine based on template chosen. 2012-09-07 07:57:25 +07:00
Shannon Deminick 9563526108 re-reverted the global settings stripping trailing slashes as it is needed for the new
Routing pipeline.
2012-09-07 06:26:34 +07:00
Shannon Deminick 61d7dba2c0 Merge with 4.9.0 2012-09-07 06:24:51 +07:00
Shannon Deminick 8081d1d97b Merge with 4.9.0 2012-09-06 12:20:20 +07:00
Shannon Deminick 36c6dbb6be updated a doc 2012-09-05 09:36:30 +07:00
Shannon Deminick 56b7f8d98b Got .Field method for MVC working and have macro's rendering inside of RTE in MVC.
Added internal setting for global settings to return an MVC area string based on the umbraco path.
Added a ton of extension methods from v5 that are used in much of the MVC engines.
Added UmbracoHelper methods for MVC rendering including Field so that we can render the correct RTE
field markup when the RTE contains a macro, will add extension methods for the @CurrentPage dynamic object to
do the same to make it consistent.
2012-09-05 09:35:24 +07:00
Shannon Deminick bba5e6a59a Fixed issue with new UmbracoModule trying to strip the legacy umbPage query string stuff too early (still need to ask Niels about what this does)
Fixed issue with page update with Document ctor to try catch the Parent property. Removed a bunch of erroneous tracing and replaced with LogHelper.
2012-09-05 08:01:53 +07:00
Shannon Deminick 4dc181b4de Merge with 4.9.0 2012-09-05 07:25:31 +07:00
Shannon Deminick 792860a7bb updated a TODO 2012-09-05 07:22:39 +07:00
Shannon Deminick c3747d70ce Added ObjectExtensionsTests, Added functionality for MVC to render any macro types (i.e. razor and xslt, etc..)
Adds UmbracoHelper as a property to the RenderViewPage for MVC. Tested rendering Xslt and Razor macros with and
without parameters and works well.
Next we need to get the RTE rendering with macros embedded in MVC.
2012-09-03 07:54:09 +07:00
Shannon Deminick 2fc0fe574b Fixed XmlDocument GetProperty to check for user properties 'invariantly'.
Added a method on content to remove the file persistence queue just before it's written based on the module, this should hopefully speed things up and fix some potential issues.
Added an overloaded method on library for UpdateDocumentCache which should save on a few dozen sql calls when publishing a node since we already have
the Document object reference yet we were looking it up again for no reason.
2012-09-02 07:35:57 +07:00
Shannon Deminick a293f53438 Fixes type finder to ensure editorControls are found 2012-09-01 08:52:14 +07:00
Shannon Deminick 85b7574f43 Fixed unit test 2012-09-01 08:30:44 +07:00
Shannon Deminick c961eb368c Fixed up NiceUrl caching inconsistencies 2012-09-01 08:27:16 +07:00
Shannon Deminick 529c52844d Started writing NiceUrlProvider unit tests as there are a bunch of issues with it. Have fixed one of them.
Updated unit test hierarchy of classes so that if one doesn't require a db it can opt out and thus it runs much much faster.
2012-09-01 08:11:40 +07:00
Shannon Deminick 6949178f4b removed formHandlers.config... pretty sure we removed this functionality about a zillion versions ago.
Removed old Nant build folder and files.
removed the umbVersion query string check as this was used for the old preview functionality and isn't used anymore (plus it could never work the way its implemented).
2012-09-01 07:03:56 +07:00
Shannon Deminick 30ec9406de Merge with 4.9.0 2012-09-01 06:20:36 +07:00
Shannon Deminick 04f49d42cf Added unit tests for LookupByPageId ILookup 2012-08-31 07:43:09 +07:00
Shannon Deminick f0148ae833 Added more backwards compatibility to default.aspx 2012-08-31 07:27:17 +07:00
Shannon Deminick 4ced9cf8b2 updated more backwards compatibility with default.aspx 2012-08-31 07:22:41 +07:00
Shannon Deminick d0ab7e505d Updated unit tests for the module to inherit from proper base classes.
Updated default.aspx to support more backwards compatible features that had been removed, there
was a lot of breaking changes there!
2012-08-31 07:19:54 +07:00
Shannon Deminick b511ae3a1a Created new LookupByIdQuery ILookup which is now the first thing that is looked up. Have cleaned up
all of the default.aspx stuff so that no routing logic takes place there, all routing logic now takes
place entirely in the module.
2012-08-30 08:26:01 +07:00
sebastiaan 85d7d5e7cf Fixes U4-708 Sort order for new nodes is set wrong when the max sortorder != number of nodes 2012-08-29 13:48:34 -02:00
Shannon Deminick 05ebc8d2f9 Changed the Template prop of documentrequest to be a new TemplateLookup object since we are going
to need to support MVC and the old Template object is for webforms. I've added a lot of TODO's here
because we'll need to enable the lookups properly in each ILookup and also set the rendering engine (IsMvc)
in the ILookups too. This hasn't been enabled, yet, just a bunch of TODO's written.
2012-08-29 08:54:29 +07:00
Shannon Deminick b86d513aff Updated the new module to handle when no template is found (blank page) instead of the handlers (webforms or mvc) handling this. 2012-08-29 08:17:31 +07:00
Shannon Deminick c251c9f0d3 Changed the Is404 property on the doc request to be set by the last chance lookup, not by the module
because in the future if people override the last chance lookup, they might not want it to be 404, it will
be up to them.
2012-08-29 08:10:10 +07:00
Shannon Deminick 7be4480254 added HasValue unit test, removed the default.aspx file from the Web project, it now only exists in the UI project but
the codebehind still exist in the web for backwards compatibility. Updated the logging so that the LogHelper
can now write to a TraceContext specified if debugging which is handy if we want to write to the normal trace.
2012-08-29 07:47:16 +07:00
Shannon Deminick 3cd1592abc Added better support for Skip for DynamicDocument and DynamicNode and added unit tests. 2012-08-28 09:33:34 +07:00
Shannon Deminick bc3a5122dd Fixes DynamicNode issue not implementing IEnumerable<DynamicNode>
Adds a few unit tests for DynamicDocument/DynamicNode and fixes both to properly support the 'Take' method
as this wasn't really working. Not sure how or why it was working previously. Have also allowed for extension
methods to be executed against either of these objects that accept IQueryable which was not supported before.
2012-08-28 09:20:30 +07:00
Shannon Deminick 4d2b145369 Merge 2012-08-28 06:51:11 +07:00
Shannon Deminick 32350fd35a adds some docs 2012-08-28 06:51:01 +07:00
jholland@HQLT-JHolland.SCRIBEHQ.local a922272c67 Included swfobject.swf
Fixes: U4-624
2012-08-27 19:38:32 +04:00
jholland@HQLT-JHolland.SCRIBEHQ.local 3c7b5d7522 Widened content name field in backoffice
Fixes: U4-369
2012-08-27 23:33:06 +04:00
azzlack 33c07a2390 Updated AbstractDataEditor and AbstractDataEditorControl code comments. 2012-08-27 16:19:13 -02:00
"azzlack" d2210e9985 Updated AbstractDataEditor and AbstractDataEditorControl code comments. 2012-08-27 16:08:17 -02:00
Ove@EyeCatch-MPC 48e8e12877 Reverted some changes to AbstractDataEditorControl in 7260 to retain backwards compatibility. 2012-08-27 14:59:39 -02:00
sebastiaan 2b248e621c Merge in Azzlack/AbstractDataEditorFix 2012-08-27 11:14:06 -02:00
sebastiaan edfe6ed547 Merge uQuery dictionary fix from Azzlack/uQueryDictionaryFix 2012-08-27 10:48:13 -02:00
sebastiaan 6cffa06bd6 Merge 2012-08-27 08:08:26 -02:00
sebastiaan d08946c822 Merge 2012-08-27 08:07:50 -02:00
sebastiaan 6892c1afb8 Merge fixes getnodeidbypathlevel regression
http://ucomponents.codeplex.com/workitem/14727
2012-08-27 08:06:54 -02:00
sebastiaan 7cecb01ffd Merge fixes getnodeidbypathlevel regression
http://ucomponents.codeplex.com/workitem/14727
2012-08-27 08:06:30 -02:00
Matt@MBP13-PC 38d3d6b575 Updated ImageMediaFactory to support png transparency
Updated UmbracoFile to remove '.' from gif extension check
2012-08-27 08:01:51 -01:00
Shannon Deminick 528b06f692 Got the RenderViewPage rendering with the new DynamicDocument for the @CurrentPage property 2012-08-25 07:14:23 +07:00
Shannon Deminick 92602e3480 Added unit tests for legacy DynamicNode which now just runs tests on the abstract class so we share tests between
DynamicDocument and DynamicNode.
Fixes: #U4-691
Fixes: #U4-690
2012-08-25 07:07:00 +07:00
Casey Neehouse f18e59575f Changed versionDate to be set from application as possibly related to u4-387 2012-08-24 21:58:53 +04:00
Shannon Deminick 64c9d97e53 Got extension methods working on DynamicDocument/DynamicDocumentList and added unit tests
for them.
2012-08-24 23:44:47 +07:00
Shannon Deminick 71fd352ea5 Merge with 4.9.0 2012-08-24 22:41:27 +07:00
Shannon Deminick fbd20fd4b1 Removes 'OLD' root folder 2012-08-24 22:41:00 +07:00
Shannon Deminick b0f77a38f0 Merge with 4.9.0 2012-08-24 22:38:03 +07:00
leekelleher bf5c3bf5ae Fixes U4-688 - 4.8.1 can't upgrade using SQLCE
(Also preparation for resolving U4-677 - SQLCE Medium Trust)
2012-08-24 13:56:39 -01:00
leekelleher e9e598d32c Corrected typo (macro/xsltExtensions) 2012-08-24 13:14:52 -01:00
PerPloug b2eeb6a70d Script rename, fixes a couple of IE bugs, much more stable now, much better in
IE now, so with a bit of more thorough use, it could be included by default for
IE
2012-08-24 07:01:54 -02:00
PerPloug 9e4cf35370 Small script name change to reflect custom codearea script 2012-08-24 07:00:04 -02:00
leekelleher ebd87e0eaa Implemented U4-86 - Move EXSLT references from being predefined in core to xsltExtensions.config 2012-08-23 17:55:45 -01:00
Shannon Deminick d369567f3f Fixes .proj merge issue 2012-08-23 23:13:55 +06:00
Shannon Deminick ba0b0ea52d Merge with 4.9.0 2012-08-23 22:33:52 +06:00
Shannon Deminick f36a88384d Migrated UmbracoSettings, GlobalSettings, XmlHelper, IOHelper and supporting classes to Umbraco.Core.
This fixes the need for Umbraco.Core to reference business logic since business logic needs to reference
Umbraco.Core (Umbraco.Core should never reference any other project except for interfaces, it is the 'Core'
of the new codebase.
2012-08-23 22:28:22 +06:00
Shannon Deminick 7fb89da4db Merge with 4.9.0 2012-08-23 22:05:07 +06:00
leekelleher 19f7ba1ef4 MNTP: Applied CSS fix to the header style. Bug raised on uComponents.
http://ucomponents.codeplex.com/workitem/14746
2012-08-23 14:19:00 -01:00
leekelleher 23532b0ec8 Nested a Web.config transform file 2012-08-23 11:01:31 -01:00
leekelleher 47042ed3d3 Implemented U4-193 - Feature Request: Add meta tag to enable use of Chrome Frame in IE 2012-08-23 10:49:50 -01:00
leekelleher 0c57e0e6eb Updated my web.config transforms for Medium Trust support 2012-08-23 10:49:19 -01:00
Hartvig@UMBRACOTESLA ace18acd7e Missing web.config.templates and a missing stylesheet for the codemirror 2012-08-22 19:01:14 -02:00
Casey Neehouse b91fa1a8f2 Fixes Issue U4-387 - HasPendingChanges method was added and the comparison was
converted from rounded seconds into milliseconds.  So effectively time was set
from 1.5 seconds lapse to .5 seconds lapse. Change to 2 seconds lapse.

May still occur on slow db connections or rather large document types.
//original code commented in the Tree:
Math.Round(new TimeSpan(dd.UpdateDate.Ticks - dd.VersionDate.Ticks).TotalSeconds, 0) > 1
2012-08-22 18:46:55 +04:00
PerPloug 7a84761810 Fixes build errror because method GetPropertyTypes() has been replaced with
GetAll() - this is a breaking change who the F* changed that?
2012-08-22 12:02:28 -02:00
PerPloug 18200aa997 Flet 2012-08-22 12:00:04 -02:00
PerPloug bd0ebeb092 Dublicate files in Umbraco.Web.UI 2012-08-22 11:59:42 -02:00
PerPloug 358610655b Changes to javascript and css editors 2012-08-22 11:58:32 -02:00
PerPloug fa3f79c0e4 Changes to Pythin (cshtml) xslt and template editors 2012-08-22 11:55:57 -02:00
PerPloug d25fae730d Custom umbraco code area wrapper changes around codemirror 2 2012-08-22 11:55:19 -02:00
PerPloug 5b150c74ac Codemirror 2 core files 2012-08-22 11:54:40 -02:00
PerPloug 83fcdcfd86 CodeArea Control to support Codemirror 2 options 2012-08-22 11:53:57 -02:00
hartvig bd058d649a Fixes U4-673 2012-08-22 11:05:25 -02:00
hartvig ec638b9c3e Fixes U4-672 2012-08-22 10:20:59 -02:00
Matt@MBP13-PC 7b4bf6e502 Fixed issue with file uploader not working in IE
Fixed issue with folder browser response getting cached
2012-08-22 07:03:50 -01:00
Shannon Deminick d7f8214d24 Got extension methods working for DynamicDocument. Exposes some new APIs publicly because they need to work with type finding and med trust, plus we need to expose these for MVC 2012-08-22 08:33:19 +06:00
Shannon Deminick 22c0350a4a Have deprecated more of the dynamic class in the macroEngines project to proxy to the
classes in the Umbraco.Core project.
2012-08-22 07:47:21 +06:00
Shannon Deminick 3222d39808 Moved all classes for legacy DynamicNode into seperate files so we can easily identify what is there and
obsolete them properly.
2012-08-22 07:08:05 +06:00
Shannon Deminick 33c339a724 Moved all classes for legacy DynamicNode into seperate files so we can easily identify what is there and
obsolete them properly.
2012-08-22 07:07:52 +06:00
Shannon Deminick e9c793cede Fixed difficult merge 2012-08-22 05:57:34 +06:00
Shannon Deminick 1cbd355a2a Merge with 4.9.0 2012-08-22 05:38:45 +06:00
Shannon Deminick bee73cce12 Changed IApplicationEvents to IApplicationEventHandler.
Removed all reflection calls to BindingFlags.NonPublic which was mostly used by DynamicNode, this will
not work in medium trust.
2012-08-22 05:21:02 +06:00
Matt@MBP13-PC f5d258b42d Added thumbnail size selector to folder browser 2012-08-21 08:59:10 -01:00
Matt@MBP13-PC c1278674c3 Added throbber to library to show progress whilst loading media items 2012-08-21 08:17:07 -01:00
Matt@MBP13-PC 605e66c159 Fixed issue with Media factories saving relative file path rather than URL
Added styling to file uploader to show errored and canceled uploads including tooltip message
2012-08-21 07:53:07 -01:00
Matt@MBP13-PC b86bbb0e82 Tweaked some file uploader styles 2012-08-21 07:06:07 -01:00
Matt@MBP13-PC 930dd74edb Merge 2012-08-21 06:54:52 -01:00
Matt@MBP13-PC d30b5b0b2c Updatedt TinyMCEWebControl.cs to use IFileSystem 2012-08-21 06:42:01 -01:00
leekelleher 8e785cc215 Resolved U4-385 Hard Coded word "Packages".
The tree alias was called "packager" instead of "packages".
(Will update the GitHub Localization project too!)
2012-08-20 21:16:27 -01:00
Matt@MBP13-PC efe0970245 Updated UmbracoMetaWeblogAPI.cs to use IFileSystem 2012-08-20 13:55:51 -01:00
Matt@MBP13-PC 15264d36f0 Removed unused method from TinyMCEWebControl 2012-08-20 12:37:30 -01:00
Matt@MBP13-PC 298e06974e Updated mediaService to use IFileSystem 2012-08-20 12:36:56 -01:00
Matt@MBP13-PC 91acf40b3b Updatedt tinyMCEImageHelper to use IFileSystem when creating scaled images 2012-08-20 11:56:16 -01:00
Matt@MBP13-PC 085f4a4fcf Updated Document code to use IFileSystem when copying
Added some helper extention methods for IFileSystem
2012-08-20 11:42:18 -01:00
Matt@MBP13-PC 3e2510cbda Added code to auto seek stream to begining when saving via IFileSystem just in case 2012-08-20 10:51:14 -01:00
Matt@MBP13-PC 2775d9bedc Removed AbstractFileSystem in favour of extension methods
Updated UmbracoFile to use IFileSystem
Updated UmbracoMediaFactories to use IFileSystem
2012-08-20 10:46:32 -01:00
Matt@MBP13-PC 7afbc8e7bf Merge 2012-08-20 09:43:19 -01:00
Matt@MBP13-PC 3a2ed918de Added dynamic wrapper support to IFileSystem to allow context specific implementations from which to hang extension methods upon (ie IMediaFileSystem) 2012-08-20 09:42:32 -01:00
Matt@MBP13-PC 847b3523a8 Made folder browser filtering client side 2012-08-20 09:41:28 -01:00
Shannon Deminick 72ac3532d2 Updated DynamicDocument to be much more readable and allows for inheriting the structure so we can potentially use it
in DynamicNode (to be inherited from)
2012-08-20 11:22:45 +06:00
Shannon Deminick e24e3af955 Added DynamicDocument tests for getting a converted value for a custom PropertyEditorValueConverter, updated
DynamicDocument with performance enhancements, should perform much quicker for multiple requests for the same property now.
2012-08-20 09:11:14 +06:00
Casey Neehouse 3180b5c5b6 Additional RenderTemplate modification to reset context in error situations. 2012-08-19 11:25:44 +04:00
Casey Neehouse 480f73dba7 Corrections to RenderTemlate(pageId) method to reset context and remove
altTemplate from the rendering page.
2012-08-19 09:26:13 +04:00
Shannon Deminick 56a13c5e0c Created new IPropertyEditorValueConverter for use with DynamicDocument so we don't have to rely on
any more xml configuration sections to created and add value 'mappers' / converters. This saves on tons
of code and makes it really easy for devs to handle their own conversions for use with dynamic node.
2012-08-18 11:39:18 +06:00
Shannon Deminick 7175860ae0 Added tests for dynamic node to select children based on the child doc type names including pluralized names and added
support for checking with case insensitivity. Example. CurrentPage.NewsItems where NewsItem is a child doc type alias.
Found one reason why the old dynamic node has performance issues and have added a note, just need to do more reseearch to
make sure my findings are correct.
Changed over all of the new DynamicNode classes to be DynamicDocument instead.
2012-08-18 11:03:30 +06:00
Shannon Deminick 9177257952 Fixed/Cleaned up new dynamic node, added more support for member properties such as propertyId and added much better
support for camel case vs pascal case names. Also added support for returning the strongly typed value for reflected properties.
Also added support for handling "@" prefixed property names when using GetProperty("@Id") or similar.
Added unit tests for all of the above and other dynamic node methods.
2012-08-17 14:02:29 +06:00
Shannon Deminick 3da387591d Deprecated many of the classes for Dynamics in the macro engines project and proxied these calls
to the superceded classes.
2012-08-17 06:22:51 +06:00
Shannon Deminick 5213d6de5c renamed IContentStore to IPublishedContentStore. Migrating DynamicNode to Umbraco.Core and cleaning up it's supported codebase.
Starting writing a few unit tests for the new DynamicNode codebase. Will of course leave the original DynamicNode stuff in its
current place for backwards compatibility but will deprecate many of the classes which will call the new ones.
2012-08-17 04:27:47 +06:00
Matt@MBP13-PC bd5182792e Added double click to edit support 2012-08-16 10:31:00 -01:00
Matt@MBP13-PC b057b6d68a Implemented media sorting 2012-08-16 10:03:37 -01:00
Matt@MBP13-PC 0bc1234a4e Fixes issue with missing master pages
Re-added missing build script
2012-08-16 07:06:46 -01:00
Casey Neehouse 8b76f2a893 Added hostname to title on login.aspx for support purposes. 2012-08-16 02:27:08 +04:00
Casey Neehouse 943e53f655 Adding config template. 2012-08-16 01:15:54 +04:00
Shannon Deminick 9846d6dc4d Merge with 4.9.0 2012-08-15 23:21:12 +06:00
Shannon Deminick 4e9f9b77f4 Created CultureDictionaryFactoryResolver for use in the new MVC views which returns a ICultureDictionary.
This allows us in the future to use any type of data source for the dictionary. Have obsoleted the old
ICultureDictionary in the macro engines project (where it doesn't belong anyways). The new one doesn't expose
the 'Language' property to the front-end because this is a business logic class which means designers can just delete
a whole language from the db by calling 'Delete' on the object !
2012-08-15 23:20:37 +06:00
Shannon Deminick 91e9392992 Re-removed umbraco version header after bad merge and removed from new routing module.
Started addding new ICultureDictionary since this cannot belong in the macros project.
2012-08-15 21:21:31 +06:00
hartvig 6093e4ff5e Adds CDT property to ContentType class 2012-08-15 09:07:28 -02:00
Shannon Deminick 2f4a18087d Fixes issue with trailing slashes and reserved urls 2012-08-15 01:23:57 +06:00
Shannon Deminick f52ae8c46b Adds unit tests for LookupByNiceUrlAndTemplate and fixes issues for when paths contain .aspx 2012-08-15 01:01:21 +06:00
Shannon Deminick ce53f400a8 Re-instated the build script... this got deleted during a bad merge!
Fixed the UI proj file with the correct attributes for the FileSystemProviders.config
2012-08-15 00:22:42 +06:00
Shannon Deminick b9b24990b6 Merge with 4.9.0 2012-08-15 00:08:38 +06:00
Shannon Deminick b596b3584e Added lookup by id tests. 2012-08-14 23:56:23 +06:00
Shannon Deminick 05f8778e40 Adds another unit test for the RenderRouteHandler 2012-08-14 23:42:44 +06:00
Shannon Deminick ed4de4465f Added RenderRouteHandlerTests 2012-08-14 23:35:34 +06:00
Matt@MBP13-PC 766a834f53 Updated the Image thumbnail provider to use IFileSystem 2012-08-14 12:24:51 -01:00
Matt@MBP13-PC 546b53f9b0 Merge 2012-08-14 09:12:36 -01:00
Matt@MBP13-PC e2274b7892 Hooked up IFileSystem to the file uploader / IFile 2012-08-14 09:11:49 -01:00
hartvig c11bc9559c Implements U4-165 2012-08-14 07:45:47 -02:00
Shannon Deminick d95b688a7f Adds new IUmbracoEvents: #U4-164 2012-08-14 12:03:34 +06:00
leekelleher d329123cda U4-163 Picker Relations - reincluded data-type; previous fixes for U4-162 resolved issues. 2012-08-13 23:02:17 -01:00
leekelleher aceb5b0203 U4-162 Relation Types - Resolves MySQL issues; re-enabled Tree attribute.
Changed umbraco.DataLayer project to use .NET 4.0, (was previously using 3.5), reason being that we could use Guid.Parse.
Also resolves workitem:30434 - Error when copying node and keeping relation between original and copy.
2012-08-13 22:45:01 -01:00
Matt@MBP13-PC 524244d1ec Added FileSystemProviders config section
Added FileSystemProviderManager class for fetching a file system provider by alias (this should probably be moved into the Umbraco context in 4.10)
2012-08-13 13:26:06 -01:00
Matt@MBP13-PC ad291265f3 Added PhysicalFileSystem constructor overload to work out the rootPath / rootUrl from a virtualRoot path (Can only work with a valid HttpContext) 2012-08-13 10:23:45 -01:00
Matt@MBP13-PC d2ac9158c6 Added IFileSystem
Fixed issue with last merge
2012-08-13 10:04:31 -01:00
Matt@MBP13-PC f6e59e0264 Merge with 4.8.1 (2nd) 2012-08-13 06:38:43 -01:00
Matt@MBP13-PC 8afa6298e0 Merge with 4.8.1 (2nd) 2012-08-13 06:24:52 -01:00
shannon@ShandemVaio f6436d2eee Added unit tests for LookupByAlias which are now all passing. 2012-08-10 23:46:09 +06:00
shannon@ShandemVaio 813fcf5903 Fixed up minor issues with content store changes, web site is now rendering with new IDocument engine. 2012-08-10 13:55:22 +06:00
shannon@ShandemVaio c522ad6e30 Created an ContentStoreResolver so we can specify a custom ContentStore which means we can return a custom
IDocument. This now means we've opened up the possibility of an abstracted routing lookup system to map to a Document
stored anywhere. By default this is obviously Xml but could theoretically be anything, still internal until more review
of the API is done.
2012-08-10 13:38:02 +06:00
shannon@ShandemVaio a858712bcc Change namespace from Umbraco.Web.Model to Umbraco.Web.Models 2012-08-10 13:19:25 +06:00
shannon@ShandemVaio e131011667 Rename namespace from Umbraco.Core.Resolving to Umbraco.Core.ObjectResolution 2012-08-10 13:18:13 +06:00
shannon@ShandemVaio 3415554142 Moves types into matching files. 2012-08-10 13:11:37 +06:00
shannon@ShandemVaio 61c4a9e68d Created IDocument and IDocumentProperty to one day replace INode since it doesn't contain enough information
and is poorly formatted, this now allows us to properly abstract an IDocument using the new IContentStore which now
returns IDocument instead of XmlNode so we now have an abstraction away from Xml for routing.
2012-08-10 13:08:47 +06:00
shannon@ShandemVaio 7280dbc66e Finished LookupByNiceUrl unit tests, all passing. 2012-08-09 11:22:34 +06:00
shannon@ShandemVaio 67e921f862 Added check to UriUtility to check for default.aspx since this path will show up for pre-IIS7 websites, added
unit tests for UriUtility, updated UmbracoModule to use the UmbracoUrl to pass to the document request.
Added more unit tests for LookupByNiceUrl.
2012-08-09 11:08:24 +06:00
shannon@ShandemVaio e75aebc4fd Fixed up an issue with the ContentStore, added more unit tests to prove the fix is correct, added more unit tests
for the LookupByNiceUrl IDocumentLookup which all pass.
2012-08-09 07:41:13 +06:00
shannon@ShandemVaio 2e5db72a09 Updated DocumentRequest so that it doesn't actually do the searching, it acts more like a model.
The DocumentSearcher now performs the searching and sets the properties on the DocumentRequest, this
simplifies the dependencies between the contexts. Updated the LookupByNiceUrlTests unit test, now all
initialization is working and the test runs which will be the basis for testing all of the IDocumentLookups.
2012-08-09 04:15:35 +06:00
shannon@ShandemVaio 739de3ef78 Started writing tests for all DocumentLookups as these all require many tests including tests for
routes when using IIS 7 and pre-IIS 7 platforms.
2012-08-08 23:55:55 +06:00
shannon@ShandemVaio 626b9ceefa Updated Web.UI project to support MVC and VS MVC dialogs.
Updated RenderViewPage to include UmbracoContext and DocumentRequest.
2012-08-08 23:37:54 +06:00
shannon@ShandemVaio 4111298b00 Got routing working properly with MVC and our HttpModule 2012-08-08 23:10:34 +06:00
Matt@MBP13-PC cd56882845 Media grid now refreshes after uploads have completed 2012-08-08 12:09:22 -01:00
Matt@MBP13-PC 37ddb9223f Added friendly name support to DMU webservice to allow uploaded files to set the media items friendly name 2012-08-08 11:54:52 -01:00
Matt@MBP13-PC 44a15900c7 Removed upload method from FolderBrowserService as re-using the DMU web service instead 2012-08-08 09:26:25 -01:00
Matt@MBP13-PC ccd56f5594 Hooked up support for overwriting
Made DMU web service check for logged in user if no credentials are passed in
2012-08-08 09:08:09 -01:00
Matt@MBP13-PC a989ea77ff Switched DMU web service to support XML and JSON so can be used by media dashboard aswell
Added dmu.ashx file in old plugin folder to add backwards compatability
2012-08-08 08:37:07 -01:00
shannon@ShandemVaio 9e611ba8f4 Updated new GlobalSettings version 2012-08-07 21:42:11 +06:00
shannon@ShandemVaio 6f8b016728 Merge with 4.9.0 2012-08-07 21:41:24 +06:00
shannon@ShandemVaio d92d309c61 Added initial MVC supporting files and updated some unit tests. 2012-08-07 21:40:34 +06:00
Matt@MBP13-PC 872ef1fadc Added Multi-file delete support to media grid
Added file name change support to multi-file uploader
2012-08-07 09:30:11 -01:00
Matt@MBP13-PC 9b8d40ee2d Fixed broken noNodes page 2012-08-07 07:53:19 -01:00
shannon@ShandemVaio d9eb8b426c Added TODO notes for NiceUrlProvider to fix an issue for Stephan. 2012-08-07 04:55:27 +06:00
shannon@ShandemVaio ef0d7821eb Fixes default url cache to use concurrentdictionary instead of custom locks as this was causing errors.
Updated the references between context objects since a DocumentRequest should only be set when rendering
a front-end doc, not in the back office.
Fixes the LookupByNiceUrl to work with non directory paths.
Fixes the UmbracoContext.ClientUrl to work properly.
2012-08-07 03:54:47 +06:00
shannon@ShandemVaio b68bcba85e Updated UmbracoModule to support the TransferRequest just like umbraMVCo does using query strings. Added more
unit tests for UmbracoModule, refactored the Umbraco.Web.Routing.Domains to not have static methods and created an
interface for it so that we can unit test it. Changed DocumentRequest stuff to internal. Finally got unit test working for the module
2012-08-07 02:33:08 +06:00
shannon@ShandemVaio fbf94bbf01 Fixed module with client side perf check, added unit test 2012-08-06 23:04:08 +06:00
shannon@ShandemVaio 19205f1435 Improves perf of UmbracoModule rendering, adds unit test for UmbracoModule, fixes StateHelper with HttpContext.Current,
Fixes Action with empty JsSource, Fixes GlobalSettings to be unit testable, adds medium trust config
section to my own transform.
2012-08-06 22:40:06 +06:00
Matt@MBP13-PC 1e271455e8 Added multi select / drag to re-order support 2012-08-06 10:57:41 -01:00
Matt@MBP13-PC 1ad7abcd69 Incremented global version number 2012-08-06 07:47:53 -01:00
Matt@MBP13-PC 7a93c108fb Merge with 4.8.1 (2nd) 2012-08-06 07:20:46 -01:00
sebastiaan c8ac04228e Workitem: 30933 - Missing language packs breaks TinyMCE (4.8) --> Language packs re-included 2012-08-04 17:32:21 -02:00
shannon@ShandemVaio 11a6b2a31f Changed ThumbnailProviderManager to ThumbnailProvidersResolver and initializes it in WebBootManager 2012-08-04 06:20:06 +06:00
shannon@ShandemVaio 58dec4774d Merge with 4.9.0 2012-08-04 06:12:02 +06:00
shannon@ShandemVaio 7235141f02 missing readme file content 2012-08-04 06:10:12 +06:00
shannon@ShandemVaio 32bef227b7 Added App_Code assembly loading to new type finder, had to recompile log4net to support medium trust.
Updated TypeFinder and assembly info to support medium trust.
2012-08-04 06:07:29 +06:00
sebastiaan 082378815f Fixes issue 30965 - Pipe character in URL causes YSOD 2012-08-02 16:39:15 -02:00
sebastiaan f8bdb42a63 Fixes issue 30905 - Checkbox "Include unpublished child pages" for Dutch Language doesn't work 2012-08-02 16:34:05 -02:00
Matt@MBP13-PC 86be51f7ce Added missing files 2012-08-02 09:31:35 -01:00
Michael Wulff Nielsen 5e720ec965 Fixed GetNodeIdByPathLevel regression from uComponents 2012-08-02 07:27:31 -02:00
Michael Wulff Nielsen 7a274bf429 Fixed GetNodeIdByPathLevel regression from uComponents 2012-08-02 07:26:21 -02:00
shannon@ShandemVaio a539fd2554 Fixes DataTypesResolver namespace 2012-08-01 23:53:19 +06:00
shannon@ShandemVaio 8a192a0065 Renamed TypeFinder2 to Umbraco.Core.TypeFinder. Obsoleted old TypeFinder and cleaned up non-used methods
in the new TypeFinder. Updated some unit tests and removed benchmark tests since we already have the benchmarks.
2012-08-01 23:50:33 +06:00
shannon@ShandemVaio 923f4f517f Created ActionsResolver for creating IActions and updated Action class to use this now. Still needs
a bit of cleanup, see TODO notes in Action.cs
2012-08-01 23:30:37 +06:00
shannon@ShandemVaio d644b44d80 Created PackageActionsResolver object to deal with IPackageAction plugins. 2012-08-01 23:03:26 +06:00
shannon@ShandemVaio 2115146fdb Removed old MacroControlFactory - marked as internal FTW ! moved it to new MacroFieldEditorsResolver
using the new framework. Also moved PersistableMacroProperty to new assembly (it was also marked as internal).
Updated unit tests to work with Resolution and resetting resolvers.
2012-08-01 22:46:13 +06:00
shannon@ShandemVaio 646e96ab15 Changed PluginResolverType to PluginManager. Reinstated Resolution and ResolverBase<T> since
this gives us more control over all Resolvers and streamlines them. Created IBootManager, CoreBootManager and WebBootManager
to handle the application initialization including the creation of Resolvers. This means that if people are using the dlls outside
of the web app, they can run the boot strappers to initialize everything.
2012-08-01 22:06:15 +06:00
Matt@MBP13-PC 4049a77332 Made ThumbnailProviders internal for the time being. We'll make them public in 4.10 as this has a new / consistant way of loading plugins. 2012-08-01 08:37:18 -01:00
Matt@MBP13-PC cabe37014b Moved IThumbnailProvider interface to root of Umbraco.Core assembly 2012-08-01 08:13:45 -01:00
Matt@MBP13-PC 20fada8fd4 Converted ThumbnailProviderManager to singleton and made internal 2012-08-01 08:11:48 -01:00
shannon@ShandemVaio dff3905e85 Converted over ThumbnailProviderManager to ThumbnailProvidersResolver using the new apis. 2012-08-01 11:24:39 +06:00
shannon@ShandemVaio c2ee1e63bb Added unit tests for ManyObjectResolverBase for the different lifetime scope of instantiated objects. 2012-08-01 10:48:19 +06:00
shannon@ShandemVaio d4806895a9 Had to remove the Resolution freezing idea because we are lazily instantiating the singleton instances, otherwise
we have to instantiate them all on startup which means that all type searching happens on startup and not lazily which
is bad for performance. I don't think its a big deal that we're not freezing these objects, MVC doesn't freeze its singletons
and nobody seems to have a problem with it, people will just know not to modify these items after startup.
2012-08-01 10:15:39 +06:00
shannon@ShandemVaio bee357ffdc Obsoletes umbraco.cms.businesslogic.datatype.controls.Factory with new Umbraco.Core.DataTypesResolver 2012-08-01 10:05:39 +06:00
shannon@ShandemVaio a0a99e8f12 Obsoletes umbraco.presentation.cache with new Umbraco.Core.CacheRefreshersResolver
Have removed ResolverBase as we cannot rely on manually setting the current singleton object since applications outside of the standard umbraco web application
might be using these singletons and would expect they already be setup. Have changed all current resolvers to manage their
own singleton instances and sealed them.
2012-08-01 09:49:10 +06:00
shannon@ShandemVaio ddc2619511 Merge with 4.9.0 2012-08-01 06:31:28 +06:00
Matt@MBP13-PC 69b3645e9c Added Edit / Download context menu support for media library 2012-07-31 13:31:31 -01:00
Matt@MBP13-PC 4e1e7fe657 Added context menu to media grid
Restructured folderBrowser js class to be less clutered
2012-07-31 12:56:51 -01:00
Matt@MBP13-PC 2481a8df98 Updated fileUploader to use face uploader progress bar when uploading using iFrames. 2012-07-31 08:15:42 -01:00
shannon@ShandemVaio 76c99d3f47 Changed TypeFinder2 to be a static object as there's no reason to have it as an instance.
Still need to integrate the app_code stuff into the new one and then merge the old/new
2012-07-31 03:24:33 +06:00
shannon@ShandemVaio 2fd8d17be9 Changed Action over to use PluginTypeResolver to find IActions and added unit test for it. 2012-07-31 03:14:24 +06:00
shannon@ShandemVaio 5b8057f063 Updated cache refresher factory to use PluginTypeResolver and added unit tests to show that it
resolves the objects, fixes up the GetAll() call since I'm not sure if that actually ever worked.
2012-07-31 03:08:46 +06:00
shannon@ShandemVaio c9a4b708aa Fixes TreeDefinitionCollection to lazily load/find the trees 2012-07-31 02:45:18 +06:00
shannon@ShandemVaio 2537925350 Fixed up unit tests, enables logging for unit tests 2012-07-31 02:34:57 +06:00
shannon@ShandemVaio 5a3534bc52 Upgraded macr to use PluginTypeResolver to resolve XsltExtensions and added unit tests
to support finding these types.
2012-07-31 02:16:29 +06:00
shannon@ShandemVaio 5da0445c32 Updated TreeDefinitionCollection to use PluginTypeResolver and fixed its code to be thread safe.
Updated restExtensions to use PluginTypeResolver and added unit test for resolving these types.
Updated TypeFinder2 with a slight perf increase.
2012-07-31 01:56:03 +06:00
shannon@ShandemVaio 352d817fc1 Updates DynamicNode to use PluginTypeResolver, fixees DynamicNode RazorDataTypeModelTypes resolution
to be thread safe. Removes unused classes (we can put them back if we need them later)
2012-07-31 01:06:10 +06:00
shannon@ShandemVaio e55e688dc7 Added unit test for ContentStore, added object extensions and supporting classes from v5,
added RhinoMocks to the test project and httpcontext factory from v5 unit tests to be used
in our v4 ones.
2012-07-31 00:02:27 +06:00
shannon@ShandemVaio ec22d985ef Updated all lookups to use new logging system. Updated lookups resolvers to use ManyObjectResolverBase
and are just adding the known resolvers on app startup and commented out the other resolver stuff for now.
Fixed up xpath statement for resolving the first document, site now renders :)
2012-07-30 22:52:59 +06:00
Matt@MBP13-PC 3b6508e534 Merge 2012-07-30 10:23:01 -01:00
Matt@MBP13-PC 60ec172d37 Tweak to file uploader so that if the upload is complete, it just removes the UI item 2012-07-30 10:22:35 -01:00
shannon@ShandemVaio 95451e99a7 Reinstating persisting of xml cache file in new module. 2012-07-29 00:04:11 +06:00
shannon@ShandemVaio 1aa70c4bb8 Reinstated temporary new settings in the UmbracoModule and have changed UmbracoModule to reference
the new Umbraco.Core.Configuration settings instead of the legacy ones.
2012-07-28 23:53:07 +06:00
shannon@ShandemVaio 750f5b18d3 Changed the UmbracoModule to use new logging system and updated the log4net config (not release config) to
enable Debug calls.
2012-07-28 23:40:48 +06:00
shannon@ShandemVaio b7cea05f18 Added unit test for custom log file appender, integrated a few more classes from v5 for tracing,
added initial trace logging to application startup which works. Changed the application startup handler
to use new logging, now the system won't bork if the sql db isn't initialized.
2012-07-28 23:08:02 +06:00
azzlack b226be4939 Split AbstractDataEditorControl to separate class file.
Cleaned up code in AbstractDataEditor and AbstractDataEditorControl.
Made AbstractDataEditorControl inherit from INamingContainer to help with control id issues.
Made the ID and DataTypeName fields of AbstractDataEditor abstract so they must be implemented.
2012-07-27 21:34:58 -02:00
azzlack 16127a378a Fixed uQuery GetDictionaryItem method so it doesnt throw exception if the requested item does not exist, and returns fallback string instead. 2012-07-27 21:04:23 -02:00
shannon@ShandemVaio b09422ed5e Added Log4Net and supporting classes from v5 in order to start integration of new diagnostic logging system. 2012-07-28 01:28:39 +06:00
shannon@ShandemVaio b186d5f8e4 Migrated UmbracoSettings and GlobalSettings along with other supporting classes to Umbraco.Core.
Everything is still marked as internal until such time we can clean everything up.
2012-07-28 00:13:06 +06:00
sgay c4d578442b merge 2012-07-27 14:08:00 -02:00
sgay 83f76ed4a4 cosmetic & doc 2012-07-27 14:06:41 -02:00
sgay 74dd444506 merge 2012-07-27 04:48:53 -02:00
shannon@ShandemVaio 573c5a3387 Updated MacroControlFactory to use PluginTypeResolver and added unit test to ensure it finds the types. 2012-07-27 12:45:56 +06:00
sgay 872fb9d8f3 fix previous commit 2012-07-27 04:39:43 -02:00
shannon@ShandemVaio da0217d330 Updated PackageAction to use PluginTypeResolver and added unit test to ensure they are found. 2012-07-27 12:29:41 +06:00
shannon@ShandemVaio 507b6ab773 Updated MediaFactory to use PluginTypeResolver and added a unit test to ensure they are being found. 2012-07-27 12:23:22 +06:00
shannon@ShandemVaio 960dd52750 Created MacroEngineFactory tests, updated DataTypeFactory tests. 2012-07-27 12:14:27 +06:00
shannon@ShandemVaio 5576f65ef0 Updated DataType factory to use PluginTypeResolver and made the dictionary thread safe.
Updated MacroEngineFactory to use PluginTypeResolver and made it thread safe. Have also
updated it to only create one instance of each IMacroEngine per application which should
increase performance a teeny bit, plus that's how it should be.
2012-07-27 11:54:29 +06:00
shannon@ShandemVaio 1823cce4f6 Changed over Action to use PluginTypeResolver to find and instantiate IActionHandlers and included a unit test. 2012-07-27 10:53:40 +06:00
shannon@ShandemVaio 09a68f9376 Updated ApplicationTreeRegistrar to use PluginTypeResolver, created unit tests for resolving trees/applications 2012-07-27 10:37:12 +06:00
shannon@ShandemVaio 58fbe9f4ab Added new TypeFinder methods for resolving types with attributes. Updated the PluginResolver to resolve IApplication 2012-07-27 06:24:57 +06:00
shannon@ShandemVaio 92f983a569 Removed Freezing event as we won't need it 2012-07-27 06:02:41 +06:00
shannon@ShandemVaio 8082abc27a Added MultipleResolverBase 2012-07-27 05:52:01 +06:00
shannon@ShandemVaio 373fdd324b Fixes up ResolverBase and it's static lock object which isn't actually required because
our singleton is a getter/setter and field access is thread safe. Updated SingleResolverBase
to ensure that TResolved is a class so the null check works properly.
2012-07-27 05:25:26 +06:00
shannon@ShandemVaio dbe43a0918 Updated the PluginTypeResolver to have a generic way of instantiating the plugin types it has
already found. Have added some notes to some classes that need to be fixed up. Removed the PluginTypeResolver
from the ApplicationContext since it is a utility and isn't exposing application objects.
2012-07-27 01:01:34 +06:00
shannon@ShandemVaio a6b9aca45a Changed PluginResolver to PluginTypeResolver, created new base method to do the resolution and caching,
Updated ApplicationStartupHandler to use it and to not register on the static method, the real method is now
used and is called on app startup (much cleaner). Added tests for PluginTypeResolver. Added events to
UmbracoApplication and virtual methods for developers to override.
2012-07-27 00:40:00 +06:00
shannon@ShandemVaio 1731ad45f5 Had to manually merge some stuff and fix up some class names/locations. I think some files
and changes had not been committed properly.
Fixed up some resolver classes to ensure the generic type is a class so == null works properly.
Changed to internal until we decide to expose.
2012-07-26 23:05:51 +06:00
shannon@ShandemVaio 32e8a1a5dc Merge 2012-07-26 22:53:58 +06:00
shannon@ShandemVaio 466d871ede Fixes Umbraco.Web reference in editorControls project 2012-07-26 22:34:56 +06:00
shannon@ShandemVaio 25037ed9c8 Fixes Umbraco.Web reference in editorControls project 2012-07-26 22:31:41 +06:00
sgay 53f6577b32 write xml doc 2012-07-26 14:21:47 -02:00
shannon@ShandemVaio a78b5f50dd Merge with 4.9.0 2012-07-26 22:19:52 +06:00
shannon@ShandemVaio 15c5b5de57 Moved type helper methods from TypeFinder2 to TypeHelper. Created SystemUtilities for detecting
app trust levels. Updated all calls to TypeFinder to TypeFinder2 and updated tests.
2012-07-26 22:19:08 +06:00
shannon@ShandemVaio 62d6db935d Integrating v5 TypeFinder. Imported a few classes from v5 regarding utility classes and partial trust
unit test helper classes. Changed calls from old TypeFinder to new TypeFinder2. Created benchmark unit
tests to test speed differences between them.
Fixes: 30946 - IOHelper with HttpContext issue
Fixes: 30945 - AppCodeFileExtensions issue with UmbracoSettings
2012-07-26 21:12:54 +06:00
sgay fec2e0eb6e rename routing 'resolvers' to 'lookups' 2012-07-26 12:56:41 -02:00
leekelleher 0eefbdc610 uQuery: Random never takes last element (applied from uComponents changeset 018bd63444b6) 2012-07-26 12:12:38 -01:00
Matt@MBP13-PC fe87f6b89f Added js file uploader code
Can now drag and drop files in, and trigger upload sequence.
2012-07-26 12:11:42 -01:00
sgay a08c698c77 merge 2012-07-26 07:54:36 -02:00
sgay 6b4fff176a refactor resolution of components 2012-07-26 07:52:13 -02:00
Sebastiaan Janssen 514326adfe Merge with 4.8.0 2012-07-25 07:35:15 -02:00
Matt@MBP13-PC ef0f8b5282 Created ThumbnailProviders for folder browser to allow custom thumbnail generation based on file ext 2012-07-24 10:06:07 -01:00
Matt@MBP13-PC 135bfc6d94 Move FolderBrowser control to Umbraco.Web project 2012-07-24 06:19:30 -01:00
shannon@ShandemVaio 5fcd8b1d52 Fixed file names of ReadLock and UpradeableReadLock. Fixes up UpgradeableReadLock to ensure
that it it is upgraded it releases its writelock on dispose. Fixes up RouteLookups to have
correct locking. Fixes up library to resolve the NiceUrlResolver using the UmbracoContext.Current
singleton acessor.
2012-07-23 23:03:00 +06:00
Matt@MBP13-PC 82ca2609ec Made a start on the folder browser control
Added base2 js library
2012-07-23 14:29:52 -01:00
Matt@MBP13-PC fdcc81003d Added knockout js library 2012-07-23 10:28:53 -01:00
Matt@MBP13-PC c51267136c Upgraded tags datatype to use jQuery tags input plugin gor a nicer UI (still works the same under the hood) 2012-07-23 10:05:29 -01:00
Matt@MBP13-PC 9f60e49a32 Added missing project reference 2012-07-23 06:59:26 -01:00
slace 74b8b4f147 merging two PRs into the 4.9.0 branch 2012-07-22 13:28:56 -10:00
sgay 3546b3e954 refactor routing 2012-07-22 14:01:18 -02:00
Stephan 533cc91a68 merge 2012-07-20 19:09:30 -02:00
sgay 5fbf4379cc refactor routing 2012-07-20 18:54:59 -02:00
shannon@ShandemVaio d9faea49ec Changed the ILookup resolution, now that DocumentRequest object contains everything to do the lookups
we don't have to create each ILookup per request, these can exist one  per application.
2012-07-21 00:59:27 +06:00
shannon@ShandemVaio 36e3857643 Ensures the legacy UmbracoContext is created. 2012-07-21 00:47:17 +06:00
shannon@ShandemVaio fa469416a2 added note 2012-07-21 00:44:58 +06:00
shannon@ShandemVaio c60abf747c Updated the default.aspx and page classes to match what Stephen had in his fork.
Have updated the web.config to use the new HttpModule but the XPath statement that is generated
for the LookupByPath doesn't seem to be matching my root node. But everything else is actually working!
2012-07-21 00:42:11 +06:00
shannon@ShandemVaio be51bfa67f Changed RoutingEnvironment to RoutingContet. Cleaned up how the context reference each other, now
this starts making a bunch of sense. Have empty ctor's on all ILookups since their methods get passed a
 DocumentRequest object which has access to all of the context's and properties that they will ever need.
2012-07-21 00:20:50 +06:00
shannon@ShandemVaio 8f278bcaa5 Added singleton for managing ILookups collection, allows for adding/removing/inserting at runtime/startup 2012-07-20 23:42:55 +06:00
shannon@ShandemVaio 6c872e8a65 Implements singly registered RoutesCache object and re-interfaces IRoutesCache which can now be
set at runtime. Exposes UmbracoContext via DocumentRequest which simplifies some things. Removes
dependency on UmbracoContext from DefaultRoutesCache, now InPreviewMode is checked before passing
processing to the IRoutesCache provider. Changed NiceUrls to NiceUrlResolver.
2012-07-20 23:10:43 +06:00
shannon@ShandemVaio 1b9e226f61 Moves app initialization into new UmbracoApplication (global.asax) 2012-07-20 22:02:28 +06:00
shannon@ShandemVaio 25b06a88ab Began integration of Stephen's new routing logic. The sln compiles and things have been refactored
from the initial concept. The module is not active as it currently will not work because of
contructor dependencies and classes marked as internal, will liase with Stephen regarding this.
2012-07-20 01:04:35 +06:00
shannon@ShandemVaio f2c084feda Merge with 4.9.0 2012-07-19 22:52:34 +06:00
shannon@ShandemVaio f83ae489db Fixes remaining circular dependencies and updates the build script to not have
to manually build these projects seperately :)
fixes: #U4-77
2012-07-19 22:48:09 +06:00
shannon@ShandemVaio 00c18fe764 Fixes first circular dependency with webservices (#U4-77) 2012-07-19 22:38:33 +06:00
shannon@ShandemVaio ce90e114df Update to use IISExpress #U4-75 with Aarons fixes 2012-07-19 22:15:15 +06:00
shannon@ShandemVaio c205197683 Fixes up build script to build Umbraco.Web.UI project 2012-07-19 22:01:36 +06:00
shannon@ShandemVaio b13c16ddc2 Moved remaining classes/files into "umbraco.presentation" folder 2012-07-19 21:49:42 +06:00
shannon@ShandemVaio 8c9e19c0b7 Ensures language files are included in solution 2012-07-19 21:45:55 +06:00
shannon@ShandemVaio 14dd4fcd68 Moved files in Umbraco.Web to "umbraco.presentation" folder to keep old 'legacy' stuff in one place
so its easier to move forward with the new namespaces/code.
2012-07-19 21:38:56 +06:00
shannon@ShandemVaio d82bb9bff1 Merge with 4.10.0 2012-07-19 21:18:51 +06:00
shannon@ShandemVaio 4b819c081e Merge with 4.9.0 2012-07-19 21:18:05 +06:00
shannon@ShandemVaio c91ef375ba Merge with 4.8.0 2012-07-19 21:17:25 +06:00
shannon@ShandemVaio 82d8e2854a updates ignore file so that it doesn't keep wanting to update the web.config 2012-07-19 02:25:59 +06:00
shannon@ShandemVaio 7e5f4c20bf Updates the circular reference projects post builds to build to Umbraco.Web.UI
(now we can actually look at fixing these references! :)
2012-07-19 02:25:13 +06:00
shannon@ShandemVaio 6e459a3afb Fixes namespace issues when changing default namesapce to Umbraco.Web as the autogen
classes namespaces were changed.
Removed post build and custom targets from Umbraco.Web
2012-07-19 02:19:32 +06:00
shannon@ShandemVaio 2e8ab316fe re-removing the presentation stuff that was merged back in. 2012-07-19 01:32:59 +06:00
shannon@ShandemVaio c4760e0593 manually merged in tinymce language changes. 2012-07-19 01:23:53 +06:00
shannon@ShandemVaio 0f8797096d Merged with 4.9.0 2012-07-19 01:22:22 +06:00
shannon@ShandemVaio 9a1935e6ea Fixes small merge issue 2012-07-19 01:06:39 +06:00
shannon@ShandemVaio 25bd7b8ad7 Merge with 4.8.0 2012-07-19 01:02:16 +06:00
shannon@ShandemVaio 7ca29b87f3 Removed all client side files as they now exist in Umbraco.Web.UI 2012-07-19 00:52:58 +06:00
shannon@ShandemVaio 9679d0f6df Renamed umbraco.presentation to Umbraco.Web and changed the folder it resides in.
Started removal of files/folder from Umbraco.Web that belong in Umbraco.Web.UI.
2012-07-18 23:54:20 +06:00
shannon@ShandemVaio 62f4db0b76 added Umbraco.Web.UI containing only web rendering files 2012-07-18 04:35:30 +06:00
shannon@ShandemVaio 8046a778bd Fixes the UmbracoRequest, UmbracoResponse, UmbracoServerUtility to use the Base classes
not the wrapper classes since this is incorrect, now they are at least abstracted so they
don't rely on the real HttpContext but these should be obsoleted and not used but thats
a different story
2012-07-18 02:59:00 +06:00
shannon@ShandemVaio 23b2899101 Imports many of the useful extension methods from v5 that are also used in umbraMVCo to begin the
MVC integration.
Imported the unit tests associated with each of these imported classes.
2012-07-17 03:51:34 +06:00
shannon@ShandemVaio 6c8d72576c Creating 4.10.0 branch 2012-07-17 03:29:25 +06:00
shannon@ShandemVaio 10f2d9b3ed Updated assembly info for Umbraco.Web proj 2012-07-17 03:28:15 +06:00
shannon@ShandemVaio dfe512ead8 Got ApplicationTreeTest working in new NUnit test project. 2012-07-17 03:23:06 +06:00
shannon@ShandemVaio ddbde6e15f Got ApplicationTests working with new unit test project.
Had to fix the ApplicationTree and Application classes to lazily call the Cache method
(which is no renamed to EnsureCache) so that we could set the config location in the unit tests.
This should also improve performance a teeny bit and allow for better error handling if required.
2012-07-17 03:14:22 +06:00
shannon@ShandemVaio 96cc9a1f35 Missing file updates 2012-07-17 01:33:14 +06:00
shannon@ShandemVaio 21203b8070 Renamed umbraco.Test to Umbraco.LegacyTests
Updated InternalsVisibleTo declarations.
Updated the ApplicationTest test to use a new base class as a test to install a local sqlce database
for testing against.
Added Umbraco.Core project.
Added Umbraco.Web project.
Created new sln folder Legacy
2012-07-17 01:32:46 +06:00
1140 changed files with 138237 additions and 38190 deletions
+20 -6
View File
@@ -27,12 +27,17 @@ umbraco\presentation\usercontrols\*
umbraco\presentation\scripts\*
umbraco\presentation\fonts\*
umbraco\presentation\css\*
glob:*App_Code\*
glob:*App_Data\*
glob:*media\*
glob:*masterpages\*
glob:*macroScripts\*
glob:*xslt\*
src\Umbraco.Web.UI\css\*
src\Umbraco.Web.UI\App_Code\*
src\Umbraco.Web.UI\App_Data\*
src\Umbraco.Tests\App_Data\*
src\Umbraco.Web.UI\media\*
src\Umbraco.Web.UI\masterpages\*
src\Umbraco.Web.UI\macroScripts\*
src\Umbraco.Web.UI\xslt\*
src\Umbraco.Web.UI\images\*
src\Umbraco.Web.UI\scripts\*
umbraco\presentation\umbraco\plugins\uComponents\uComponentsInstaller.ascx
umbraco\presentation\packages\uComponents\MultiNodePicker\CustomTreeService.asmx
@@ -41,7 +46,16 @@ _BuildOutput/*
build/UmbracoCms.AllBinaries.zip
build/UmbracoCms.WebPI.zip
build/UmbracoCms.zip
build/*.nupkg
src/Umbraco.Tests/config/applications.config
src/Umbraco.Tests/config/trees.config
src/Umbraco.Web.UI/web.config
*.orig
src/Umbraco.Tests/config/404handlers.config
src/Umbraco.Web.UI/Views/*.cshtml
src/Umbraco.Web.UI/Views/*.vbhtml
src/Umbraco.Tests/config/umbracoSettings.config
src/Umbraco.Web.UI/App_Plugins/*
src/Umbraco.Web.UI/Views/*
src\Umbraco.Web.UI\[W]eb.config
+10
View File
@@ -10,3 +10,13 @@ d03fcffb8834a9583a56813bb44b6abbd9f042cc Release-4.6.0
096f20bb0575d6199f20fcb3147b63554e765a74 Release-4.8.0
8f8a203857886b373148af29edd57460a42940be Release-4.8.1
de73e687ddf6086ed52b6554676c1632865d07f2 Release-4.9.0
8d7d8609e2e4b971da99cd97f72132ce85ce3333 Release-4.9.1
f6da531fbb4c251ff61d314e2a7effb13c71e74a Release-4.10.0
20e4dff821d8ac2527a5353618fa1a23ea1d8b34 Release-4.11.0
7f827760cb49d749616859f528d19dde64807947 Release-4.11.1
7f827760cb49d749616859f528d19dde64807947 Release-4.11.1
6eb5f2fb5a88aa29ea544499df9160a1b31b5638 Release-4.11.1
73711b806a4044dbf0d7d7c095ddfdda23b09932 4.11.2
73711b806a4044dbf0d7d7c095ddfdda23b09932 4.11.2
0000000000000000000000000000000000000000 4.11.2
73711b806a4044dbf0d7d7c095ddfdda23b09932 Release-4.11.2
+8 -1
View File
@@ -1,2 +1,9 @@
@ECHO OFF
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe "Build.proj"
REM pause
if ERRORLEVEL 1 goto :showerror
goto :EOF
:showerror
pause
+2 -3
View File
@@ -46,10 +46,9 @@
</PropertyGroup>
<ItemGroup>
<SystemFolders Include="$(WebAppFolder)App_Code" />
<SystemFolders Include="$(WebAppFolder)App_Plugins" />
<SystemFolders Include="$(WebAppFolder)App_Code" />
<SystemFolders Include="$(WebAppFolder)App_Data" />
<SystemFolders Include="$(WebAppFolder)App_Data\ClientDependency" />
<SystemFolders Include="$(WebAppFolder)App_Data\ExamineIndexes" />
<SystemFolders Include="$(WebAppFolder)media" />
<SystemFolders Include="$(WebAppFolder)masterpages" />
<SystemFolders Include="$(WebAppFolder)scripts" />
-370
View File
@@ -1,370 +0,0 @@
<?xml version="1.0" ?>
<project name="umbraco" default="test" basedir=".">
<description>Build the umbraco 4.6 alpha Application for asp.net 3.5</description>
<property name="nant.settings.currentframework" value="net-2.0" />
<!-- filenames and directories, generally won't change -->
<property name="web.dir" value="D:\inetpub\wwwroot\v4.umbraco.org" />
<property name="public.dir" value="D:\inetpub\wwwroot\nightlies\umbraco 4.6 for asp.net 3.5" />
<property name="root.dir" value="${directory::get-current-directory()}" />
<property name="source.dir" value="${root.dir}\umbraco\presentation" />
<property name="build.dir" value="${root.dir}\build" />
<property name="dlls.dir" value="${root.dir}\foreign dlls" />
<property name="build.version" value="4.6 Alpha"/>
<property name="docs.dir" value="${root.dir}\docs" />
<property name="win.dir" value="c:\WINDOWS" />
<property name="Webdeploy.dir" value="C:\Program Files\MSBuild\Microsoft\WebDeployment\v8.0" />
<!-- YUI -->
<property name="YUICompressor.dir" value="D:\inetpub\wwwroot\ccnet\buildTools\YUI" />
<target name="build" depends="init">
<!-- set everything to writable-->
<attrib normal="true" readonly="false">
<fileset basedir="${root.dir}">
<include name="**/*" />
</fileset>
</attrib>
<!-- Remove those damn DLR dlls that might be left behind by careless devs...-->
<!-- They will get added again after build is completed, no worries no dependencies during build-->
<delete>
<fileset>
<include name="${source.dir}\bin\IronPython.dll" />
<include name="${source.dir}\bin\IronPython.Modules.dll" />
<include name="${source.dir}\bin\IronRuby.dll" />
<include name="${source.dir}\bin\IronRuby.Libraries.dll" />
<include name="${source.dir}\bin\IronRuby.Libraries.Yaml.dll" />
<include name="${source.dir}\bin\Microsoft.Dynamic.dll" />
<include name="${source.dir}\bin\Microsoft.ScriptinG.Core.dll" />
<include name="${source.dir}\bin\Microsoft.Scripting.Debugging.dll" />
<include name="${source.dir}\bin\Microsoft.Scripting.dll" />
<include name="${source.dir}\bin\Microsoft.Scripting.ExtensionAttribute.dll" />
</fileset>
</delete>
<exec program="${win.dir}\microsoft.net\framework\v4.0.30319\msbuild.exe">
<arg value="${root.dir}\umbraco.sln" />
<arg value="/v:n" />
<arg value="/p:WarningLevel=0" />
<arg value="/p:ToolsVersion=3.5" />
</exec>
<exec program="${win.dir}\microsoft.net\framework\v2.0.50727\aspnet_compiler.exe" commandline="-f -u -p umbraco/presentation -v / &quot;${build.dir}&quot;"/>
</target>
<!-- Directories and files -->
<target name="directories" depends="build">
<!-- setup docs files -->
<mkdir dir="${docs.dir}" />
<copy todir="${docs.dir}">
<fileset basedir="${build.dir}\bin">
<include name="*.xml" />
</fileset>
</copy>
<!-- asp.net 2.0 SP1 DLR dlls -->
<delete>
<fileset>
<include name="${build.dir}\bin\Microsoft.Scripting.*" />
<include name="${build.dir}\bin\Microsoft.Dynamic.*" />
<include name="${build.dir}\bin\IronPython.*" />
<include name="${build.dir}\bin\IronRuby.*" />
</fileset>
</delete>
<copy todir="${build.dir}\bin">
<fileset basedir="${dlls.dir}\DLR 2.0 SP1">
<include name="*.dll" />
<exclude name="Microsoft.Scripting.ExtensionAttribute.dll" />
</fileset>
</copy>
<!--standard web.config-->
<copy file="${root.dir}\aspnet35.config" tofile="${build.dir}\web.config" failonerror="false" overwrite="true"/>
<!--standard /config files-->
<copy file="${root.dir}\config templates\config\404handlers.config" tofile="${build.dir}\config\404handlers.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\dashboard.config" tofile="${build.dir}\config\dashboard.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\formhandlers.config" tofile="${build.dir}\config\formhandlers.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\metablogconfig.config" tofile="${build.dir}\config\metablogconfig.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\restextensions.config" tofile="${build.dir}\config\restextensions.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\xsltextensions.config" tofile="${build.dir}\config\xsltextensions.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\tinymceconfig.config" tofile="${build.dir}\config\tinymceconfig.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\umbracosettings.config" tofile="${build.dir}\config\umbracosettings.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\urlrewriting.config" tofile="${build.dir}\config\urlrewriting.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\applications.config" tofile="${build.dir}\config\applications.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\trees.config" tofile="${build.dir}\config\trees.config" failonerror="false" overwrite="true"/>
<!-- new 4.1 files -->
<copy file="${root.dir}\config templates\config\ClientDependency.config" tofile="${build.dir}\config\ClientDependency.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\ExamineSettings.config" tofile="${build.dir}\config\ExamineSettings.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\ExamineIndex.config" tofile="${build.dir}\config\ExamineIndex.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\scripting.config" tofile="${build.dir}\config\scripting.config" failonerror="false" overwrite="true"/>
<!--standard /data/packages files-->
<copy file="${root.dir}\config templates\packages\installedPackages.config" tofile="${build.dir}\data\packages\installed\installedPackages.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\packages\createdPackages.config" tofile="${build.dir}\data\packages\created\createdPackages.config" failonerror="false" overwrite="true"/>
<!-- Standard access.xml file-->
<copy file="${root.dir}\config templates\access.xml" tofile="${build.dir}\data\access.xml" failonerror="false" overwrite="true"/>
<!-- Standard create UI.xml-->
<copy file="${root.dir}\config templates\config\UI.xml" tofile="${build.dir}\umbraco\config\create\UI.xml" failonerror="false" overwrite="true"/>
<!-- Standard empty cache file -->
<copy file="${root.dir}\config templates\umbraco.config" tofile="${build.dir}\umbraco\data\umbraco.config" failonerror="false" overwrite="true"/>
<!-- Baseline Language file for translation tool -->
<copy file="${build.dir}\umbraco\config\lang\en.xml" tofile="${web.dir}\usercontrols\translation\langs\en.xml" failonerror="false" overwrite="true"/>
<!-- LINQ2UMB dll-->
<copy file="${root.dir}\LinqToUmbraco\src\umbraco.Linq\Core\bin\Debug - Fixed Version\umbraco.Linq.Core.dll" tofile="${build.dir}\bin\umbraco.Linq.Core.dll" failonerror="false" overwrite="true"/>
<delete dir="${build.dir}\webservices" />
<delete dir="${build.dir}\umbracoBase" />
<delete dir="${build.dir}\Web References" />
<delete dir="${build.dir}\obj" />
<delete dir="${build.dir}\properties" />
<delete dir="${build.dir}\css" />
<delete dir="${build.dir}\masterpages" />
<delete dir="${build.dir}\scripts" />
<delete dir="${build.dir}\python" />
<delete dir="${build.dir}\xslt" />
<delete dir="${build.dir}\usercontrols" />
<delete>
<fileset>
<include name="${build.dir}/**/*.build" />
<include name="${build.dir}/**/*.csproj" />
<include name="${build.dir}/**/*.vspscc" />
<include name="${build.dir}/**/*.scc" />
<include name="${build.dir}/**/*.sln" />
<include name="${build.dir}/**/*.compiled" />
<include name="${build.dir}/**/*.resx" />
<include name="${build.dir}/**/*.user" />
<include name="${build.dir}/**/*.pdb" />
<include name="${build.dir}/PrecompiledApp.config" />
<include name="${build.dir}/web.config.template" />
<include name="${build.dir}/*.xslt" />
<include name="${build.dir}/web.STANDARD.config" />
<include name="${build.dir}/site.py" />
</fileset>
</delete>
<!-- standard folders -->
<mkdir dir="${build.dir}\App_Code" />
<mkdir dir="${build.dir}\App_Data" />
<mkdir dir="${build.dir}\App_Data\ClientDependency" />
<mkdir dir="${build.dir}\App_Data\ExamineIndexes" />
<mkdir dir="${build.dir}\media" />
<mkdir dir="${build.dir}\masterpages" />
<mkdir dir="${build.dir}\scripts" />
<mkdir dir="${build.dir}\css" />
<mkdir dir="${build.dir}\python" />
<mkdir dir="${build.dir}\xslt" />
<mkdir dir="${build.dir}\usercontrols" />
</target>
<!-- Minify -->
<target name="minify" description="minify JS files" depends="directories">
<fileset basedir="${build.dir}" id="jsFileSet">
<include name="umbraco/css/*.css"/>
<include name="umbraco/js/**/*.js"/>
<include name="umbraco_client/**/*.js"/>
<include name="umbraco_client/**/*.css"/>
</fileset>
<property name="js_files" value=""/>
<foreach item="File" property="file">
<in>
<items refid="jsFileSet"/>
</in>
<do>
<exec program="java" workingdir="${YUICompressor.dir}" failonerror="false">
<arg value="-jar" />
<arg value="yuicompressor.jar" />
<arg value="-o" />
<arg value="${file}.min" />
<arg value="${file}" />
</exec>
<move file="${file}.min" tofile="${file}" overwrite="true" failonerror="false"/>
</do>
</foreach>
</target>
<!-- Documentation -->
<target name="documentation" depends="directories">
<!-- Transformations -->
<property name="sandcastle.addfriendlyfilenames.xsl" value="${sandcastle.dir}\ProductionTransforms\AddFriendlyFilenames.xsl" />
<property name="sandcastle.reflectiontomanifest.xsl" value="${sandcastle.dir}\ProductionTransforms\ReflectionToManifest.xsl" />
<property name="sandcastle.buildassembler.config" value="${sandcastle.dir}\Presentation\wiki\configuration\sandcastle.config" />
<!-- Create a doc dir and move vs comment files to it-->
<mkdir dir="${docs.dir}" />
<copy todir="${docs.dir}">
<fileset basedir="${build.dir}\bin">
<include name="*.xml" />
</fileset>
</copy>
<!-- Create or Cleanup Working Directory -->
<mkdir dir="${sandcastle.workingdir}" if="${not directory::exists(sandcastle.workingdir)}" />
<delete>
<fileset basedir="${sandcastle.workingdir}">
<include name="**\*" />
</fileset>
</delete>
<copy file="${sandcastle.buildassembler.config}" tofile="${sandcastle.workingdir}\Sandcastle.config">
<filterchain>
<replacestring from="%DXROOT%\" to="${sandcastle.dir}" />
<replacestring from=".\comments.xml" to="${docs.dir}\*.xml" />
</filterchain>
</copy>
<!-- Run MRefBuilder (introspection on assemblies) to create basic Reflection XML -->
<exec program="${sandcastle.mrefbuilder}" workingdir="${sandcastle.workingdir}">
<arg value="&quot;${build.dir}\bin\businesslogic.dll&quot; " />
<arg value="&quot;${build.dir}\bin\cms.dll&quot; " />
<arg value="&quot;${build.dir}\bin\controls.dll&quot; " />
<arg value="&quot;${build.dir}\bin\interfaces.dll&quot; " />
<arg value="&quot;${build.dir}\bin\umbraco.datalayer.dll&quot; " />
<arg value="&quot;${build.dir}\bin\umbraco.dll&quot; " />
<arg value="&quot;${build.dir}\bin\umbraco.editorcontrols.dll&quot; " />
<arg value="&quot;${build.dir}\bin\umbraco.providers.dll&quot; " />
<arg value="&quot;${build.dir}\bin\umbraco.webservices.dll&quot; " />
<arg value="/out:reflection.org" />
</exec>
<!-- Regroup overloads -->
<exec program="${sandcastle.xsltransform}" workingdir="${sandcastle.workingdir}">
<arg value="reflection.org" />
<arg value="/xsl:&quot;${sandcastle.addfriendlyfilenames.xsl}&quot;" />
<arg value="/out:reflection.xml" />
</exec>
<exec program="${sandcastle.xsltransform}" workingdir="${sandcastle.workingdir}">
<arg value="reflection.org" />
<arg value="/xsl:&quot;${sandcastle.reflectiontomanifest.xsl}&quot;" />
<arg value="/out:manifest.xml" />
</exec>
<exec program="${sandcastle.buildassembler}" workingdir="${sandcastle.workingdir}">
<arg value="/config:Sandcastle.config" />
<arg value="manifest.xml" />
</exec>
</target>
<!-- do the full release with docs, minify and nightly file distribution -->
<target name="release" depends="zip,minify">
<property name="assembly.name" value="${ assemblyname::get-version( assemblyname::get-assembly-name('umbraco/presentation/bin/umbraco.dll') ) }"/>
<property name="release.filename" value="${root.dir}\build_${build.version}_${assembly.name}.zip" />
<mkdir dir="${public.dir}\${build.version}" />
<copy file="${release.filename}" tofile="${public.dir}\${build.version}\${assembly.name}.zip" />
</target>
<!-- do the full release with docs, minify and nightly file distribution -->
<target name="zip" depends="directories">
<property name="assembly.name" value="${ assemblyname::get-version( assemblyname::get-assembly-name('umbraco/presentation/bin/umbraco.dll') ) }"/>
<property name="release.filename" value="${root.dir}\build_${build.version}_${assembly.name}.zip" />
<zip zipfile="${release.filename}" includeemptydirs="true" >
<fileset basedir="${root.dir}">
<include name="build/*" />
<include name="build/**/*" />
</fileset>
</zip>
</target>
<!-- do a nightly build without the minification and docs -->
<target name="nightly" depends="zip">
<property name="assembly.name" value="${ assemblyname::get-version( assemblyname::get-assembly-name('umbraco/presentation/bin/umbraco.dll') ) }"/>
<property name="release.filename" value="${root.dir}\build_${build.version}_${assembly.name}.zip" />
<mkdir dir="${public.dir}\${build.version}" />
<copy file="${release.filename}" tofile="${public.dir}\${build.version}\${assembly.name}.zip" />
</target>
<!-- will produce the a clean /build folder and nothing else-->
<target name="test" depends="directories">
</target>
<target name="webPIRelease" depends="release,webPiFile">
<copy file="${root.dir}\webPi_sha.txt" tofile="${public.dir}\${build.version}\webPi_sha.txt" />
<copy file="${root.dir}\Umbraco_${build.version}_WebDeploy.zip" tofile="${public.dir}\${build.version}\Umbraco_${build.version}_WebDeploy.zip" />
</target>
<!-- do the webdeploy release for web PI-->
<target name="webPiFile" depends="directories">
<property name="webpi.dir" value="${root.dir}\deploy" />
<delete dir="${webpi.dir}\umbraco" />
<mkdir dir="${webpi.dir}" />
<mkdir dir="${webpi.dir}\umbraco" />
<copy todir="${webpi.dir}\umbraco" includeemptydirs="true" >
<fileset basedir="${root.dir}">
<include name="build/*" />
<include name="build/**/*" />
</fileset>
</copy>
<copy file="d:\webpiAssets\installSQL.sql" tofile="${webpi.dir}\installSQL.sql" failonerror="false"/>
<copy file="d:\webpiAssets\manifest.xml" tofile="${webpi.dir}\manifest.xml" failonerror="false"/>
<copy file="d:\webpiAssets\parameters.xml" tofile="${webpi.dir}\parameters.xml" failonerror="false"/>
<property name="webpi.filename" value="${root.dir}\Umbraco_${build.version}_WebDeploy.zip" />
<zip zipfile="${webpi.filename}" includeemptydirs="true" >
<fileset basedir="${webpi.dir}">
<include name="*" />
<include name="**/*" />
</fileset>
</zip>
<exec program="${win.dir}\hashMyFiles.exe">
<arg value="/file &quot;${webpi.filename}&quot;" />
<arg value="/stext &quot;${root.dir}\webPi_sha.txt&quot;" />
</exec>
</target>
<target name="init" description="init tasks for the build">
<!-- Clean the plugins dir any leftovers, only tinyMCE belongs in here -->
<delete>
<fileset>
<include name="${build.dir}\umbraco\plugins\*" />
<exclude name="${build.dir}\umbraco\plugins\tinymce3" />
</fileset>
</delete>
<delete dir="${build.dir}" />
<mkdir dir="${build.dir}" />
</target>
</project>
-229
View File
@@ -1,229 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections >
<section name="urlrewritingnet" restartOnExternalChanges="true" requirePermission="false" type="UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter" />
<section name="microsoft.scripting" type="Microsoft.Scripting.Hosting.Configuration.Section, Microsoft.Scripting, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" />
<!-- ASPNETAJAX -->
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="umbraco.presentation.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<section name="clientDependency" type="ClientDependency.Core.Config.ClientDependencySection, ClientDependency.Core" requirePermission="false"/>
<section name="Examine" type="Examine.Config.ExamineSettings, Examine" requirePermission="false"/>
<section name="ExamineLuceneIndexSets" type="UmbracoExamine.Config.ExamineLuceneIndexes, UmbracoExamine" requirePermission="false"/>
</configSections>
<urlrewritingnet configSource="config\UrlRewriting.config" />
<microsoft.scripting configSource="config\scripting.config" />
<clientDependency configSource="config\ClientDependency.config" />
<Examine configSource="config\ExamineSettings.config" />
<ExamineLuceneIndexSets configSource="config\ExamineIndex.config" />
<appSettings>
<add key="umbracoDbDSN" value="server=.\SQLEXPRESS;database=DATABASE;user id=USER;password=PASS" />
<add key="umbracoConfigurationStatus" value="" />
<add key="umbracoReservedUrls" value="~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd" />
<add key="umbracoReservedPaths" value="~/umbraco,~/install/" />
<add key="umbracoContentXML" value="~/App_Data/umbraco.config" />
<add key="umbracoStorageDirectory" value="~/App_Data" />
<add key="umbracoPath" value="~/umbraco" />
<add key="umbracoEnableStat" value="false" />
<add key="umbracoHideTopLevelNodeFromPath" value="true" />
<add key="umbracoEditXhtmlMode" value="true" />
<add key="umbracoUseDirectoryUrls" value="false" />
<add key="umbracoDebugMode" value="true" />
<add key="umbracoTimeOutInMinutes" value="20" />
<add key="umbracoVersionCheckPeriod" value="7" />
<add key="umbracoDisableXsltExtensions" value="true" />
<add key="umbracoDefaultUILanguage" value="en" />
<add key="umbracoProfileUrl" value="profiler" />
<add key="umbracoUseSSL" value="false" />
<add key="umbracoUseMediumTrust" value="false" />
<add key="umbracoContentXMLUseLocalTemp" value="false" />
</appSettings>
<system.net>
<mailSettings>
<smtp>
<network host="127.0.0.1" userName="username" password="password" />
</smtp>
</mailSettings>
</system.net>
<!-- REMOVE FOR BETA -->
<!-- added by NH to test foreign membership providers-->
<connectionStrings>
<remove name="LocalSqlServer" />
<!--<add name="LocalSqlServer" connectionString="server=.\sqlexpress;database=aspnetdb;user id=DBUSER;password=DBPASSWORD" providerName="System.Data.SqlClient"/>-->
</connectionStrings>
<system.web>
<!-- <trust level="Medium" originUrl=".*" /> -->
<customErrors mode="Off" />
<trace enabled="true" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" />
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20" />
<globalization requestEncoding="UTF-8" responseEncoding="UTF-8" />
<xhtmlConformance mode="Strict" />
<pages enableEventValidation="false">
<!-- ASPNETAJAX -->
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add tagPrefix="umbraco" namespace="umbraco.presentation.templateControls" assembly="umbraco" />
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</controls>
</pages>
<httpModules>
<!-- URL REWRTIER -->
<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
<add name="umbracoRequestModule" type="umbraco.presentation.requestModule" />
<!-- UMBRACO -->
<add name="viewstateMoverModule" type="umbraco.presentation.viewstateMoverModule, umbraco" />
<add name="umbracoBaseRequestModule" type="umbraco.presentation.umbracobase.requestModule, umbraco" />
<!-- ASPNETAJAX -->
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<!-- CLIENT DEPENDENCY -->
<add name="ClientDependencyModule" type="ClientDependency.Core.Module.ClientDependencyModule, ClientDependency.Core"/>
</httpModules>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
<!-- UMBRACO CHANNELS -->
<add verb="*" path="umbraco/channels.aspx" type="umbraco.presentation.channels.api, umbraco" />
<add verb="*" path="umbraco/channels/word.aspx" type="umbraco.presentation.channels.wordApi, umbraco" />
<!-- CLIENT DEPENDENCY -->
<add verb="*" path="DependencyHandler.axd" type="ClientDependency.Core.CompositeFiles.CompositeDependencyHandler, ClientDependency.Core "/>
<!-- SPELL CHECKER -->
<add verb="GET,HEAD,POST" path="GoogleSpellChecker.ashx" type="umbraco.presentation.umbraco_client.tinymce3.plugins.spellchecker.GoogleSpellChecker,umbraco" />
</httpHandlers>
<compilation defaultLanguage="c#" debug="false" batch="false">
<assemblies>
<!-- ASPNETAJAX -->
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms name="yourAuthCookie" loginUrl="login.aspx" protection="All" path="/" />
</authentication>
<authorization>
<allow users="?" />
</authorization>
<!-- Membership Provider -->
<membership defaultProvider="UmbracoMembershipProvider" userIsOnlineTimeWindow="15">
<providers>
<clear />
<add name="UmbracoMembershipProvider" type="umbraco.providers.members.UmbracoMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="Another Type" passwordFormat="Hashed" />
<add name="UsersMembershipProvider" type="umbraco.providers.UsersMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" passwordFormat="Hashed" />
</providers>
</membership>
<!-- added by NH to support membership providers in access layer -->
<roleManager enabled="true" defaultProvider="UmbracoRoleProvider">
<providers>
<clear />
<add name="UmbracoRoleProvider" type="umbraco.providers.members.UmbracoRoleProvider" />
</providers>
</roleManager>
<!-- Sitemap provider-->
<siteMap defaultProvider="UmbracoSiteMapProvider" enabled="true">
<providers>
<clear />
<add name="UmbracoSiteMapProvider" type="umbraco.presentation.nodeFactory.UmbracoSiteMapProvider" defaultDescriptionAlias="description" securityTrimmingEnabled="true" />
</providers>
</siteMap>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<remove name="ScriptModule" />
<remove name="UrlRewriteModule" />
<remove name="umbracoRequestModule" />
<remove name="viewstateMoverModule" />
<remove name="umbracoBaseRequestModule" />
<remove name="ClientDependencyModule" />
<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
<add name="umbracoRequestModule" type="umbraco.presentation.requestModule" />
<add name="viewstateMoverModule" type="umbraco.presentation.viewstateMoverModule" />
<add name="umbracoBaseRequestModule" type="umbraco.presentation.umbracobase.requestModule" />
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="ClientDependencyModule" type="ClientDependency.Core.Module.ClientDependencyModule, ClientDependency.Core"/>
</modules>
<handlers accessPolicy="Read, Write, Script, Execute">
<remove name="WebServiceHandlerFactory-Integrated" />
<remove name="ScriptHandlerFactory" />
<remove name="ScriptHandlerFactoryAppServices" />
<remove name="ScriptResource" />
<remove name="Channels" />
<remove name="Channels_Word" />
<remove name="ClientDependency" />
<remove name="SpellChecker" />
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="*" name="Channels" preCondition="integratedMode" path="umbraco/channels.aspx" type="umbraco.presentation.channels.api, umbraco" />
<add verb="*" name="Channels_Word" preCondition="integratedMode" path="umbraco/channels/word.aspx" type="umbraco.presentation.channels.wordApi, umbraco" />
<add verb="*" name="ClientDependency" preCondition="integratedMode" path="DependencyHandler.axd" type="ClientDependency.Core.CompositeFiles.CompositeDependencyHandler, ClientDependency.Core "/>
<add verb="GET,HEAD,POST" preCondition="integratedMode" name="SpellChecker" path="GoogleSpellChecker.ashx" type="umbraco.presentation.umbraco_client.tinymce3.plugins.spellchecker.GoogleSpellChecker,umbraco"/>
</handlers>
</system.webServer>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v3.5" />
<providerOption name="WarnAsError" value="false" />
</compiler>
</compilers>
</system.codedom>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<build>
<version>4.0 Beta 2</version>
<assembly>@assembly@</assembly>
<date>@date@</date>
</build>
-495
View File
@@ -1,495 +0,0 @@
<?xml version="1.0" ?>
<project name="umbraco" default="test" basedir=".">
<description>Build the umbraco 4.5 Application</description>
<!-- global properties, generally won't change -->
<!--
<property name="nant.settings.currentframework" value="net-2.0" />
-->
<property name="nant.settings.currentframework" value="net-4.0" />,
<property name="build.version" value="4.8.0"/>
<property name="build.configuration" value="Debug"/>
<!-- filenames and directories, generally won't change -->
<property name="web.dir" value="D:\inetpub\wwwroot\v4.umbraco.org" />
<property name="public.dir" value="C:\inetpub\wwwroot\_Live Sites\nightly.umbraco.org\umbraco 4.7.2" />
<property name="root.dir" value="${directory::get-current-directory()}" />
<property name="source.dir" value="${root.dir}\umbraco\presentation" />
<property name="build.dir" value="${root.dir}\build" />
<property name="build.symbolFiles.dir" value="${root.dir}\SymbolFiles" />
<property name="build.macroEnginesIron.dir" value="${root.dir}\umbraco.macroEngines.Iron_build" />
<property name="dlls.dir" value="${root.dir}\foreign dlls" />
<property name="WebPiAssets.dir" value="${root.dir}\config templates\WebPi" />
<property name="docs.dir" value="${root.dir}\docs" />
<property name="win.dir" value="c:\WINDOWS" />
<property name="Webdeploy.dir" value="C:\Program Files\MSBuild\Microsoft\WebDeployment\v8.0" />
<!-- Sandcastle Directories -->
<property name="sandcastle.dir" value="c:\Program Files\Sandcastle" />
<property name="sandcastle.workingdir" value="${root.dir}\docs\SandcastleWorkingDir" />
<property name="sandcastle.output.dir" value="${sandcastle.workingdir}\Output" />
<!-- Sandcastle -->
<property name="sandcastle.mrefbuilder" value="${sandcastle.dir}\productiontools\mrefbuilder.exe" />
<property name="sandcastle.buildassembler" value="${sandcastle.dir}\productiontools\buildassembler.exe" />
<property name="sandcastle.xsltransform" value="${sandcastle.dir}\productiontools\xsltransform.exe" />
<!-- YUI -->
<property name="YUICompressor.dir" value="D:\inetpub\wwwroot\ccnet\buildTools\YUI" />
<!-- Build source -->
<target name="build" depends="init">
<!-- set everything to writable-->
<attrib normal="true" readonly="false">
<fileset basedir="${root.dir}">
<include name="**/*" />
</fileset>
</attrib>
<delete>
<fileset>
<include name="${source.dir}\bin\IronPython.dll" />
<include name="${source.dir}\bin\IronPython.Modules.dll" />
<include name="${source.dir}\bin\IronRuby.dll" />
<include name="${source.dir}\bin\IronRuby.Libraries.dll" />
<include name="${source.dir}\bin\IronRuby.Libraries.Yaml.dll" />
<include name="${source.dir}\bin\Microsoft.Dynamic.dll" />
<include name="${source.dir}\bin\Microsoft.ScriptinG.Core.dll" />
<include name="${source.dir}\bin\Microsoft.Scripting.Debugging.dll" />
<include name="${source.dir}\bin\Microsoft.Scripting.dll" />
<include name="${source.dir}\bin\Microsoft.Scripting.ExtensionAttribute.dll" />
</fileset>
</delete>
<exec program="${win.dir}\microsoft.net\framework\v4.0.30319\msbuild.exe">
<arg value="${root.dir}\umbraco.MacroEngines.Juno\umbraco.MacroEngines.csproj" />
<arg value="/v:n" />
<arg value="/p:WarningLevel=0" />
<arg value="/p:ToolsVersion=4.0" />
<arg value="/p:Configuration=${build.configuration}" />
</exec>
<copy file="${root.dir}\umbraco.MacroEngines.Juno\bin\${build.configuration}\umbraco.MacroEngines.dll" tofile="${source.dir}\bin\umbraco.MacroEngines.dll" failonerror="false" overwrite="true"/>
<copy todir="${source.dir}\bin" overwrite="true">
<fileset basedir="${dlls.dir}\WebPages">
<include name="*.dll" />
</fileset>
</copy>
<exec program="${win.dir}\microsoft.net\framework\v4.0.30319\msbuild.exe">
<arg value="${root.dir}\umbraco.sln" />
<arg value="/v:n" />
<arg value="/p:WarningLevel=0" />
<arg value="/p:ToolsVersion=4.0" />
<arg value="/p:Configuration=${build.configuration}" />
</exec>
<exec program="${win.dir}\microsoft.net\framework\v4.0.30319\aspnet_compiler.exe" commandline="-f -u -p umbraco/presentation -v / &quot;${build.dir}&quot;"/>
<call target="buildMacroEnginesIron" />
<call target="buildSymbolFiles" />
</target>
<target name="buildMacroEnginesIron">
<mkdir dir="${build.macroEnginesIron.dir}" />
<mkdir dir="${build.macroEnginesIron.dir}\bin" />
<copy todir="${build.macroEnginesIron.dir}\bin" overwrite="true">
<fileset basedir="${dlls.dir}\DLR 4.0">
<include name="*.dll" />
<exclude name="Microsoft.Scripting.ExtensionAttribute.dll" />
</fileset>
</copy>
<copy file="${root.dir}\umbraco.MacroEngines.Iron\bin\${build.configuration}\umbraco.MacroEngines.Iron.dll" tofile="${build.macroEnginesIron.dir}\bin\umbraco.MacroEngines.Iron.dll" failonerror="false" overwrite="true"/>
</target>
<target name="buildSymbolFiles">
<!-- setup symbol files -->
<mkdir dir="${build.symbolFiles.dir}" />
<copy todir="${build.symbolFiles.dir}" flatten="true">
<fileset basedir="${build.dir}\bin">
<include name="*.xml" />
<include name="*.pdb" />
</fileset>
</copy>
<copy todir="${build.symbolFiles.dir}" flatten="true">
<fileset basedir="${root.dir}" >
<include name="**/*.pdb" />
<include name="**/bin/*.xml" />
</fileset>
</copy>
<copy todir="${build.symbolFiles.dir}" flatten="true">
<fileset basedir="${docs.dir}">
<include name="*.xml" />
</fileset>
</copy>
</target>
<!-- Directories and files -->
<target name="directories" depends="build">
<!-- setup docs files -->
<mkdir dir="${docs.dir}" />
<copy todir="${docs.dir}">
<fileset basedir="${build.dir}\bin">
<include name="*.xml" />
</fileset>
</copy>
<!-- DLR FILES -->
<delete>
<fileset>
<include name="${build.dir}\bin\Microsoft.Scripting.*" />
<include name="${build.dir}\bin\Microsoft.Dynamic.*" />
<include name="${build.dir}\bin\IronPython.*" />
<include name="${build.dir}\bin\IronRuby.*" />
</fileset>
</delete>
<!--
<copy todir="${build.dir}\bin" overwrite="true">
<fileset basedir="${dlls.dir}\DLR 4.0">
<include name="*.dll" />
<exclude name="Microsoft.Scripting.ExtensionAttribute.dll" />
</fileset>
</copy>
-->
<!--standard web.config-->
<copy file="${root.dir}\config templates\web.config" tofile="${build.dir}\web.config" failonerror="false" overwrite="true"/>
<!--standard /config files-->
<copy file="${root.dir}\config templates\config\404handlers.config" tofile="${build.dir}\config\404handlers.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\dashboard.config" tofile="${build.dir}\config\dashboard.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\formhandlers.config" tofile="${build.dir}\config\formhandlers.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\metablogconfig.config" tofile="${build.dir}\config\metablogconfig.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\restextensions.config" tofile="${build.dir}\config\restextensions.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\xsltextensions.config" tofile="${build.dir}\config\xsltextensions.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\tinymceconfig.config" tofile="${build.dir}\config\tinymceconfig.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\umbracosettings.config" tofile="${build.dir}\config\umbracosettings.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\urlrewriting.config" tofile="${build.dir}\config\urlrewriting.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\applications.config" tofile="${build.dir}\config\applications.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\trees.config" tofile="${build.dir}\config\trees.config" failonerror="false" overwrite="true"/>
<!-- new 4.5 files -->
<copy file="${root.dir}\config templates\config\ClientDependency.config" tofile="${build.dir}\config\ClientDependency.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\ExamineSettings.config" tofile="${build.dir}\config\ExamineSettings.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\ExamineIndex.config" tofile="${build.dir}\config\ExamineIndex.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\scripting.config" tofile="${build.dir}\config\scripting.config" failonerror="false" overwrite="true"/>
<!-- Macro engines files + razor Files -->
<copy file="${root.dir}\umbraco.MacroEngines.Juno\bin\${build.configuration}\umbraco.MacroEngines.dll" tofile="${build.dir}\bin\umbraco.MacroEngines.dll" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\umbraco.MacroEngines.Juno\bin\${build.configuration}\umbraco.MacroEngines.pdb" tofile="${build.dir}\bin\umbraco.MacroEngines.pdb" failonerror="false" overwrite="true"/>
<copy todir="${build.dir}\bin" overwrite="true">
<fileset basedir="${dlls.dir}\WebPages">
<include name="*.dll" />
</fileset>
</copy>
<!--
<copy file="${root.dir}\foreign dlls\System.Web.Razor.dll" tofile="${build.dir}\bin\System.Web.Razor.dll" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\foreign dlls\RazorEngine.Core.dll" tofile="${build.dir}\bin\RazorEngine.Core.dll" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\foreign dlls\RazorEngine.Templates.dll" tofile="${build.dir}\bin\RazorEngine.Templates.dll" failonerror="false" overwrite="true"/>
-->
<!--standard /data/packages files-->
<mkdir dir="${build.dir}\App_Data" />
<copy file="${root.dir}\config templates\packages\installedPackages.config" tofile="${build.dir}\app_data\packages\installed\installedPackages.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\packages\createdPackages.config" tofile="${build.dir}\app_data\packages\created\createdPackages.config" failonerror="false" overwrite="true"/>
<!-- Standard access.xml file-->
<copy file="${root.dir}\config templates\access.xml" tofile="${build.dir}\app_data\access.config" failonerror="false" overwrite="true"/>
<!-- Standard create UI.xml-->
<copy file="${root.dir}\config templates\config\UI.xml" tofile="${build.dir}\umbraco\config\create\UI.xml" failonerror="false" overwrite="true"/>
<!-- Standard empty cache file -->
<copy file="${root.dir}\config templates\umbraco.config" tofile="${build.dir}\umbraco\app_data\umbraco.config" failonerror="false" overwrite="true"/>
<!-- Baseline Language file for translation tool -->
<copy file="${build.dir}\umbraco\config\lang\en.xml" tofile="${web.dir}\usercontrols\translation\langs\en.xml" failonerror="false" overwrite="true"/>
<!-- LINQ2UMB dll-->
<copy file="${root.dir}\LinqToUmbraco\src\umbraco.Linq\Core\bin\${build.configuration}\umbraco.Linq.Core.dll" tofile="${build.dir}\bin\umbraco.Linq.Core.dll" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\LinqToUmbraco\src\umbraco.Linq\Core\bin\${build.configuration}\umbraco.Linq.Core.pdb" tofile="${build.dir}\bin\umbraco.Linq.Core.pdb" failonerror="false" overwrite="true"/>
<delete dir="${build.dir}\webservices" />
<delete dir="${build.dir}\umbracoBase" />
<delete dir="${build.dir}\Web References" />
<delete dir="${build.dir}\obj" />
<delete dir="${build.dir}\properties" />
<delete dir="${build.dir}\css" />
<delete dir="${build.dir}\masterpages" />
<delete dir="${build.dir}\scripts" />
<delete dir="${build.dir}\python" />
<delete dir="${build.dir}\macroScripts" />
<delete dir="${build.dir}\xslt" />
<delete dir="${build.dir}\usercontrols" />
<delete>
<fileset>
<include name="${build.dir}/**/*.build" />
<include name="${build.dir}/**/*.csproj" />
<include name="${build.dir}/**/*.vspscc" />
<include name="${build.dir}/**/*.scc" />
<include name="${build.dir}/**/*.sln" />
<include name="${build.dir}/**/*.compiled" />
<include name="${build.dir}/**/*.resx" />
<include name="${build.dir}/**/*.user" />
<include name="${build.dir}/**/*.bak" />
<include name="${build.dir}/**/*.orig" />
<include name="${build.dir}/PrecompiledApp.config" />
<include name="${build.dir}/web.config.template" />
<include name="${build.dir}/*.xslt" />
<include name="${build.dir}/web.*.config" />
<include name="${build.dir}/site.py" />
<include name="${build.dir}/bin/umbraco.MacroEngines.Legacy.*" />
</fileset>
</delete>
<if test="${build.configuration=='Release'}">
<delete>
<fileset>
<include name="${build.dir}/**/*.pdb" />
<include name="${build.dir}/bin/*.xml" />
</fileset>
</delete>
</if>
<!-- standard folders -->
<mkdir dir="${build.dir}\App_Code" />
<mkdir dir="${build.dir}\App_Data\ClientDependency" />
<mkdir dir="${build.dir}\App_Data\ExamineIndexes" />
<mkdir dir="${build.dir}\media" />
<mkdir dir="${build.dir}\masterpages" />
<mkdir dir="${build.dir}\scripts" />
<mkdir dir="${build.dir}\css" />
<mkdir dir="${build.dir}\macroScripts" />
<mkdir dir="${build.dir}\xslt" />
<mkdir dir="${build.dir}\usercontrols" />
</target>
<!-- Documentation -->
<target name="documentation" depends="directories">
<!-- Transformations -->
<property name="sandcastle.addfriendlyfilenames.xsl" value="${sandcastle.dir}\ProductionTransforms\AddFriendlyFilenames.xsl" />
<property name="sandcastle.reflectiontomanifest.xsl" value="${sandcastle.dir}\ProductionTransforms\ReflectionToManifest.xsl" />
<property name="sandcastle.buildassembler.config" value="${sandcastle.dir}\Presentation\wiki\configuration\sandcastle.config" />
<!-- Create a doc dir and move vs comment files to it-->
<mkdir dir="${docs.dir}" />
<copy todir="${docs.dir}">
<fileset basedir="${build.dir}\bin">
<include name="*.xml" />
</fileset>
</copy>
<!-- Create or Cleanup Working Directory -->
<mkdir dir="${sandcastle.workingdir}" if="${not directory::exists(sandcastle.workingdir)}" />
<delete>
<fileset basedir="${sandcastle.workingdir}">
<include name="**\*" />
</fileset>
</delete>
<copy file="${sandcastle.buildassembler.config}" tofile="${sandcastle.workingdir}\Sandcastle.config">
<filterchain>
<replacestring from="%DXROOT%\" to="${sandcastle.dir}" />
<replacestring from=".\comments.xml" to="${docs.dir}\*.xml" />
</filterchain>
</copy>
<!-- Run MRefBuilder (introspection on assemblies) to create basic Reflection XML -->
<exec program="${sandcastle.mrefbuilder}" workingdir="${sandcastle.workingdir}">
<arg value="&quot;${build.dir}\bin\businesslogic.dll&quot; " />
<arg value="&quot;${build.dir}\bin\cms.dll&quot; " />
<arg value="&quot;${build.dir}\bin\controls.dll&quot; " />
<arg value="&quot;${build.dir}\bin\interfaces.dll&quot; " />
<arg value="&quot;${build.dir}\bin\umbraco.datalayer.dll&quot; " />
<arg value="&quot;${build.dir}\bin\umbraco.dll&quot; " />
<arg value="&quot;${build.dir}\bin\umbraco.editorcontrols.dll&quot; " />
<arg value="&quot;${build.dir}\bin\umbraco.providers.dll&quot; " />
<arg value="&quot;${build.dir}\bin\umbraco.webservices.dll&quot; " />
<arg value="/out:reflection.org" />
</exec>
<!-- Regroup overloads -->
<exec program="${sandcastle.xsltransform}" workingdir="${sandcastle.workingdir}">
<arg value="reflection.org" />
<arg value="/xsl:&quot;${sandcastle.addfriendlyfilenames.xsl}&quot;" />
<arg value="/out:reflection.xml" />
</exec>
<exec program="${sandcastle.xsltransform}" workingdir="${sandcastle.workingdir}">
<arg value="reflection.org" />
<arg value="/xsl:&quot;${sandcastle.reflectiontomanifest.xsl}&quot;" />
<arg value="/out:manifest.xml" />
</exec>
<exec program="${sandcastle.buildassembler}" workingdir="${sandcastle.workingdir}">
<arg value="/config:Sandcastle.config" />
<arg value="manifest.xml" />
</exec>
</target>
<!-- do the full release with docs, minify and nightly file distribution -->
<target name="release" depends="zip">
<property name="assembly.name" value="${ assemblyname::get-version( assemblyname::get-assembly-name('umbraco/presentation/bin/umbraco.dll') ) }"/>
<property name="release.filename" value="${root.dir}\build_${build.version}_${assembly.name}.zip" />
<mkdir dir="${public.dir}\${build.version}" />
<copy file="${release.filename}" tofile="${public.dir}\${build.version}\${assembly.name}.zip" />
</target>
<!-- do the full release with docs, minify and nightly file distribution -->
<target name="zip" depends="directories">
<property name="assembly.name" value="${build.number}"/>
<property name="release.filename" value="${root.dir}\build_${build.version}_${assembly.name}.zip" />
<zip zipfile="${release.filename}" includeemptydirs="true" >
<fileset basedir="${root.dir}">
<include name="build/*" />
<include name="build/**/*" />
</fileset>
</zip>
<zip zipfile="${root.dir}\SymbolFiles.zip" includeemptydirs="true" >
<fileset basedir="${root.dir}">
<include name="SymbolFiles/*" />
<include name="SymbolFiles/**/*" />
</fileset>
</zip>
<zip zipfile="${root.dir}\Umbraco.MacroEngines.Iron.zip" includeemptydirs="true" >
<fileset basedir="${root.dir}">
<include name="umbraco.macroEngines.Iron_build/*" />
<include name="umbraco.macroEngines.Iron_build/**/*" />
</fileset>
</zip>
</target>
<!-- do a nightly build without the minification and docs -->
<target name="nightly" depends="zip">
<property name="assembly.name" value="${build.number}"/>
<property name="release.filename" value="${root.dir}\build_${build.version}_${assembly.name}.zip" />
<mkdir dir="${public.dir}\${build.version}" />
<copy file="${release.filename}" tofile="${public.dir}\${build.version}\${assembly.name}.zip" />
<copy file="${root.dir}\Umbraco.MacroEngines.Iron.zip" tofile="${public.dir}\${build.version}\Umbraco.MacroEngines.Iron.zip" />
<copy file="${root.dir}\SymbolFiles.zip" tofile="${public.dir}\${build.version}\SymbolFiles.zip" />
</target>
<!-- will produce the a clean /build folder and nothing else-->
<target name="test" depends="directories">
</target>
<target name="webPIRelease" depends="webPiFile">
<copy file="${root.dir}\webPi_sha.txt" tofile="${public.dir}\${build.version}\Umbraco_${build.version}_WebDeploy_sha.txt" />
<copy file="${root.dir}\Umbraco_${build.version}_WebDeploy.zip" tofile="${public.dir}\${build.version}\Umbraco_${build.version}_WebDeploy.zip" />
</target>
<!-- do the webdeploy release for web PI-->
<target name="webPiFile" depends="directories">
<property name="webpi.dir" value="${root.dir}\deploy" />
<delete dir="${webpi.dir}\umbraco" />
<mkdir dir="${webpi.dir}" />
<mkdir dir="${webpi.dir}\umbraco" />
<copy todir="${webpi.dir}\umbraco" includeemptydirs="true" >
<fileset basedir="${root.dir}\build">
<include name="*" />
<include name="**/*" />
</fileset>
</copy>
<copy todir="${webpi.dir}\umbraco\bin" includeemptydirs="true" >
<fileset basedir="${dlls.dir}\SQLCE4">
<include name="*" />
<include name="**/*" />
</fileset>
</copy>
<copy file="${root.dir}\components\SQLCE4Umbraco\bin\${build.configuration}\SQLCE4Umbraco.dll" tofile="${webpi.dir}\umbraco\bin\SQLCE4Umbraco.dll" failonerror="false" overwrite="true"/>
<copy file="${WebPiAssets.dir}\installSQL.sql" tofile="${webpi.dir}\installSQL.sql" failonerror="false"/>
<copy file="${WebPiAssets.dir}\manifest.xml" tofile="${webpi.dir}\manifest.xml" failonerror="false"/>
<copy file="${WebPiAssets.dir}\parameters.xml" tofile="${webpi.dir}\parameters.xml" failonerror="false"/>
<property name="webpi.filename" value="${root.dir}\Umbraco_${build.version}_WebDeploy.zip" />
<zip zipfile="${webpi.filename}" includeemptydirs="true" >
<fileset basedir="${webpi.dir}">
<include name="*" />
<include name="**/*" />
</fileset>
</zip>
<exec program="${win.dir}\hashMyFiles.exe">
<arg value="/file &quot;${webpi.filename}&quot;" />
<arg value="/stext &quot;${root.dir}\webPi_sha.txt&quot;" />
</exec>
</target>
<target name="init" description="init tasks for the build">
<!-- Clean the plugins dir any leftovers, only tinyMCE belongs in here -->
<delete>
<fileset>
<include name="${build.dir}\umbraco\plugins\*" />
<exclude name="${build.dir}\umbraco\plugins\tinymce3" />
</fileset>
</delete>
<delete dir="${build.dir}" />
<mkdir dir="${build.dir}" />
</target>
</project>
-149
View File
@@ -1,149 +0,0 @@
<?xml version="1.0" ?>
<project name="umbraco" default="test" basedir=".">
<description>Build the umbraco 4.6 Application for asp.net 3.5</description>
<property name="nant.settings.currentframework" value="net-2.0" />
<!-- filenames and directories, generally won't change -->
<property name="public.dir" value="C:\Users\per\Documents\Projects\NugetServer\GalleryServer\src\Gallery.Server\App_Data\packages" />
<property name="root.dir" value="${directory::get-current-directory()}" />
<property name="source.dir" value="${root.dir}\umbraco\presentation" />
<property name="build.dir" value="${root.dir}\build" />
<property name="dlls.dir" value="${root.dir}\foreign dlls" />
<property name="nuget.dir" value="${root.dir}\nuget" />
<property name="nuget.app" value="C:\Program Files (x86)\nuget\nuget.exe" />
<property name="nuget.spec" value="${public.dir}\..\umbraco.nuspec" />
<property name="build.version" value="4.6.Beta"/>
<property name="win.dir" value="C:\windows" />
<target name="build" depends="init">
<!-- set everything to writable-->
<attrib normal="true" readonly="false">
<fileset basedir="${root.dir}">
<include name="**/*" />
</fileset>
</attrib>
<!-- Remove those damn DLR dlls that might be left behind by careless devs...-->
<!-- They will get added again after build is completed, no worries no dependencies during build-->
<delete>
<fileset>
<include name="${source.dir}\bin\IronPython.dll" />
<include name="${source.dir}\bin\IronPython.Modules.dll" />
<include name="${source.dir}\bin\IronRuby.dll" />
<include name="${source.dir}\bin\IronRuby.Libraries.dll" />
<include name="${source.dir}\bin\IronRuby.Libraries.Yaml.dll" />
<include name="${source.dir}\bin\Microsoft.Dynamic.dll" />
<include name="${source.dir}\bin\Microsoft.ScriptinG.Core.dll" />
<include name="${source.dir}\bin\Microsoft.Scripting.Debugging.dll" />
<include name="${source.dir}\bin\Microsoft.Scripting.dll" />
<include name="${source.dir}\bin\Microsoft.Scripting.ExtensionAttribute.dll" />
</fileset>
</delete>
<!-- build for 2.0 -->
<exec program="${win.dir}\microsoft.net\framework\v4.0.30319\msbuild.exe">
<arg value="${root.dir}\umbraco.sln" />
<arg value="/v:n" />
<arg value="/p:WarningLevel=0" />
<arg value="/p:ToolsVersion=3.5" />
</exec>
<exec program="${win.dir}\microsoft.net\framework\v2.0.50727\aspnet_compiler.exe" commandline="-f -u -p umbraco/presentation -v / &quot;${build.dir}\Net20&quot;"/>
<!-- build for 4.0 -->
<exec program="${win.dir}\microsoft.net\framework\v4.0.30319\msbuild.exe">
<arg value="${root.dir}\umbraco.sln" />
<arg value="/v:n" />
<arg value="/p:WarningLevel=0" />
<arg value="/p:ToolsVersion=4.0" />
</exec>
<exec program="${win.dir}\microsoft.net\framework\v2.0.50727\aspnet_compiler.exe" commandline="-f -u -p umbraco/presentation -v / &quot;${build.dir}\Net40&quot;"/>
</target>
<!-- Directories and files -->
<target name="directories" depends="build">
<!-- asp.net 2.0 SP1 DLR dlls -->
<delete>
<fileset>
<include name="${build.dir}\**\*" />
<exclude name="${build.dir}\**\businesslogic.dll" />
<exclude name="${build.dir}\**\cms.dll" />
<exclude name="${build.dir}\**\controls.dll" />
<exclude name="${build.dir}\**\Examine.dll" />
<exclude name="${build.dir}\**\interfaces.dll" />
<exclude name="${build.dir}\**\Microsoft.ApplicationBlocks.Data.dll" />
<exclude name="${build.dir}\**\umbraco.DataLayer.dll" />
<exclude name="${build.dir}\**\umbraco.dll" />
<exclude name="${build.dir}\**\umbraco.editorcontrols.dll" />
<exclude name="${build.dir}\**\umbraco.linq.core.dll" />
<exclude name="${build.dir}\**\umbraco.macrorenderings.dll" />
<exclude name="${build.dir}\**\umbraco.providers.dll" />
<exclude name="${build.dir}\**\UmbracoExamine.dll" />
</fileset>
</delete>
<copy todir="${nuget.dir}\lib\Net20">
<fileset basedir="${build.dir}\Net20\bin">
<include name="*.dll" />
</fileset>
</copy>
<copy todir="${nuget.dir}\lib\Net40">
<fileset basedir="${build.dir}\Net40\bin">
<include name="*.dll" />
</fileset>
</copy>
<copy file="${nuget.spec}" tofile="${nuget.dir}\umbraco.nuspec" failonerror="false" overwrite="true"/>
<xmlpoke
file="${nuget.dir}\umbraco.nuspec"
xpath="/package/metadata/version"
value="${build.version}" />
</target>
<!-- will produce the a clean /build folder and nothing else-->
<target name="nuget" depends="directories">
<exec program="${nuget.app}" commandline="pack &quot;${nuget.dir}\umbraco.nuspec&quot; /o &quot;${public.dir}&quot;"/>
</target>
<target name="test">
<exec program="${nuget.app}" commandline="pack &quot;${nuget.dir}\umbraco.nuspec&quot; /o &quot;${public.dir}&quot;"/>
</target>
<target name="init" description="init tasks for the build">
<!-- Clean the plugins dir any leftovers, only tinyMCE belongs in here -->
<delete>
<fileset>
<include name="${build.dir}\umbraco\plugins\*" />
<exclude name="${build.dir}\umbraco\plugins\tinymce3" />
</fileset>
</delete>
<delete dir="${build.dir}" />
<mkdir dir="${build.dir}" />
<delete dir="${nuget.dir}" />
<mkdir dir="${nuget.dir}" />
<mkdir dir="${nuget.dir}\lib\Net20" />
<mkdir dir="${nuget.dir}\lib\Net40" />
</target>
</project>
-310
View File
@@ -1,310 +0,0 @@
<?xml version="1.0" ?>
<project name="umbraco" default="test" basedir=".">
<description>Build the umbraco 3.1.x Application</description>
<!-- global properties, generally won't change -->
<property name="nant.settings.currentframework" value="net-2.0" />
<!-- filenames and directories, generally won't change -->
<property name="web.dir" value="D:\inetpub\wwwroot\v4.umbraco.org" />
<property name="public.dir" value="D:\inetpub\wwwroot\nightlies\umbraco 4.1" />
<property name="root.dir" value="${directory::get-current-directory()}" />
<property name="source.dir" value="${root.dir}\umbraco\presentation" />
<property name="build.dir" value="${root.dir}\build" />
<property name="dlls.dir" value="${root.dir}\foreign dlls" />
<property name="build.version" value="4.1"/>
<property name="docs.dir" value="${root.dir}\docs" />
<property name="win.dir" value="c:\WINDOWS" />
<property name="Webdeploy.dir" value="C:\Program Files\MSBuild\Microsoft\WebDeployment\v8.0" />
<!-- Sandcastle Directories -->
<property name="sandcastle.dir" value="c:\Program Files\Sandcastle" />
<property name="sandcastle.workingdir" value="${root.dir}\docs\SandcastleWorkingDir" />
<property name="sandcastle.output.dir" value="${sandcastle.workingdir}\Output" />
<!-- Sandcastle -->
<property name="sandcastle.mrefbuilder" value="${sandcastle.dir}\productiontools\mrefbuilder.exe" />
<property name="sandcastle.buildassembler" value="${sandcastle.dir}\productiontools\buildassembler.exe" />
<property name="sandcastle.xsltransform" value="${sandcastle.dir}\productiontools\xsltransform.exe" />
<!-- YUI -->
<property name="YUICompressor.dir" value="D:\inetpub\wwwroot\ccnet\buildTools\YUI" />
<!-- Build source -->
<target name="build" depends="init">
<attrib normal="true" readonly="false">
<fileset basedir="${root.dir}">
<include name="**/*" />
</fileset>
</attrib>
<exec program="${win.dir}\microsoft.net\framework\v3.5\msbuild.exe">
<arg value="${root.dir}\umbraco.sln" />
</exec>
<exec program="${win.dir}\microsoft.net\framework\v2.0.50727\aspnet_compiler.exe" commandline="-f -u -p umbraco/presentation -v / &quot;${build.dir}&quot;"/>
</target>
<!-- Directories and files -->
<target name="directories" depends="build">
<!-- setup docs files -->
<mkdir dir="${docs.dir}" />
<copy todir="${docs.dir}">
<fileset basedir="${build.dir}\bin">
<include name="*.xml" />
</fileset>
</copy>
<!--standard web.config-->
<copy file="${root.dir}\config templates\web.config" tofile="${build.dir}\web.config" failonerror="false" overwrite="true"/>
<!--standard /config files-->
<copy file="${root.dir}\config templates\config\404handlers.config" tofile="${build.dir}\config\404handlers.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\dashboard.config" tofile="${build.dir}\config\dashboard.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\formhandlers.config" tofile="${build.dir}\config\formhandlers.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\metablogconfig.config" tofile="${build.dir}\config\metablogconfig.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\restextensions.config" tofile="${build.dir}\config\restextensions.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\xsltextensions.config" tofile="${build.dir}\config\xsltextensions.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\tinymceconfig.config" tofile="${build.dir}\config\tinymceconfig.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\umbracosettings.config" tofile="${build.dir}\config\umbracosettings.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\urlrewriting.config" tofile="${build.dir}\config\urlrewriting.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\applications.config" tofile="${build.dir}\config\applications.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\trees.config" tofile="${build.dir}\config\trees.config" failonerror="false" overwrite="true"/>
<!--standard /data/packages files-->
<copy file="${root.dir}\config templates\packages\installedPackages.config" tofile="${build.dir}\data\packages\installed\installedPackages.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\packages\createdPackages.config" tofile="${build.dir}\data\packages\created\createdPackages.config" failonerror="false" overwrite="true"/>
<!-- Standard access.xml file-->
<copy file="${root.dir}\config templates\access.xml" tofile="${build.dir}\data\access.xml" failonerror="false" overwrite="true"/>
<!-- Standard create UI.xml-->
<copy file="${root.dir}\config templates\config\UI.xml" tofile="${build.dir}\umbraco\config\create\UI.xml" failonerror="false" overwrite="true"/>
<!-- Standard empty cache file -->
<copy file="${root.dir}\config templates\umbraco.config" tofile="${build.dir}\umbraco\data\umbraco.config" failonerror="false" overwrite="true"/>
<!-- Baseline Language file for translation tool -->
<copy file="${build.dir}\umbraco\config\lang\en.xml" tofile="${web.dir}\usercontrols\translation\langs\en.xml" failonerror="false" overwrite="true"/>
<!-- standard folders -->
<mkdir dir="${build.dir}\App_Code" />
<mkdir dir="${build.dir}\App_Data" />
<mkdir dir="${build.dir}\media" />
<mkdir dir="${build.dir}\masterpages" />
<mkdir dir="${build.dir}\scripts" />
<mkdir dir="${build.dir}\css" />
<mkdir dir="${build.dir}\python" />
<mkdir dir="${build.dir}\xslt" />
<mkdir dir="${build.dir}\usercontrols" />
<delete dir="${build.dir}\webservices" />
<delete dir="${build.dir}\umbracoBase" />
<delete dir="${build.dir}\Web References" />
<delete dir="${build.dir}\obj" />
<delete dir="${build.dir}\properties" />
<delete>
<fileset>
<include name="${build.dir}/**/*.build" />
<include name="${build.dir}/**/*.csproj" />
<include name="${build.dir}/**/*.vspscc" />
<include name="${build.dir}/**/*.scc" />
<include name="${build.dir}/**/*.sln" />
<include name="${build.dir}/**/*.compiled" />
<include name="${build.dir}/**/*.resx" />
<include name="${build.dir}/PrecompiledApp.config" />
<include name="${build.dir}/web.config.template" />
</fileset>
</delete>
</target>
<!-- Minify -->
<target name="minify" description="minify JS files" depends="directories">
<fileset basedir="${build.dir}" id="jsFileSet">
<include name="umbraco/css/*.css"/>
<include name="umbraco/js/**/*.js"/>
<include name="umbraco_client/**/*.js"/>
<include name="umbraco_client/**/*.css"/>
</fileset>
<property name="js_files" value=""/>
<foreach item="File" property="file">
<in>
<items refid="jsFileSet"/>
</in>
<do>
<exec program="java" workingdir="${YUICompressor.dir}" failonerror="false">
<arg value="-jar" />
<arg value="yuicompressor.jar" />
<arg value="-o" />
<arg value="${file}.min" />
<arg value="${file}" />
</exec>
<move file="${file}.min" tofile="${file}" overwrite="true" failonerror="false"/>
</do>
</foreach>
</target>
<!-- Documentation -->
<target name="documentation" depends="directories">
<!-- Transformations -->
<property name="sandcastle.addfriendlyfilenames.xsl" value="${sandcastle.dir}\ProductionTransforms\AddFriendlyFilenames.xsl" />
<property name="sandcastle.reflectiontomanifest.xsl" value="${sandcastle.dir}\ProductionTransforms\ReflectionToManifest.xsl" />
<property name="sandcastle.buildassembler.config" value="${sandcastle.dir}\Presentation\wiki\configuration\sandcastle.config" />
<!-- Create a doc dir and move vs comment files to it-->
<mkdir dir="${docs.dir}" />
<copy todir="${docs.dir}">
<fileset basedir="${build.dir}\bin">
<include name="*.xml" />
</fileset>
</copy>
<!-- Create or Cleanup Working Directory -->
<mkdir dir="${sandcastle.workingdir}" if="${not directory::exists(sandcastle.workingdir)}" />
<delete>
<fileset basedir="${sandcastle.workingdir}">
<include name="**\*" />
</fileset>
</delete>
<copy file="${sandcastle.buildassembler.config}" tofile="${sandcastle.workingdir}\Sandcastle.config">
<filterchain>
<replacestring from="%DXROOT%\" to="${sandcastle.dir}" />
<replacestring from=".\comments.xml" to="${docs.dir}\*.xml" />
</filterchain>
</copy>
<!-- Run MRefBuilder (introspection on assemblies) to create basic Reflection XML -->
<exec program="${sandcastle.mrefbuilder}" workingdir="${sandcastle.workingdir}">
<arg value="&quot;${build.dir}\bin\businesslogic.dll&quot; " />
<arg value="&quot;${build.dir}\bin\cms.dll&quot; " />
<arg value="&quot;${build.dir}\bin\controls.dll&quot; " />
<arg value="&quot;${build.dir}\bin\interfaces.dll&quot; " />
<arg value="&quot;${build.dir}\bin\umbraco.datalayer.dll&quot; " />
<arg value="&quot;${build.dir}\bin\umbraco.dll&quot; " />
<arg value="&quot;${build.dir}\bin\umbraco.editorcontrols.dll&quot; " />
<arg value="&quot;${build.dir}\bin\umbraco.providers.dll&quot; " />
<arg value="&quot;${build.dir}\bin\umbraco.webservices.dll&quot; " />
<arg value="/out:reflection.org" />
</exec>
<!-- Regroup overloads -->
<exec program="${sandcastle.xsltransform}" workingdir="${sandcastle.workingdir}">
<arg value="reflection.org" />
<arg value="/xsl:&quot;${sandcastle.addfriendlyfilenames.xsl}&quot;" />
<arg value="/out:reflection.xml" />
</exec>
<exec program="${sandcastle.xsltransform}" workingdir="${sandcastle.workingdir}">
<arg value="reflection.org" />
<arg value="/xsl:&quot;${sandcastle.reflectiontomanifest.xsl}&quot;" />
<arg value="/out:manifest.xml" />
</exec>
<exec program="${sandcastle.buildassembler}" workingdir="${sandcastle.workingdir}">
<arg value="/config:Sandcastle.config" />
<arg value="manifest.xml" />
</exec>
</target>
<!-- do the full release with docs, minify and nightly file distribution -->
<target name="release" depends="zip,minify">
<property name="assembly.name" value="${ assemblyname::get-version( assemblyname::get-assembly-name('umbraco/presentation/bin/umbraco.dll') ) }"/>
<property name="release.filename" value="${root.dir}\build_${build.version}_${assembly.name}.zip" />
<mkdir dir="${public.dir}\${build.version}" />
<copy file="${release.filename}" tofile="${public.dir}\${build.version}\${assembly.name}.zip" />
</target>
<!-- do the full release with docs, minify and nightly file distribution -->
<target name="zip" depends="directories">
<property name="assembly.name" value="${ assemblyname::get-version( assemblyname::get-assembly-name('umbraco/presentation/bin/umbraco.dll') ) }"/>
<property name="release.filename" value="${root.dir}\build_${build.version}_${assembly.name}.zip" />
<zip zipfile="${release.filename}" includeemptydirs="true" >
<fileset basedir="${root.dir}">
<include name="build/*" />
<include name="build/**/*" />
</fileset>
</zip>
</target>
<!-- do a nightly build without the minification and docs -->
<target name="nightly" depends="zip">
<property name="assembly.name" value="${ assemblyname::get-version( assemblyname::get-assembly-name('umbraco/presentation/bin/umbraco.dll') ) }"/>
<property name="release.filename" value="${root.dir}\build_${build.version}_${assembly.name}.zip" />
<mkdir dir="${public.dir}\${build.version}" />
<copy file="${release.filename}" tofile="${public.dir}\${build.version}\${assembly.name}.zip" />
</target>
<!-- will produce the a clean /build folder and nothing else-->
<target name="test" depends="directories">
</target>
<target name="webPIRelease" depends="release,webPiFile">
<copy file="${root.dir}\webPi_sha.txt" tofile="${public.dir}\${build.version}\webPi_sha.txt" />
<copy file="${root.dir}\Umbraco_${build.version}_WebDeploy.zip" tofile="${public.dir}\${build.version}\Umbraco_${build.version}_WebDeploy.zip" />
</target>
<!-- do the webdeploy release for web PI-->
<target name="webPiFile" depends="directories">
<property name="webpi.dir" value="${root.dir}\deploy" />
<delete dir="${webpi.dir}\umbraco" />
<mkdir dir="${webpi.dir}" />
<mkdir dir="${webpi.dir}\umbraco" />
<copy todir="${webpi.dir}\umbraco" includeemptydirs="true" >
<fileset basedir="${root.dir}">
<include name="build/*" />
<include name="build/**/*" />
</fileset>
</copy>
<copy file="d:\webpiAssets\installSQL.sql" tofile="${webpi.dir}\installSQL.sql" failonerror="false"/>
<copy file="d:\webpiAssets\manifest.xml" tofile="${webpi.dir}\manifest.xml" failonerror="false"/>
<copy file="d:\webpiAssets\parameters.xml" tofile="${webpi.dir}\parameters.xml" failonerror="false"/>
<property name="webpi.filename" value="${root.dir}\Umbraco_${build.version}_WebDeploy.zip" />
<zip zipfile="${webpi.filename}" includeemptydirs="true" >
<fileset basedir="${webpi.dir}">
<include name="*" />
<include name="**/*" />
</fileset>
</zip>
<exec program="${win.dir}\hashMyFiles.exe">
<arg value="/file &quot;${webpi.filename}&quot;" />
<arg value="/stext &quot;${root.dir}\webPi_sha.txt&quot;" />
</exec>
</target>
<target name="init" description="init tasks for the build">
<delete dir="${build.dir}" />
<mkdir dir="${build.dir}" />
</target>
</project>
-248
View File
@@ -1,248 +0,0 @@
<?xml version="1.0" ?>
<project name="umbraco" default="compile" basedir=".">
<description>Build the umbraco 3.1.x Application</description>
<!-- global properties, generally won't change -->
<property name="nant.settings.currentframework" value="net-2.0" />
<!-- filenames and directories, generally won't change -->
<property name="web.dir" value="D:\inetpub\wwwroot\v4.umbraco.org" />
<property name="public.dir" value="D:\inetpub\wwwroot\nightlies\umbraco 4.0" />
<property name="root.dir" value="${directory::get-current-directory()}" />
<property name="source.dir" value="${root.dir}\umbraco\presentation" />
<property name="build.dir" value="${root.dir}\build" />
<property name="dlls.dir" value="${root.dir}\foreign dlls" />
<property name="build.major" value="4"/>
<property name="build.minor" value="0"/>
<property name="build.build" value="0"/>
<property name="build.revision" value="0"/>
<property name="docs.dir" value="${root.dir}\docs" />
<property name="win.dir" value="c:\WINDOWS" />
<property name="cc.dir" value="C:\Program Files\CruiseControl.NET\server" />
<property name="Webdeploy.dir" value="C:\Program Files\MSBuild\Microsoft\WebDeployment\v8.0" />
<!-- Sandcastle Directories -->
<property name="sandcastle.dir" value="c:\Program Files\Sandcastle" />
<property name="sandcastle.workingdir" value="${root.dir}\docs\SandcastleWorkingDir" />
<property name="sandcastle.output.dir" value="${sandcastle.workingdir}\Output" />
<!-- Sandcastle Executables -->
<property name="sandcastle.mrefbuilder" value="${sandcastle.dir}\productiontools\mrefbuilder.exe" />
<property name="sandcastle.buildassembler" value="${sandcastle.dir}\productiontools\buildassembler.exe" />
<property name="sandcastle.xsltransform" value="${sandcastle.dir}\productiontools\xsltransform.exe" />
<!-- Transformations -->
<property name="sandcastle.ApplyVSDocModel.xsl" value="${sandcastle.dir}\ProductionTransforms\ApplyVSDocModel.xsl" />
<property name="sandcastle.addguidfilenames.xsl" value="${sandcastle.dir}\ProductionTransforms\AddGuidFilenames.xsl" />
<property name="sandcastle.addfriendlyfilenames.xsl" value="${sandcastle.dir}\ProductionTransforms\AddFriendlyFilenames.xsl" />
<property name="sandcastle.reflectiontomanifest.xsl" value="${sandcastle.dir}\ProductionTransforms\ReflectionToManifest.xsl" />
<property name="sandcastle.reflectiontochmproject.xsl" value="${sandcastle.dir}\ProductionTransforms\ReflectionToChmProject.xsl" />
<property name="sandcastle.reflectiontochmcontents.xsl" value="${sandcastle.dir}\ProductionTransforms\ReflectionToChmContents.xsl" />
<property name="sandcastle.reflectiontochmindex.xsl" value="${sandcastle.dir}\ProductionTransforms\ReflectionToChmIndex.xsl" />
<property name="sandcastle.buildassembler.config" value="${sandcastle.dir}\Presentation\wiki\configuration\sandcastle.config" />
<target name="compile" depends="init">
<attrib normal="true" readonly="false">
<fileset basedir="${root.dir}">
<include name="**/*" />
</fileset>
</attrib>
<exec program="${win.dir}\microsoft.net\framework\v3.5\msbuild.exe">
<arg value="${root.dir}\umbraco.sln" />
</exec>
<exec program="${win.dir}\microsoft.net\framework\v2.0.50727\aspnet_compiler.exe" commandline="-f -u -p umbraco/presentation -v / &quot;${build.dir}&quot;"/>
<!-- Moves stuff around and zips the distribution-->
<call target="zip"/>
<!-- Handles documentation
<call target="docs" />
-->
</target>
<target name="clean" description="remove generated files">
</target>
<target name="docs" description="generates documents">
<!-- Create a doc dir and move vs comment files to it-->
<mkdir dir="${docs.dir}" />
<copy todir="${docs.dir}">
<fileset basedir="${build.dir}\bin">
<include name="*.xml" />
</fileset>
</copy>
<!-- Create or Cleanup Working Directory -->
<mkdir dir="${sandcastle.workingdir}" if="${not directory::exists(sandcastle.workingdir)}" />
<delete>
<fileset basedir="${sandcastle.workingdir}">
<include name="**\*" />
</fileset>
</delete>
<copy file="${sandcastle.buildassembler.config}" tofile="${sandcastle.workingdir}\Sandcastle.config">
<filterchain>
<replacestring from="%DXROOT%\" to="${sandcastle.dir}" />
<replacestring from=".\comments.xml" to="${docs.dir}\*.xml" />
</filterchain>
</copy>
<!-- Run MRefBuilder (introspection on assemblies) to create basic Reflection XML -->
<exec program="${sandcastle.mrefbuilder}" workingdir="${sandcastle.workingdir}">
<arg value="&quot;${build.dir}\bin\businesslogic.dll&quot; " />
<arg value="&quot;${build.dir}\bin\cms.dll&quot; " />
<arg value="&quot;${build.dir}\bin\controls.dll&quot; " />
<arg value="&quot;${build.dir}\bin\interfaces.dll&quot; " />
<arg value="&quot;${build.dir}\bin\umbraco.datalayer.dll&quot; " />
<arg value="&quot;${build.dir}\bin\umbraco.dll&quot; " />
<arg value="&quot;${build.dir}\bin\umbraco.editorcontrols.dll&quot; " />
<arg value="&quot;${build.dir}\bin\umbraco.providers.dll&quot; " />
<arg value="&quot;${build.dir}\bin\umbraco.webservices.dll&quot; " />
<arg value="/out:reflection.org" />
</exec>
<!-- Regroup overloads -->
<exec program="${sandcastle.xsltransform}" workingdir="${sandcastle.workingdir}">
<arg value="reflection.org" />
<arg value="/xsl:&quot;${sandcastle.addfriendlyfilenames.xsl}&quot;" />
<arg value="/out:reflection.xml" />
</exec>
<exec program="${sandcastle.xsltransform}" workingdir="${sandcastle.workingdir}">
<arg value="reflection.org" />
<arg value="/xsl:&quot;${sandcastle.reflectiontomanifest.xsl}&quot;" />
<arg value="/out:manifest.xml" />
</exec>
<exec program="${sandcastle.buildassembler}" workingdir="${sandcastle.workingdir}">
<arg value="/config:Sandcastle.config" />
<arg value="manifest.xml" />
</exec>
</target>
<target name="zip" description="zip the release">
<mkdir dir="${docs.dir}" />
<copy todir="${docs.dir}">
<fileset basedir="${build.dir}\bin">
<include name="*.xml" />
</fileset>
</copy>
<!--standard web.config-->
<copy file="${root.dir}\config templates\web.config" tofile="${build.dir}\web.config" failonerror="false" overwrite="true"/>
<!--standard /config files-->
<copy file="${root.dir}\config templates\config\404handlers.config" tofile="${build.dir}\config\404handlers.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\dashboard.config" tofile="${build.dir}\config\dashboard.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\formhandlers.config" tofile="${build.dir}\config\formhandlers.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\metablogconfig.config" tofile="${build.dir}\config\metablogconfig.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\restextensions.config" tofile="${build.dir}\config\restextensions.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\xsltextensions.config" tofile="${build.dir}\config\xsltextensions.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\tinymceconfig.config" tofile="${build.dir}\config\tinymceconfig.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\umbracosettings.config" tofile="${build.dir}\config\umbracosettings.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\urlrewriting.config" tofile="${build.dir}\config\urlrewriting.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\applications.config" tofile="${build.dir}\config\applications.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\config\trees.config" tofile="${build.dir}\config\trees.config" failonerror="false" overwrite="true"/>
<!--standard /data/packages files-->
<copy file="${root.dir}\config templates\packages\installedPackages.config" tofile="${build.dir}\data\packages\installed\installedPackages.config" failonerror="false" overwrite="true"/>
<copy file="${root.dir}\config templates\packages\createdPackages.config" tofile="${build.dir}\data\packages\created\createdPackages.config" failonerror="false" overwrite="true"/>
<!-- Standard access.xml file-->
<copy file="${root.dir}\config templates\access.xml" tofile="${build.dir}\data\access.xml" failonerror="false" overwrite="true"/>
<!-- Standard create UI.xml-->
<copy file="${root.dir}\config templates\config\UI.xml" tofile="${build.dir}\umbraco\config\create\UI.xml" failonerror="false" overwrite="true"/>
<!-- Standard empty cache file -->
<copy file="${root.dir}\config templates\umbraco.config" tofile="${build.dir}\umbraco\data\umbraco.config" failonerror="false" overwrite="true"/>
<!-- Baseline Language file for translation tool -->
<copy file="${build.dir}\umbraco\config\lang\en.xml" tofile="${web.dir}\usercontrols\translation\langs\en.xml" failonerror="false" overwrite="true"/>
<!--
<delete dir="${build.dir}\umbraco\webservices\api" />
<mkdir dir="${build.dir}\umbraco\webservices\api" />
<copy todir="${build.dir}\umbraco\webservices\api">
<fileset basedir="${root.dir}\components\umbraco.webservices}">
<include name="*.asmx" />
</fileset>
</copy>
-->
<!-- standard folders -->
<mkdir dir="${build.dir}\App_Code" />
<mkdir dir="${build.dir}\media" />
<mkdir dir="${build.dir}\masterpages" />
<mkdir dir="${build.dir}\scripts" />
<mkdir dir="${build.dir}\css" />
<mkdir dir="${build.dir}\python" />
<mkdir dir="${build.dir}\xslt" />
<mkdir dir="${build.dir}\usercontrols" />
<delete dir="${build.dir}\webservices" />
<delete dir="${build.dir}\umbracoBase" />
<delete dir="${build.dir}\Web References" />
<delete dir="${build.dir}\obj" />
<delete dir="${build.dir}\properties" />
<delete>
<fileset>
<include name="${build.dir}/**/*.build" />
<include name="${build.dir}/**/*.csproj" />
<include name="${build.dir}/**/*.vspscc" />
<include name="${build.dir}/**/*.scc" />
<include name="${build.dir}/**/*.sln" />
<include name="${build.dir}/**/*.compiled" />
<include name="${build.dir}/**/*.resx" />
<include name="${build.dir}/PrecompiledApp.config" />
<include name="${build.dir}/web.config.template" />
</fileset>
</delete>
<property name="dist.name" value="${ assemblyname::get-version( assemblyname::get-assembly-name('umbraco/presentation/bin/umbraco.dll') ) }"/>
<zip zipfile="${web.dir}\nightly\umbraco40.zip" includeemptydirs="true" >
<fileset basedir="${root.dir}">
<include name="build/*" />
<include name="build/**/*" />
</fileset>
</zip>
<copy file="${web.dir}\nightly\umbraco40.zip" tofile="${public.dir}\${dist.name}_${datetime::get-ticks(datetime::now())}.zip" />
<copy file="${root.dir}\build.xml" tofile="${web.dir}\nightly\build.xml">
<filterchain>
<replacetokens>
<token key="assembly" value="${dist.name}" />
<token key="date" value="${datetime::now()}" />
</replacetokens>
</filterchain>
</copy>
</target>
<target name="init" description="init tasks for the build">
<delete dir="${build.dir}" />
<mkdir dir="${build.dir}" />
</target>
</project>
+1 -1
View File
@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>UmbracoCms.Core</id>
<version>4.9.0</version>
<version>4.11.2</version>
<title>Umbraco Cms Core Binaries</title>
<authors>Morten Christensen</authors>
<owners>Umbraco HQ</owners>
+2 -2
View File
@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>UmbracoCms</id>
<version>4.9.0</version>
<version>4.11.2</version>
<title>Umbraco Cms</title>
<authors>Morten Christensen</authors>
<owners>Umbraco HQ</owners>
@@ -15,7 +15,7 @@
<language>en-US</language>
<tags>umbraco</tags>
<dependencies>
<dependency id="UmbracoCms.Core" version="4.9.0" />
<dependency id="UmbracoCms.Core" version="4.11.2" />
</dependencies>
</metadata>
<files>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+7 -6
View File
@@ -146,7 +146,8 @@ CREATE TABLE [cmsContentType]
[pk] [int] NOT NULL IDENTITY(1, 1),
[nodeId] [int] NOT NULL,
[alias] [nvarchar] (255) NULL,
[icon] [nvarchar] (255) NULL
[icon] [nvarchar] (255) NULL,
[thumbnail] nvarchar(255) NOT NULL CONSTRAINT [DF_cmsContentType_thumbnail] DEFAULT ('folder.png')
)
;
@@ -657,9 +658,9 @@ ALTER TABLE [umbracoNode] DROP CONSTRAINT [FK_umbracoNode_umbracoNode]
|SET IDENTITY_INSERT [umbracoNode] OFF
;
!!!SET IDENTITY_INSERT [cmsContentType] ON
|INSERT INTO [cmsContentType] ([pk], [nodeId], [alias], [icon]) VALUES (532, 1031, N'Folder', N'folder.gif')
|INSERT INTO [cmsContentType] ([pk], [nodeId], [alias], [icon]) VALUES (533, 1032, N'Image', N'mediaPhoto.gif')
|INSERT INTO [cmsContentType] ([pk], [nodeId], [alias], [icon]) VALUES (534, 1033, N'File', N'mediaFile.gif')
|INSERT INTO [cmsContentType] ([pk], [nodeId], [alias], [icon], [thumbnail]) VALUES (532, 1031, N'Folder', N'folder.gif', N'folder.png')
|INSERT INTO [cmsContentType] ([pk], [nodeId], [alias], [icon], [thumbnail]) VALUES (533, 1032, N'Image', N'mediaPhoto.gif', N'mediaPhoto.png')
|INSERT INTO [cmsContentType] ([pk], [nodeId], [alias], [icon], [thumbnail]) VALUES (534, 1033, N'File', N'mediaFile.gif', N'mediaFile.png')
|SET IDENTITY_INSERT [cmsContentType] OFF
;
!!!SET IDENTITY_INSERT [umbracoUser] ON
@@ -863,10 +864,10 @@ INSERT INTO [umbracoAppTree]([treeSilent], [treeInitialize], [treeSortOrder], [a
INSERT INTO [umbracoAppTree]([treeSilent], [treeInitialize], [treeSortOrder], [appAlias], [treeAlias], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES(0, 1, 2, 'settings', 'scripts', 'Scripts', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadScripts')
;
*/
alter TABLE [cmsContentType]
/*alter TABLE [cmsContentType]
add [thumbnail] nvarchar(255) NOT NULL CONSTRAINT
[DF_cmsContentType_thumbnail] DEFAULT ('folder.png')
;
;*/
alter TABLE [cmsContentType]
add [description] nvarchar(1500) NULL
;
+1
View File
@@ -79,6 +79,7 @@
<EmbeddedResource Include="SqlCEResources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>SqlCEResources1.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
+1 -1
View File
@@ -51,7 +51,7 @@ namespace SqlCE4Umbraco
internal void ClearDatabase()
{
var localConnection = new SqlCeConnection(ConnectionString);
if (!System.IO.File.Exists(ReplaceDataDirectory(localConnection.Database)))
if (System.IO.File.Exists(ReplaceDataDirectory(localConnection.Database)))
{
var tables = new List<string>();
using (var reader = ExecuteReader("select table_name from information_schema.tables where TABLE_TYPE <> 'VIEW'"))
+3 -3
View File
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.17626
// Runtime Version:4.0.30319.18010
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -73,11 +73,11 @@ namespace SQLCE4Umbraco {
///
///IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT
///
/// Database version: 4.8.0.2
/// Database version: 4.10.0.0
///
/// Please increment this version number if ANY change is made to this script,
/// so compatibility with scripts for other database systems can be verified easily.
/// The first 3 digits depict the Umbraco [rest of string was truncated]&quot;;.
/// The first 3 digits depict the Umbraco [rest of string was truncated]&quot;;.
/// </summary>
internal static string Total {
get {
+59
View File
@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using Umbraco.Core.ObjectResolution;
using umbraco.interfaces;
namespace Umbraco.Core
{
/// <summary>
/// A resolver to return all IAction objects
/// </summary>
internal sealed class ActionsResolver : ManyObjectsResolverBase<ActionsResolver, IAction>
{
/// <summary>
/// Constructor
/// </summary>
/// <param name="packageActions"></param>
internal ActionsResolver(IEnumerable<Type> packageActions)
: base(packageActions)
{
}
/// <summary>
/// Gets the <see cref="IPackageAction"/> implementations.
/// </summary>
public IEnumerable<IAction> Actions
{
get
{
return Values;
}
}
protected override IEnumerable<IAction> CreateInstances()
{
var actions = new List<IAction>();
var foundIActions = PluginManager.Current.ResolveActions();
foreach (var type in foundIActions)
{
IAction typeInstance;
var instance = type.GetProperty("Instance", BindingFlags.Public | BindingFlags.Static);
//if the singletone initializer is not found, try simply creating an instance of the IAction if it supports public constructors
if (instance == null)
typeInstance = PluginManager.Current.CreateInstance<IAction>(type);
else
typeInstance = instance.GetValue(null, null) as IAction;
if (typeInstance != null)
{
actions.Add(typeInstance);
}
}
return actions;
}
}
}
+20
View File
@@ -0,0 +1,20 @@
using System;
namespace Umbraco.Core
{
/// <summary>
/// Helper methods for Activation
/// </summary>
internal static class ActivatorHelper
{
/// <summary>
/// Creates an instance of a type using that type's default constructor.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public static T CreateInstance<T>() where T : class, new()
{
return Activator.CreateInstance(typeof(T)) as T;
}
}
}
+143
View File
@@ -0,0 +1,143 @@
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Web;
using System.Web.Caching;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
namespace Umbraco.Core
{
/// <summary>
/// the Umbraco Application context
/// </summary>
/// <remarks>
/// one per AppDomain, represents the global Umbraco application
/// </remarks>
public class ApplicationContext
{
/// <summary>
/// Constructor
/// </summary>
internal ApplicationContext()
{
//create a new application cache from the HttpRuntime.Cache
ApplicationCache = HttpRuntime.Cache == null
? new CacheHelper(new Cache())
: new CacheHelper(HttpRuntime.Cache);
}
/// <summary>
/// Singleton accessor
/// </summary>
public static ApplicationContext Current { get; internal set; }
/// <summary>
/// Returns the application wide cache accessor
/// </summary>
/// <remarks>
/// Any caching that is done in the application (app wide) should be done through this property
/// </remarks>
public CacheHelper ApplicationCache { get; private set; }
// IsReady is set to true by the boot manager once it has successfully booted
// note - the original umbraco module checks on content.Instance in umbraco.dll
// now, the boot task that setup the content store ensures that it is ready
bool _isReady = false;
readonly System.Threading.ManualResetEventSlim _isReadyEvent = new System.Threading.ManualResetEventSlim(false);
public bool IsReady
{
get
{
return _isReady;
}
internal set
{
AssertIsNotReady();
_isReady = value;
_isReadyEvent.Set();
}
}
public bool WaitForReady(int timeout)
{
return _isReadyEvent.WaitHandle.WaitOne(timeout);
}
// notes
// GlobalSettings.ConfigurationStatus returns the value that's in the web.config, so it's the "configured version"
// GlobalSettings.CurrentVersion returns the hard-coded "current version"
// the system is configured if they match
// if they don't, install runs, updates web.config (presumably) and updates GlobalSettings.ConfiguredStatus
//
// then there is Application["umbracoNeedConfiguration"] which makes no sense... getting rid of it...
//
public bool IsConfigured
{
// fixme - let's do this for the time being
get
{
return Configured;
}
}
private bool Configured
{
get
{
try
{
string configStatus = ConfigurationStatus;
string currentVersion = GlobalSettings.CurrentVersion;
if (currentVersion != configStatus)
{
LogHelper.Info<ApplicationContext>("CurrentVersion different from configStatus: '" + currentVersion + "','" + configStatus + "'");
}
return (configStatus == currentVersion);
}
catch
{
return false;
}
}
}
private string ConfigurationStatus
{
get
{
try
{
return ConfigurationManager.AppSettings["umbracoConfigurationStatus"];
}
catch
{
return String.Empty;
}
}
}
private void AssertIsReady()
{
if (!this.IsReady)
throw new Exception("ApplicationContext is not ready yet.");
}
private void AssertIsNotReady()
{
if (this.IsReady)
throw new Exception("ApplicationContext has already been initialized.");
}
}
}
+36
View File
@@ -0,0 +1,36 @@
using System;
using System.IO;
using System.Reflection;
namespace Umbraco.Core
{
internal static class AssemblyExtensions
{
/// <summary>
/// Returns the file used to load the assembly
/// </summary>
/// <param name="assembly"></param>
/// <returns></returns>
public static FileInfo GetAssemblyFile(this Assembly assembly)
{
var codeBase = assembly.CodeBase;
var uri = new Uri(codeBase);
var path = uri.LocalPath;
return new FileInfo(path);
}
/// <summary>
/// Returns the file used to load the assembly
/// </summary>
/// <param name="assemblyName"></param>
/// <returns></returns>
public static FileInfo GetAssemblyFile(this AssemblyName assemblyName)
{
var codeBase = assemblyName.CodeBase;
var uri = new Uri(codeBase);
var path = uri.LocalPath;
return new FileInfo(path);
}
}
}
+66
View File
@@ -0,0 +1,66 @@
using System;
namespace Umbraco.Core
{
/// <summary>
/// Represents the result of an operation attempt
/// </summary>
/// <typeparam name="T"></typeparam>
/// <remarks></remarks>
[Serializable]
public struct Attempt<T>
{
private readonly bool _success;
private readonly T _result;
private readonly Exception _error;
/// <summary>
/// Gets a value indicating whether this <see cref="Attempt{T}"/> represents a successful operation.
/// </summary>
/// <remarks></remarks>
public bool Success
{
get { return _success; }
}
/// <summary>
/// Gets the error associated with an unsuccessful attempt.
/// </summary>
/// <value>The error.</value>
public Exception Error { get { return _error; } }
/// <summary>
/// Gets the parse result.
/// </summary>
/// <remarks></remarks>
public T Result
{
get { return _result; }
}
/// <summary>
/// Represents an unsuccessful parse operation
/// </summary>
public static readonly Attempt<T> False = new Attempt<T>(false, default(T));
/// <summary>
/// Initializes a new instance of the <see cref="Attempt{T}"/> struct.
/// </summary>
/// <param name="success">If set to <c>true</c> this tuple represents a successful parse result.</param>
/// <param name="result">The parse result.</param>
/// <remarks></remarks>
public Attempt(bool success, T result)
{
_success = success;
_result = result;
_error = null;
}
public Attempt(Exception error)
{
_success = false;
_result = default(T);
_error = error;
}
}
}
+164
View File
@@ -0,0 +1,164 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Caching;
using Umbraco.Core.Logging;
namespace Umbraco.Core
{
/// <summary>
/// Class that is exposed by the ApplicationContext for application wide caching purposes
/// </summary>
/// <remarks>
/// This class may be opened publicly at some point but needs a review of what is absoletely necessary.
/// </remarks>
public class CacheHelper
{
private readonly Cache _cache;
public CacheHelper(System.Web.Caching.Cache cache)
{
_cache = cache;
}
private static readonly object Locker = new object();
/// <summary>
/// Clears everything in umbraco's runtime cache, which means that not only
/// umbraco content is removed, but also other cache items from pages running in
/// the same application / website. Use with care :-)
/// </summary>
public void ClearAllCache()
{
var cacheEnumerator = _cache.GetEnumerator();
while (cacheEnumerator.MoveNext())
{
_cache.Remove(cacheEnumerator.Key.ToString());
}
}
/// <summary>
/// Clears the item in umbraco's runtime cache with the given key
/// </summary>
/// <param name="key">Key</param>
public void ClearCacheItem(string key)
{
// NH 10 jan 2012
// Patch by the always wonderful Stéphane Gay to avoid cache null refs
lock (Locker)
{
if (_cache[key] == null) return;
_cache.Remove(key);;
}
}
/// <summary>
/// Clears all objects in the System.Web.Cache with the System.Type name as the
/// input parameter. (using [object].GetType())
/// </summary>
/// <param name="typeName">The name of the System.Type which should be cleared from cache ex "System.Xml.XmlDocument"</param>
public void ClearCacheObjectTypes(string typeName)
{
try
{
lock (Locker)
{
foreach (var c in from DictionaryEntry c in _cache where _cache[c.Key.ToString()] != null && _cache[c.Key.ToString()].GetType().ToString() == typeName select c)
{
_cache.Remove(c.Key.ToString());
}
}
}
catch (Exception e)
{
LogHelper.Error<CacheHelper>("Cache clearing error", e);
}
}
/// <summary>
/// Clears all cache items that starts with the key passed.
/// </summary>
/// <param name="keyStartsWith">The start of the key</param>
public void ClearCacheByKeySearch(string keyStartsWith)
{
foreach (var c in from DictionaryEntry c in _cache where c.Key is string && ((string)c.Key).StartsWith(keyStartsWith) select c)
{
ClearCacheItem((string)c.Key);
}
}
public TT GetCacheItem<TT>(string cacheKey,
TimeSpan timeout, Func<TT> getCacheItem)
{
return GetCacheItem(cacheKey, null, timeout, getCacheItem);
}
public TT GetCacheItem<TT>(string cacheKey,
CacheItemRemovedCallback refreshAction, TimeSpan timeout,
Func<TT> getCacheItem)
{
return GetCacheItem(cacheKey, CacheItemPriority.Normal, refreshAction, timeout, getCacheItem);
}
public TT GetCacheItem<TT>(string cacheKey,
CacheItemPriority priority, CacheItemRemovedCallback refreshAction, TimeSpan timeout,
Func<TT> getCacheItem)
{
return GetCacheItem(cacheKey, priority, refreshAction, null, timeout, getCacheItem);
}
public TT GetCacheItem<TT>(string cacheKey,
CacheItemPriority priority,
CacheItemRemovedCallback refreshAction,
CacheDependency cacheDependency,
TimeSpan timeout,
Func<TT> getCacheItem)
{
return GetCacheItem(cacheKey, priority, refreshAction, cacheDependency, timeout, getCacheItem, Locker);
}
/// <summary>
/// This is used only for legacy purposes as I did not want to change all of the locking to one lock found on this object,
/// however, the reason this is used for legacy purposes is because I see zero reason to use different sync locks, just the one
/// lock (Locker) on this class should be sufficient.
/// </summary>
/// <typeparam name="TT"></typeparam>
/// <param name="cacheKey"></param>
/// <param name="priority"></param>
/// <param name="refreshAction"></param>
/// <param name="cacheDependency"></param>
/// <param name="timeout"></param>
/// <param name="getCacheItem"></param>
/// <param name="syncLock"></param>
/// <returns></returns>
internal TT GetCacheItem<TT>(string cacheKey,
CacheItemPriority priority, CacheItemRemovedCallback refreshAction,
CacheDependency cacheDependency, TimeSpan timeout, Func<TT> getCacheItem, object syncLock)
{
var result = _cache.Get(cacheKey);
if (result == null)
{
lock (syncLock)
{
result = _cache.Get(cacheKey);
if (result == null)
{
result = getCacheItem();
if (result != null)
{
//we use Insert instead of add if for some crazy reason there is now a cache with the cache key in there, it will just overwrite it.
_cache.Insert(cacheKey, result, cacheDependency, DateTime.Now.Add(timeout), TimeSpan.Zero, priority, refreshAction);
}
}
}
}
return (TT)result;
}
}
}
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using Umbraco.Core.ObjectResolution;
using umbraco.interfaces;
namespace Umbraco.Core
{
/// <summary>
/// A resolver to return all ICacheRefresher objects
/// </summary>
internal sealed class CacheRefreshersResolver : LegacyTransientObjectsResolver<CacheRefreshersResolver, ICacheRefresher>
{
/// <summary>
/// Constructor
/// </summary>
/// <param name="refreshers"></param>
internal CacheRefreshersResolver(IEnumerable<Type> refreshers)
: base(refreshers)
{
}
/// <summary>
/// Gets the <see cref="ICacheRefresher"/> implementations.
/// </summary>
public IEnumerable<ICacheRefresher> CacheResolvers
{
get
{
EnsureIdsAreTracked();
return Values;
}
}
protected override Guid GetUniqueIdentifier(ICacheRefresher obj)
{
return obj.UniqueIdentifier;
}
}
}
@@ -0,0 +1,35 @@
using System;
namespace Umbraco.Core.CodeAnnotations
{
/// <summary>
/// Marks the program elements that Umbraco is experimenting with and could become public.
/// </summary>
/// <remarks>
/// <para>Indicates that Umbraco is experimenting with code that potentially could become
/// public, but we're not sure, and the code is not stable and can be refactored at any time.</para>
/// <para>The issue tracker should contain more details, discussion, and planning.</para>
/// </remarks>
[AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = false)]
internal sealed class UmbracoExperimentalFeatureAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="UmbracoExperimentalFeatureAttribute"/> class with a description.
/// </summary>
/// <param name="description">The text string that describes what is intended.</param>
public UmbracoExperimentalFeatureAttribute(string description)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="UmbracoExperimentalFeatureAttribute"/> class with a tracker url and a description.
/// </summary>
/// <param name="trackerUrl">The url of a tracker issue containing more details, discussion, and planning.</param>
/// <param name="description">The text string that describes what is intended.</param>
public UmbracoExperimentalFeatureAttribute(string trackerUrl, string description)
{
}
}
}
@@ -0,0 +1,36 @@
using System;
namespace Umbraco.Core.CodeAnnotations
{
/// <summary>
/// Marks the program elements that Umbraco is considering making public.
/// </summary>
/// <remarks>
/// <para>Indicates that Umbraco considers making the (currently internal) program element public
/// at some point in the future, but the decision is not fully made yet and is still pending reviews.</para>
/// <para>Note that it is not a commitment to make the program element public. It may not ever become public.</para>
/// <para>The issue tracker should contain more details, discussion, and planning.</para>
/// </remarks>
[AttributeUsage(AttributeTargets.All, AllowMultiple=false, Inherited=false)]
internal sealed class UmbracoProposedPublicAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="UmbracoProposedPublicAttribute"/> class with a description.
/// </summary>
/// <param name="description">The text string that describes what is intended.</param>
public UmbracoProposedPublicAttribute(string description)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="UmbracoProposedPublicAttribute"/> class with a tracker url and a description.
/// </summary>
/// <param name="trackerUrl">The url of a tracker issue containing more details, discussion, and planning.</param>
/// <param name="description">The text string that describes what is intended.</param>
public UmbracoProposedPublicAttribute(string trackerUrl, string description)
{
}
}
}
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Umbraco.Core.CodeAnnotations
{
/// <summary>
/// Marks the program elements that Umbraco will obsolete.
/// </summary>
/// <remarks>
/// Indicates that Umbraco will obsolete the program element at some point in the future, but we do not want to
/// explicitely mark it [Obsolete] yet to avoid warning messages showing when developers compile Umbraco.
/// </remarks>
[AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = false)]
internal sealed class UmbracoWillObsoleteAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="UmbracoWillObsoleteAttribute"/> class with a description.
/// </summary>
/// <param name="description">The text string that describes what is intended.</param>
public UmbracoWillObsoleteAttribute(string description)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="UmbracoWillObsoleteAttribute"/> class with a tracker url and a description.
/// </summary>
/// <param name="trackerUrl">The url of a tracker issue containing more details, discussion, and planning.</param>
/// <param name="description">The text string that describes what is intended.</param>
public UmbracoWillObsoleteAttribute(string trackerUrl, string description)
{
}
}
}
+158 -270
View File
@@ -1,23 +1,23 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.Linq;
using System.Web;
using System.Web.Configuration;
using System.Web.Routing;
using System.Xml;
using System.Xml.Linq;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
namespace Umbraco.Core.Configuration
{
//NOTE: Do not expose this class ever until we cleanup all configuration including removal of static classes, etc...
// we have this two tasks logged:
// http://issues.umbraco.org/issue/U4-58
// http://issues.umbraco.org/issue/U4-115
//TODO: Re-enable Logging!!!!
//TODO: Remove checks for if HttpContext is null, why are we doing this? we should be checking if the config setting
// can be read and if not then return the default.
// http://issues.umbraco.org/issue/U4-115
//TODO: Replace checking for if the app settings exist and returning an empty string, instead return the defaults!
/// <summary>
/// The GlobalSettings Class contains general settings information for the entire Umbraco instance based on information from web.config appsettings
@@ -25,38 +25,10 @@ namespace Umbraco.Core.Configuration
internal class GlobalSettings
{
private static HttpContextBase _customHttpContext;
/// <summary>
/// Gets/sets the HttpContext object, this is generally used for unit testing. By default this will
/// use the HttpContext.Current
/// </summary>
internal static HttpContextBase HttpContext
{
get
{
if (_customHttpContext == null && System.Web.HttpContext.Current != null)
{
//return the current HttpContxt, do NOT store this in the _customHttpContext field
//as it will persist across reqeusts!
return new HttpContextWrapper(System.Web.HttpContext.Current);
}
if (_customHttpContext == null && System.Web.HttpContext.Current == null)
{
//throw new NullReferenceException("The HttpContext property has not been set or the object execution is not running inside of an HttpContext");
//NOTE: We should throw an exception here but the legacy code checks for null so we need to stick witht he legacy code for now.
return null;
}
return _customHttpContext;
}
set { _customHttpContext = value; }
}
#region Private static fields
// CURRENT UMBRACO VERSION ID
private const string CurrentUmbracoVersion = "4.9.1";
private const string CurrentUmbracoVersion = "4.11.2";
private static string _reservedUrlsCache;
private static string _reservedPathsCache;
@@ -72,9 +44,9 @@ namespace Umbraco.Core.Configuration
{
get
{
if (HttpContext != null)
return ConfigurationManager.AppSettings["umbracoReservedUrls"];
return String.Empty;
return ConfigurationManager.AppSettings.ContainsKey("umbracoReservedUrls")
? ConfigurationManager.AppSettings["umbracoReservedUrls"]
: string.Empty;
}
}
@@ -86,9 +58,9 @@ namespace Umbraco.Core.Configuration
{
get
{
if (HttpContext != null)
return ConfigurationManager.AppSettings["umbracoReservedPaths"];
return String.Empty;
return ConfigurationManager.AppSettings.ContainsKey("umbracoReservedPaths")
? ConfigurationManager.AppSettings["umbracoReservedPaths"]
: string.Empty;
}
}
@@ -96,18 +68,13 @@ namespace Umbraco.Core.Configuration
/// Gets the name of the content XML file.
/// </summary>
/// <value>The content XML.</value>
public static string ContentXml
public static string ContentXmlFile
{
get
{
try
{
return ConfigurationManager.AppSettings["umbracoContentXML"];
}
catch
{
return String.Empty;
}
{
return ConfigurationManager.AppSettings.ContainsKey("umbracoContentXML")
? ConfigurationManager.AppSettings["umbracoContentXML"]
: string.Empty;
}
}
@@ -119,14 +86,9 @@ namespace Umbraco.Core.Configuration
{
get
{
try
{
return ConfigurationManager.AppSettings["umbracoStorageDirectory"];
}
catch
{
return String.Empty;
}
return ConfigurationManager.AppSettings.ContainsKey("umbracoStorageDirectory")
? ConfigurationManager.AppSettings["umbracoStorageDirectory"]
: string.Empty;
}
}
@@ -138,18 +100,35 @@ namespace Umbraco.Core.Configuration
{
get
{
try
{
return IOHelper.ResolveUrl(ConfigurationManager.AppSettings["umbracoPath"]);
}
catch
{
return String.Empty;
}
return ConfigurationManager.AppSettings.ContainsKey("umbracoPath")
? IOHelper.ResolveUrl(ConfigurationManager.AppSettings["umbracoPath"])
: string.Empty;
}
}
/// <summary>
/// This returns the string of the MVC Area route.
/// </summary>
/// <remarks>
/// THIS IS TEMPORARY AND SHOULD BE REMOVED WHEN WE MIGRATE/UPDATE THE CONFIG SETTINGS TO BE A REAL CONFIG SECTION
/// AND SHOULD PROBABLY BE HANDLED IN A MORE ROBUST WAY.
///
/// This will return the MVC area that we will route all custom routes through like surface controllers, etc...
/// We will use the 'Path' (default ~/umbraco) to create it but since it cannot contain '/' and people may specify a path of ~/asdf/asdf/admin
/// we will convert the '/' to '-' and use that as the path. its a bit lame but will work.
/// </remarks>
internal static string UmbracoMvcArea
{
get
{
if (Path.IsNullOrWhiteSpace())
{
throw new InvalidOperationException("Cannot create an MVC Area path without the umbracoPath specified");
}
return Path.TrimStart('~').TrimStart('/').Replace('/', '-').Trim();
}
}
/// <summary>
/// Gets the path to umbraco's client directory (/umbraco_client by default).
/// This is a relative path to the Umbraco Path as it always must exist beside the 'umbraco'
@@ -172,14 +151,9 @@ namespace Umbraco.Core.Configuration
{
get
{
try
{
return ConfigurationManager.AppSettings["umbracoDbDSN"];
}
catch
{
return String.Empty;
}
return ConfigurationManager.AppSettings.ContainsKey("umbracoDbDSN")
? ConfigurationManager.AppSettings["umbracoDbDSN"]
: string.Empty;
}
set
{
@@ -198,45 +172,16 @@ namespace Umbraco.Core.Configuration
{
get
{
try
{
return ConfigurationManager.AppSettings["umbracoConfigurationStatus"];
}
catch
{
return String.Empty;
}
return ConfigurationManager.AppSettings.ContainsKey("umbracoConfigurationStatus")
? ConfigurationManager.AppSettings["umbracoConfigurationStatus"]
: string.Empty;
}
set
{
SaveSetting("umbracoConfigurationStatus", value);
}
}
/// <summary>
/// Forces umbraco to be medium trust compatible
/// </summary>
/// <value>If true, umbraco will be medium-trust compatible, no matter what Permission level the server is on.</value>
public static bool UseMediumTrust
{
get
{
try
{
var trustLevel = SystemUtilities.GetCurrentTrustLevel();
if (trustLevel == AspNetHostingPermissionLevel.High || trustLevel == AspNetHostingPermissionLevel.Unrestricted)
return false;
else
return bool.Parse(ConfigurationManager.AppSettings["umbracoUseMediumTrust"]);
}
catch
{
return false;
}
}
}
/// <summary>
/// Saves a setting into the configuration file.
/// </summary>
@@ -254,13 +199,19 @@ namespace Umbraco.Core.Configuration
vDir = v.PhysicalDirectory;
}
}
var doc = new XmlDocument();
doc.Load(String.Concat(vDir, "web.config"));
var root = doc.DocumentElement;
var setting = doc.SelectSingleNode(String.Concat("//appSettings/add[@key='", key, "']"));
setting.Attributes["value"].InnerText = value;
doc.Save(String.Concat(vDir, "web.config"));
string fileName = String.Concat(vDir, "web.config");
var xml = XDocument.Load(fileName);
var appSettings = xml.Root.Descendants("appSettings").Single();
// Update appSetting if it exists, or else create a new appSetting for the given key and value
var setting = appSettings.Descendants("add").Where(s => s.Attribute("key").Value == key).FirstOrDefault();
if (setting == null)
appSettings.Add(new XElement("add", new XAttribute("key", key), new XAttribute("value", value)));
else
setting.Attribute("value").Value = value;
xml.Save(fileName);
ConfigurationManager.RefreshSection("appSettings");
}
@@ -308,9 +259,7 @@ namespace Umbraco.Core.Configuration
if (currentVersion != configStatus)
{
//Log.Add(LogTypes.Debug, User.GetUser(0), -1,
// "CurrentVersion different from configStatus: '" + currentVersion + "','" + configStatus +
// "'");
LogHelper.Debug<GlobalSettings>("CurrentVersion different from configStatus: '" + currentVersion + "','" + configStatus + "'");
}
@@ -369,69 +318,17 @@ namespace Umbraco.Core.Configuration
{
get
{
int versionCheckPeriod = 7;
if (HttpContext != null)
{
if (int.TryParse(ConfigurationManager.AppSettings["umbracoVersionCheckPeriod"], out versionCheckPeriod))
return versionCheckPeriod;
}
return versionCheckPeriod;
try
{
return int.Parse(ConfigurationManager.AppSettings["umbracoVersionCheckPeriod"]);
}
catch
{
return 7;
}
}
}
/// <summary>
/// Gets the URL forbitten characters.
/// </summary>
/// <value>The URL forbitten characters.</value>
public static string UrlForbittenCharacters
{
get
{
if (HttpContext != null)
return ConfigurationManager.AppSettings["umbracoUrlForbittenCharacters"];
return "";
}
}
/// <summary>
/// Gets the URL space character.
/// </summary>
/// <value>The URL space character.</value>
public static string UrlSpaceCharacter
{
get
{
if (HttpContext != null)
return ConfigurationManager.AppSettings["umbracoUrlSpaceCharacter"];
return "";
}
}
/// <summary>
/// Gets the SMTP server IP-address or hostname.
/// </summary>
/// <value>The SMTP server.</value>
public static string SmtpServer
{
get
{
try
{
var mailSettings = ConfigurationManager.GetSection("system.net/mailSettings") as System.Net.Configuration.MailSettingsSectionGroup;
if (mailSettings != null)
return mailSettings.Smtp.Network.Host;
else
return ConfigurationManager.AppSettings["umbracoSmtpServer"];
}
catch
{
return "";
}
}
}
/// <summary>
/// Returns a string value to determine if umbraco should disbable xslt extensions
/// </summary>
@@ -440,9 +337,9 @@ namespace Umbraco.Core.Configuration
{
get
{
if (HttpContext != null)
return ConfigurationManager.AppSettings["umbracoDisableXsltExtensions"];
return "";
return ConfigurationManager.AppSettings.ContainsKey("umbracoDisableXsltExtensions")
? ConfigurationManager.AppSettings["umbracoDisableXsltExtensions"]
: string.Empty;
}
}
@@ -454,9 +351,9 @@ namespace Umbraco.Core.Configuration
{
get
{
if (HttpContext != null)
return ConfigurationManager.AppSettings["umbracoEditXhtmlMode"];
return "";
return ConfigurationManager.AppSettings.ContainsKey("umbracoEditXhtmlMode")
? ConfigurationManager.AppSettings["umbracoEditXhtmlMode"]
: string.Empty;
}
}
@@ -468,9 +365,9 @@ namespace Umbraco.Core.Configuration
{
get
{
if (HttpContext != null)
return ConfigurationManager.AppSettings["umbracoDefaultUILanguage"];
return "";
return ConfigurationManager.AppSettings.ContainsKey("umbracoDefaultUILanguage")
? ConfigurationManager.AppSettings["umbracoDefaultUILanguage"]
: string.Empty;
}
}
@@ -482,9 +379,9 @@ namespace Umbraco.Core.Configuration
{
get
{
if (HttpContext != null)
return ConfigurationManager.AppSettings["umbracoProfileUrl"];
return "";
return ConfigurationManager.AppSettings.ContainsKey("umbracoProfileUrl")
? ConfigurationManager.AppSettings["umbracoProfileUrl"]
: string.Empty;
}
}
@@ -498,9 +395,14 @@ namespace Umbraco.Core.Configuration
{
get
{
if (HttpContext != null)
return bool.Parse(ConfigurationManager.AppSettings["umbracoHideTopLevelNodeFromPath"]);
return false;
try
{
return bool.Parse(ConfigurationManager.AppSettings["umbracoHideTopLevelNodeFromPath"]);
}
catch
{
return false;
}
}
}
@@ -617,74 +519,60 @@ namespace Umbraco.Core.Configuration
{
string license =
"<A href=\"http://umbraco.org/redir/license\" target=\"_blank\">the open source license MIT</A>. The umbraco UI is freeware licensed under the umbraco license.";
if (HttpContext != null)
{
var versionDoc = new XmlDocument();
var versionReader = new XmlTextReader(IOHelper.MapPath(SystemDirectories.Umbraco + "/version.xml"));
versionDoc.Load(versionReader);
versionReader.Close();
// check for license
try
{
string licenseUrl =
versionDoc.SelectSingleNode("/version/licensing/licenseUrl").FirstChild.Value;
string licenseValidation =
versionDoc.SelectSingleNode("/version/licensing/licenseValidation").FirstChild.Value;
string licensedTo =
versionDoc.SelectSingleNode("/version/licensing/licensedTo").FirstChild.Value;
var versionDoc = new XmlDocument();
var versionReader = new XmlTextReader(IOHelper.MapPath(SystemDirectories.Umbraco + "/version.xml"));
versionDoc.Load(versionReader);
versionReader.Close();
// check for license
try
{
string licenseUrl =
versionDoc.SelectSingleNode("/version/licensing/licenseUrl").FirstChild.Value;
string licenseValidation =
versionDoc.SelectSingleNode("/version/licensing/licenseValidation").FirstChild.Value;
string licensedTo =
versionDoc.SelectSingleNode("/version/licensing/licensedTo").FirstChild.Value;
if (licensedTo != "" && licenseUrl != "")
{
license = "umbraco Commercial License<br/><b>Registered to:</b><br/>" +
licensedTo.Replace("\n", "<br/>") + "<br/><b>For use with domain:</b><br/>" +
licenseUrl;
}
}
catch
{
}
if (licensedTo != "" && licenseUrl != "")
{
license = "umbraco Commercial License<br/><b>Registered to:</b><br/>" +
licensedTo.Replace("\n", "<br/>") + "<br/><b>For use with domain:</b><br/>" +
licenseUrl;
}
}
catch
{
}
}
return license;
}
}
/// <summary>
/// Determines whether the current request is reserved based on the route table and
/// whether the specified URL is reserved or is inside a reserved path.
/// </summary>
/// <param name="url"></param>
/// <param name="httpContext"></param>
/// <param name="routes">The route collection to lookup the request in</param>
/// <returns></returns>
public static bool IsReservedPathOrUrl(string url, HttpContextBase httpContext, RouteCollection routes)
{
if (httpContext == null) throw new ArgumentNullException("httpContext");
if (routes == null) throw new ArgumentNullException("routes");
/// <summary>
/// Developer method to test if configuration settings are loaded properly.
/// </summary>
/// <value><c>true</c> if succesfull; otherwise, <c>false</c>.</value>
internal static bool Test
{
get
{
if (HttpContext != null)
{
HttpContext.Response.Write("ContentXML :" + ContentXml + "\n");
HttpContext.Response.Write("DbDSN :" + DbDsn + "\n");
HttpContext.Response.Write("DebugMode :" + DebugMode + "\n");
HttpContext.Response.Write("DefaultUILanguage :" + DefaultUILanguage + "\n");
HttpContext.Response.Write("VersionCheckPeriod :" + VersionCheckPeriod + "\n");
HttpContext.Response.Write("DisableXsltExtensions :" + DisableXsltExtensions + "\n");
HttpContext.Response.Write("EditXhtmlMode :" + EditXhtmlMode + "\n");
HttpContext.Response.Write("HideTopLevelNodeFromPath :" + HideTopLevelNodeFromPath + "\n");
HttpContext.Response.Write("Path :" + Path + "\n");
HttpContext.Response.Write("ProfileUrl :" + ProfileUrl + "\n");
HttpContext.Response.Write("ReservedPaths :" + ReservedPaths + "\n");
HttpContext.Response.Write("ReservedUrls :" + ReservedUrls + "\n");
HttpContext.Response.Write("StorageDirectory :" + StorageDirectory + "\n");
HttpContext.Response.Write("TimeOutInMinutes :" + TimeOutInMinutes + "\n");
HttpContext.Response.Write("UrlForbittenCharacters :" + UrlForbittenCharacters + "\n");
HttpContext.Response.Write("UrlSpaceCharacter :" + UrlSpaceCharacter + "\n");
HttpContext.Response.Write("UseDirectoryUrls :" + UseDirectoryUrls + "\n");
return true;
}
return false;
}
}
//check if the current request matches a route, if so then it is reserved.
var route = routes.GetRouteData(httpContext);
if (route != null)
return true;
//continue with the standard ignore routine
return IsReservedPathOrUrl(url);
}
/// <summary>
/// <summary>
/// Determines whether the specified URL is reserved or is inside a reserved path.
/// </summary>
/// <param name="url">The URL to check.</param>
@@ -692,7 +580,7 @@ namespace Umbraco.Core.Configuration
/// <c>true</c> if the specified URL is reserved; otherwise, <c>false</c>.
/// </returns>
public static bool IsReservedPathOrUrl(string url)
{
{
// check if GlobalSettings.ReservedPaths and GlobalSettings.ReservedUrls are unchanged
if (!object.ReferenceEquals(_reservedPathsCache, GlobalSettings.ReservedPaths)
|| !object.ReferenceEquals(_reservedUrlsCache, GlobalSettings.ReservedUrls))
@@ -727,14 +615,17 @@ namespace Umbraco.Core.Configuration
_reservedList = _newReservedList;
}
string res = "";
foreach (string st in _reservedList._list.Keys)
res += st + ",";
Debug.Write("reserverd urls: '" + res + "'");
//The url should be cleaned up before checking:
// * If it doesn't contain an '.' in the path then we assume it is a path based URL, if that is the case we should add an trailing '/' because all of our reservedPaths use a trailing '/'
// * We shouldn't be comparing the query at all
var pathPart = url.Split('?')[0];
if (!pathPart.Contains(".") && !pathPart.EndsWith("/"))
{
pathPart += "/";
}
// return true if url starts with an element of the reserved list
return _reservedList.StartsWith(url.ToLower());
return _reservedList.StartsWith(pathPart.ToLowerInvariant());
}
/// <summary>
@@ -809,14 +700,11 @@ namespace Umbraco.Core.Configuration
if (part == null || whole == null || part.Length >= whole.Length)
return _stringComparer.Compare(part, whole);
// Reverted changeset 4d5a20d6124d because it will match with
// anything starting with install and umbraco see issue U4-741
////trim the end '/' of each
//part = part.TrimEnd('/');
//whole = whole.TrimEnd('/');
//if (part.Length >= whole.Length)
// return _stringComparer.Compare(part, whole);
////ensure both have a / on the end
//part = part.EndsWith("/") ? part : part + "/";
//whole = whole.EndsWith("/") ? whole : whole + "/";
//if (part.Length >= whole.Length)
// return _stringComparer.Compare(part, whole);
// loop through all characters that part and whole have in common
int pos = 0;
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Umbraco.Core
namespace Umbraco.Core.Configuration
{
//NOTE: I'm not sure what this does or what it is used for, have emailed Gareth about it as the name really means nothing to me
// and don't know where this class actually belongs.
//NOTE: This is used in the old DynamicNode for performing value conversions/mappings for certain data types.
// it has been obsoleted because we've replaced this with the PropertyEditorValueConvertersResolver which can
// have converters registered in code so we don't have to rely on even more config sections.
// These things probably won't need to be created all that often and in code is much easier to do.
internal class RazorDataTypeModelStaticMappingItem
{
File diff suppressed because it is too large Load Diff
+119
View File
@@ -0,0 +1,119 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Umbraco.Core.Logging;
using Umbraco.Core.ObjectResolution;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Core
{
/// <summary>
/// A bootstrapper for the Umbraco application which initializes all objects for the Core of the application
/// </summary>
/// <remarks>
/// This does not provide any startup functionality relating to web objects
/// </remarks>
internal class CoreBootManager : IBootManager
{
private DisposableTimer _timer;
private bool _isInitialized = false;
private bool _isStarted = false;
private bool _isComplete = false;
protected ApplicationContext ApplicationContext { get; private set; }
public virtual IBootManager Initialize()
{
if (_isInitialized)
throw new InvalidOperationException("The boot manager has already been initialized");
LogHelper.Info<CoreBootManager>("Umbraco application starting");
_timer = DisposableTimer.Start(x => LogHelper.Info<CoreBootManager>("Umbraco application startup complete" + " (took " + x + "ms)"));
//create the ApplicationContext
ApplicationContext = ApplicationContext.Current = new ApplicationContext();
InitializeResolvers();
_isInitialized = true;
return this;
}
/// <summary>
/// Fires after initialization and calls the callback to allow for customizations to occur
/// </summary>
/// <param name="afterStartup"></param>
/// <returns></returns>
public virtual IBootManager Startup(Action<ApplicationContext> afterStartup)
{
if (_isStarted)
throw new InvalidOperationException("The boot manager has already been initialized");
if (afterStartup != null)
{
afterStartup(ApplicationContext.Current);
}
_isStarted = true;
return this;
}
/// <summary>
/// Fires after startup and calls the callback once customizations are locked
/// </summary>
/// <param name="afterComplete"></param>
/// <returns></returns>
public virtual IBootManager Complete(Action<ApplicationContext> afterComplete)
{
if (_isComplete)
throw new InvalidOperationException("The boot manager has already been completed");
//freeze resolution to not allow Resolvers to be modified
Resolution.Freeze();
//stop the timer and log the output
_timer.Dispose();
if (afterComplete != null)
{
afterComplete(ApplicationContext.Current);
}
_isComplete = true;
return this;
}
/// <summary>
/// Create the resolvers
/// </summary>
protected virtual void InitializeResolvers()
{
CacheRefreshersResolver.Current = new CacheRefreshersResolver(
PluginManager.Current.ResolveCacheRefreshers());
DataTypesResolver.Current = new DataTypesResolver(
PluginManager.Current.ResolveDataTypes());
MacroFieldEditorsResolver.Current = new MacroFieldEditorsResolver(
PluginManager.Current.ResolveMacroRenderings());
PackageActionsResolver.Current = new PackageActionsResolver(
PluginManager.Current.ResolvePackageActions());
ActionsResolver.Current = new ActionsResolver(
PluginManager.Current.ResolveActions());
PropertyEditorValueConvertersResolver.Current = new PropertyEditorValueConvertersResolver(
PluginManager.Current.ResolvePropertyEditorValueConverters());
//add the internal ones, these are not public currently so need to add them manually
PropertyEditorValueConvertersResolver.Current.AddType<DatePickerPropertyEditorValueConverter>();
PropertyEditorValueConvertersResolver.Current.AddType<TinyMcePropertyEditorValueConverter>();
PropertyEditorValueConvertersResolver.Current.AddType<YesNoPropertyEditorValueConverter>();
}
}
}
@@ -0,0 +1,32 @@
using System;
using System.ComponentModel;
namespace Umbraco.Core
{
/// <summary>
/// Allows for converting string representations of 0 and 1 to boolean
/// </summary>
internal class CustomBooleanTypeConverter : BooleanConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
if (sourceType == typeof(string))
{
return true;
}
return base.CanConvertFrom(context, sourceType);
}
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
if (value is string)
{
var str = (string)value;
if (str == "1") return true;
if (str == "0" || str == "") return false;
}
return base.ConvertFrom(context, culture, value);
}
}
}
+120
View File
@@ -0,0 +1,120 @@
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading;
using umbraco.interfaces;
namespace Umbraco.Core
{
/// <summary>
/// Static and extension methods for the DataTable object
/// </summary>
internal static class DataTableExtensions
{
/// <summary>
/// Creates a DataTable with the specified alias and columns and uses a callback to populate the headers.
/// </summary>
/// <param name="tableAlias"></param>
/// <param name="getHeaders"></param>
/// <param name="rowData"> </param>
/// <returns></returns>
/// <remarks>
/// This has been migrated from the Node class and uses proper locking now. It is now used by the Node class and the
/// DynamicPublishedContent extensions for legacy reasons.
/// </remarks>
public static DataTable GenerateDataTable(
string tableAlias,
Func<string, IEnumerable<KeyValuePair<string, string>>> getHeaders,
Func<IEnumerable<Tuple<IEnumerable<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>>>> rowData)
{
var dt = new DataTable(tableAlias);
//get all row data
var tableData = rowData().ToArray();
//get all headers
var propertyHeaders = GetPropertyHeaders(tableAlias, getHeaders);
foreach(var h in propertyHeaders)
{
dt.Columns.Add(new DataColumn(h.Value));
}
//add row data
foreach(var r in tableData)
{
dt.PopulateRow(
propertyHeaders,
r.Item1,
r.Item2);
}
return dt;
}
/// <summary>
/// Helper method to return this ugly object
/// </summary>
/// <returns></returns>
/// <remarks>
/// This is for legacy code, I didn't want to go creating custom classes for these
/// </remarks>
internal static List<System.Tuple<IEnumerable<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>>> CreateTableData()
{
return new List<System.Tuple<IEnumerable<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>>>();
}
/// <summary>
/// Helper method to deal with these ugly objects
/// </summary>
/// <param name="rowData"></param>
/// <param name="standardVals"></param>
/// <param name="userVals"></param>
/// <remarks>
/// This is for legacy code, I didn't want to go creating custom classes for these
/// </remarks>
internal static void AddRowData(
List<System.Tuple<IEnumerable<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>>> rowData,
IEnumerable<KeyValuePair<string, object>> standardVals,
IEnumerable<KeyValuePair<string, object>> userVals)
{
rowData.Add(new System.Tuple<IEnumerable<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>>(
standardVals,
userVals
));
}
private static IDictionary<string, string> GetPropertyHeaders(string alias, Func<string, IEnumerable<KeyValuePair<string, string>>> getHeaders)
{
var headers = getHeaders(alias);
var def = headers.ToDictionary(pt => pt.Key, pt => pt.Value);
return def;
}
private static void PopulateRow(
this DataTable dt,
IDictionary<string, string> aliasesToNames,
IEnumerable<KeyValuePair<string, object>> standardVals,
IEnumerable<KeyValuePair<string, object>> userPropertyVals)
{
var dr = dt.NewRow();
foreach (var r in standardVals)
{
dr[r.Key] = r.Value;
}
foreach (var p in userPropertyVals.Where(p => p.Value != null))
{
dr[aliasesToNames[p.Key]] = p.Value;
}
dt.Rows.Add(dr);
}
}
}
+42
View File
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using Umbraco.Core.ObjectResolution;
using umbraco.interfaces;
namespace Umbraco.Core
{
/// <summary>
/// A resolver to return all IDataType objects
/// </summary>
internal sealed class DataTypesResolver : LegacyTransientObjectsResolver<DataTypesResolver, IDataType>
{
/// <summary>
/// Constructor
/// </summary>
/// <param name="dataTypes"></param>
internal DataTypesResolver(IEnumerable<Type> dataTypes)
: base(dataTypes)
{
}
/// <summary>
/// Gets the <see cref="ICacheRefresher"/> implementations.
/// </summary>
public IEnumerable<IDataType> DataTypes
{
get
{
EnsureIdsAreTracked();
return Values;
}
}
protected override Guid GetUniqueIdentifier(IDataType obj)
{
return obj.Id;
}
}
}
@@ -0,0 +1,32 @@
using Umbraco.Core.ObjectResolution;
namespace Umbraco.Core.Dictionary
{
/// <summary>
/// Resolves the current CultureDictionaryFactory
/// </summary>
internal class CultureDictionaryFactoryResolver : SingleObjectResolverBase<CultureDictionaryFactoryResolver, ICultureDictionaryFactory>
{
internal CultureDictionaryFactoryResolver(ICultureDictionaryFactory factory)
: base(factory)
{
}
/// <summary>
/// Can be used by developers at runtime to set their ICultureDictionaryFactory at app startup
/// </summary>
/// <param name="factory"></param>
public void SetContentStore(ICultureDictionaryFactory factory)
{
Value = factory;
}
/// <summary>
/// Returns the ICultureDictionaryFactory
/// </summary>
public ICultureDictionaryFactory Factory
{
get { return Value; }
}
}
}
@@ -0,0 +1,23 @@
using System;
using System.Globalization;
namespace Umbraco.Core.Dictionary
{
/// <summary>
/// Represents a dictionary based on a specific culture
/// </summary>
internal interface ICultureDictionary
{
/// <summary>
/// Returns the dictionary value based on the key supplied
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
string this[string key] { get; }
/// <summary>
/// Returns the current culture
/// </summary>
CultureInfo Culture { get; }
}
}
@@ -0,0 +1,7 @@
namespace Umbraco.Core.Dictionary
{
internal interface ICultureDictionaryFactory
{
ICultureDictionary CreateDictionary();
}
}
+191
View File
@@ -0,0 +1,191 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Web.Mvc;
namespace Umbraco.Core
{
///<summary>
/// Extension methods for dictionary
///</summary>
internal static class DictionaryExtensions
{
/// <summary>
/// Converts a dictionary to another type by only using direct casting
/// </summary>
/// <typeparam name="TKeyOut"></typeparam>
/// <typeparam name="TValOut"></typeparam>
/// <param name="d"></param>
/// <returns></returns>
public static IDictionary<TKeyOut, TValOut> ConvertTo<TKeyOut, TValOut>(this IDictionary d)
{
var result = new Dictionary<TKeyOut, TValOut>();
foreach (DictionaryEntry v in d)
{
result.Add((TKeyOut)v.Key, (TValOut)v.Value);
}
return result;
}
/// <summary>
/// Converts a dictionary to another type using the specified converters
/// </summary>
/// <typeparam name="TKeyOut"></typeparam>
/// <typeparam name="TValOut"></typeparam>
/// <param name="d"></param>
/// <param name="keyConverter"></param>
/// <param name="valConverter"></param>
/// <returns></returns>
public static IDictionary<TKeyOut, TValOut> ConvertTo<TKeyOut, TValOut>(this IDictionary d, Func<object, TKeyOut> keyConverter, Func<object, TValOut> valConverter)
{
var result = new Dictionary<TKeyOut, TValOut>();
foreach (DictionaryEntry v in d)
{
result.Add(keyConverter(v.Key), valConverter(v.Value));
}
return result;
}
/// <summary>
/// Converts a dictionary to a NameValueCollection
/// </summary>
/// <param name="d"></param>
/// <returns></returns>
public static NameValueCollection ToNameValueCollection(this IDictionary<string, string> d)
{
var n = new NameValueCollection();
foreach (var i in d)
{
n.Add(i.Key, i.Value);
}
return n;
}
/// <summary>
/// Converts a dictionary to a FormCollection
/// </summary>
/// <param name="d"></param>
/// <returns></returns>
public static FormCollection ToFormCollection(this IDictionary<string, object> d)
{
var n = new FormCollection();
foreach (var i in d)
{
n.Add(i.Key, Convert.ToString(i.Value));
}
return n;
}
/// <summary>
/// Returns a new dictionary of this ... others merged leftward.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <typeparam name="TK"></typeparam>
/// <typeparam name="TV"></typeparam>
/// <param name="me"></param>
/// <param name="others"></param>
/// <returns></returns>
/// <remarks>
/// Reference: http://stackoverflow.com/questions/294138/merging-dictionaries-in-c
/// </remarks>
public static T MergeLeft<T, TK, TV>(this T me, params IDictionary<TK, TV>[] others)
where T : IDictionary<TK, TV>, new()
{
var newMap = new T();
foreach (var p in (new List<IDictionary<TK, TV>> { me }).Concat(others).SelectMany(src => src))
{
newMap[p.Key] = p.Value;
}
return newMap;
}
/// <summary>
/// Returns the value of the key value based on the key, if the key is not found, a null value is returned
/// </summary>
/// <typeparam name="TKey">The type of the key.</typeparam>
/// <typeparam name="TVal">The type of the val.</typeparam>
/// <param name="d">The d.</param>
/// <param name="key">The key.</param>
/// <param name="defaultValue">The default value.</param>
/// <returns></returns>
public static TVal GetValue<TKey, TVal>(this IDictionary<TKey, TVal> d, TKey key, TVal defaultValue = default(TVal))
{
if (d.ContainsKey(key))
{
return d[key];
}
return defaultValue;
}
/// <summary>
/// Returns the value of the key value based on the key as it's string value, if the key is not found, then an empty string is returned
/// </summary>
/// <param name="d"></param>
/// <param name="key"></param>
/// <returns></returns>
public static string GetValueAsString<TKey, TVal>(this IDictionary<TKey, TVal> d, TKey key)
{
if (d.ContainsKey(key))
{
return d[key].ToString();
}
return String.Empty;
}
/// <summary>contains key ignore case.</summary>
/// <param name="dictionary">The dictionary.</param>
/// <param name="key">The key.</param>
/// <typeparam name="TValue">Value Type</typeparam>
/// <returns>The contains key ignore case.</returns>
public static bool ContainsKeyIgnoreCase<TValue>(this IDictionary<string, TValue> dictionary, string key)
{
return dictionary.Keys.Any(i => i.Equals(key, StringComparison.CurrentCultureIgnoreCase));
}
/// <summary>
/// Converts a dictionary object to a query string representation such as:
/// firstname=shannon&lastname=deminick
/// </summary>
/// <param name="d"></param>
/// <returns></returns>
public static string ToQueryString(this IDictionary<string, object> d)
{
if (!d.Any()) return "";
var builder = new StringBuilder();
foreach (var i in d)
{
builder.Append(String.Format("{0}={1}&", i.Key, i.Value));
}
return builder.ToString().TrimEnd('&');
}
/// <summary>The get entry ignore case.</summary>
/// <param name="dictionary">The dictionary.</param>
/// <param name="key">The key.</param>
/// <typeparam name="TValue">The type</typeparam>
/// <returns>The entry</returns>
public static TValue GetEntryIgnoreCase<TValue>(this IDictionary<string, TValue> dictionary, string key)
{
return dictionary.GetEntryIgnoreCase(key, default(TValue));
}
/// <summary>The get entry ignore case.</summary>
/// <param name="dictionary">The dictionary.</param>
/// <param name="key">The key.</param>
/// <param name="defaultValue">The default value.</param>
/// <typeparam name="TValue">The type</typeparam>
/// <returns>The entry</returns>
public static TValue GetEntryIgnoreCase<TValue>(this IDictionary<string, TValue> dictionary, string key, TValue defaultValue)
{
key = dictionary.Keys.Where(i => i.Equals(key, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault();
return !key.IsNullOrWhiteSpace()
? dictionary[key]
: defaultValue;
}
}
}
+72
View File
@@ -0,0 +1,72 @@
using System;
using System.Threading;
namespace Umbraco.Core
{
/// <summary>
/// Abstract implementation of logic commonly required to safely handle disposable unmanaged resources.
/// </summary>
public abstract class DisposableObject : IDisposable
{
private bool _disposed;
private readonly ReaderWriterLockSlim _disposalLocker = new ReaderWriterLockSlim();
/// <summary>
/// Gets a value indicating whether this instance is disposed.
/// </summary>
/// <value>
/// <c>true</c> if this instance is disposed; otherwise, <c>false</c>.
/// </value>
public bool IsDisposed
{
get { return _disposed; }
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
/// <filterpriority>2</filterpriority>
public void Dispose()
{
Dispose(true);
// Use SupressFinalize in case a subclass of this type implements a finalizer.
GC.SuppressFinalize(this);
}
~DisposableObject()
{
// Run dispose but let the class know it was due to the finalizer running.
Dispose(false);
}
protected virtual void Dispose(bool disposing)
{
// Only operate if we haven't already disposed
if (IsDisposed || !disposing) return;
using (new WriteLock(_disposalLocker))
{
// Check again now we're inside the lock
if (IsDisposed) return;
// Call to actually release resources. This method is only
// kept separate so that the entire disposal logic can be used as a VS snippet
DisposeResources();
// Indicate that the instance has been disposed.
_disposed = true;
}
}
/// <summary>
/// Handles the disposal of resources. Derived from abstract class <see cref="DisposableObject"/> which handles common required locking logic.
/// </summary>
protected abstract void DisposeResources();
protected virtual void DisposeUnmanagedResources()
{
}
}
}
+138
View File
@@ -0,0 +1,138 @@
using System;
using System.Diagnostics;
using Umbraco.Core.Logging;
namespace Umbraco.Core
{
/// <summary>
/// Starts the timer and invokes a callback upon disposal. Provides a simple way of timing an operation by wrapping it in a <code>using</code> (C#) statement.
/// </summary>
/// <example>
/// <code>
/// Console.WriteLine("Testing Stopwatchdisposable, should be 567:");
// using (var timer = new DisposableTimer(result => Console.WriteLine("Took {0}ms", result)))
// {
// Thread.Sleep(567);
// }
/// </code>
/// </example>
public class DisposableTimer : DisposableObject
{
private readonly Stopwatch _stopwatch = Stopwatch.StartNew();
private readonly Action<long> _callback;
protected DisposableTimer(Action<long> callback)
{
_callback = callback;
}
public Stopwatch Stopwatch
{
get { return _stopwatch; }
}
/// <summary>
/// Starts the timer and invokes the specified callback upon disposal.
/// </summary>
/// <param name="callback">The callback.</param>
/// <returns></returns>
public static DisposableTimer Start(Action<long> callback)
{
return new DisposableTimer(callback);
}
public static DisposableTimer TraceDuration<T>(Func<string> startMessage, Func<string> completeMessage)
{
return TraceDuration(typeof(T), startMessage, completeMessage);
}
public static DisposableTimer TraceDuration(Type loggerType, Func<string> startMessage, Func<string> completeMessage)
{
LogHelper.Debug(loggerType, startMessage);
return new DisposableTimer(x => LogHelper.Info(loggerType, () => completeMessage() + " (took " + x + "ms)"));
}
/// <summary>
/// Adds a start and end log entry as Info and tracks how long it takes until disposed.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
public static DisposableTimer TraceDuration<T>(string startMessage, string completeMessage)
{
return TraceDuration(typeof(T), startMessage, completeMessage);
}
/// <summary>
/// Adds a start and end log entry as Info and tracks how long it takes until disposed.
/// </summary>
/// <param name="loggerType"></param>
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
public static DisposableTimer TraceDuration(Type loggerType, string startMessage, string completeMessage)
{
LogHelper.Info(loggerType, () => startMessage);
return new DisposableTimer(x => LogHelper.Info(loggerType, () => completeMessage + " (took " + x + "ms)"));
}
/// <summary>
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
public static DisposableTimer DebugDuration<T>(string startMessage, string completeMessage)
{
return DebugDuration(typeof(T), startMessage, completeMessage);
}
/// <summary>
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
public static DisposableTimer DebugDuration<T>(Func<string> startMessage, Func<string> completeMessage)
{
return DebugDuration(typeof(T), startMessage, completeMessage);
}
/// <summary>
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
/// </summary>
/// <param name="loggerType"></param>
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
public static DisposableTimer DebugDuration(Type loggerType, string startMessage, string completeMessage)
{
LogHelper.Debug(loggerType, () => startMessage);
return new DisposableTimer(x => LogHelper.Debug(loggerType, () => completeMessage + " (took " + x + "ms)"));
}
/// <summary>
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
/// </summary>
/// <param name="loggerType"></param>
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
public static DisposableTimer DebugDuration(Type loggerType, Func<string> startMessage, Func<string> completeMessage)
{
LogHelper.Debug(loggerType, startMessage);
return new DisposableTimer(x => LogHelper.Debug(loggerType, () => completeMessage() + " (took " + x + "ms)"));
}
/// <summary>
/// Handles the disposal of resources. Derived from abstract class <see cref="DisposableObject"/> which handles common required locking logic.
/// </summary>
protected override void DisposeResources()
{
_callback.Invoke(Stopwatch.ElapsedMilliseconds);
}
}
}
-178
View File
@@ -1,178 +0,0 @@
using System;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
using System.Threading;
namespace Umbraco.Core
{
internal class DynamicWrapper
{
public class DynamicWrapperBase
{
internal protected object RealObject;
}
private static readonly ModuleBuilder _moduleBuilder;
static DynamicWrapper()
{
var name = Assembly.GetExecutingAssembly().GetName();
var assembly = Thread.GetDomain().DefineDynamicAssembly(name, AssemblyBuilderAccess.Run);
_moduleBuilder = assembly.DefineDynamicModule("DynamicWrapperModule", false);
}
private static readonly WrapperDictionary _wrapperDictionary = new WrapperDictionary();
public static Type GetWrapper(Type interfaceType, Type realObjectType)
{
Type wrapperType = _wrapperDictionary.GetType(interfaceType, realObjectType);
if (wrapperType == null)
{
wrapperType = GenerateWrapperType(interfaceType, realObjectType);
_wrapperDictionary.SetType(interfaceType, realObjectType, wrapperType);
}
return wrapperType;
}
private static Type GenerateWrapperType(Type InterfaceType, Type RealObjectType)
{
var wrapperName = string.Format("{0}_{1}_Wrapper", InterfaceType.Name, RealObjectType.Name);
TypeBuilder wrapperBuilder = _moduleBuilder.DefineType(
wrapperName,
TypeAttributes.NotPublic | TypeAttributes.Sealed,
typeof(DynamicWrapperBase),
new[] { InterfaceType });
var wrapperMethod = new WrapperMethodBuilder(RealObjectType, wrapperBuilder);
foreach (MethodInfo method in InterfaceType.AllMethods())
{
wrapperMethod.Generate(method);
}
return wrapperBuilder.CreateType();
}
public static T CreateWrapper<T>(object realObject) where T : class
{
var dynamicType = GetWrapper(typeof(T), realObject.GetType());
var dynamicWrapper = (DynamicWrapperBase)Activator.CreateInstance(dynamicType);
dynamicWrapper.RealObject = realObject;
return dynamicWrapper as T;
}
}
internal class WrapperMethodBuilder
{
private readonly Type _realObjectType;
private readonly TypeBuilder _wrapperBuilder;
public WrapperMethodBuilder(Type realObjectType, TypeBuilder proxyBuilder)
{
_realObjectType = realObjectType;
_wrapperBuilder = proxyBuilder;
}
public void Generate(MethodInfo newMethod)
{
if (newMethod.IsGenericMethod)
newMethod = newMethod.GetGenericMethodDefinition();
FieldInfo srcField = typeof(DynamicWrapper.DynamicWrapperBase).GetField("RealObject", BindingFlags.Instance | BindingFlags.NonPublic);
var parameters = newMethod.GetParameters();
var parameterTypes = parameters.Select(parameter => parameter.ParameterType).ToArray();
var methodBuilder = _wrapperBuilder.DefineMethod(
newMethod.Name,
MethodAttributes.Public | MethodAttributes.Virtual,
newMethod.ReturnType,
parameterTypes);
if (newMethod.IsGenericMethod)
{
methodBuilder.DefineGenericParameters(
newMethod.GetGenericArguments().Select(arg => arg.Name).ToArray());
}
ILGenerator ilGenerator = methodBuilder.GetILGenerator();
LoadRealObject(ilGenerator, srcField);
PushParameters(parameters, ilGenerator);
ExecuteMethod(newMethod, parameterTypes, ilGenerator);
Return(ilGenerator);
}
private static void Return(ILGenerator ilGenerator)
{
ilGenerator.Emit(OpCodes.Ret);
}
private void ExecuteMethod(MethodBase newMethod, Type[] parameterTypes, ILGenerator ilGenerator)
{
MethodInfo srcMethod = GetMethod(newMethod, parameterTypes);
if (srcMethod == null) throw new MissingMethodException("Unable to find method " + newMethod.Name + " in " + _realObjectType.FullName);
ilGenerator.Emit(OpCodes.Call, srcMethod);
}
private MethodInfo GetMethod(MethodBase realMethod, Type[] parameterTypes)
{
if (realMethod.IsGenericMethod)
return _realObjectType.GetGenericMethod(realMethod.Name, parameterTypes);
return _realObjectType.GetMethod(realMethod.Name, parameterTypes);
}
private static void PushParameters(ICollection<ParameterInfo> parameters, ILGenerator ilGenerator)
{
for (int i = 1; i < parameters.Count + 1; i++)
ilGenerator.Emit(OpCodes.Ldarg, i);
}
private static void LoadRealObject(ILGenerator ilGenerator, FieldInfo srcField)
{
ilGenerator.Emit(OpCodes.Ldarg_0);
ilGenerator.Emit(OpCodes.Ldfld, srcField);
}
}
internal class WrapperDictionary
{
private readonly Dictionary<string, Type> _wrapperTypes = new Dictionary<string, Type>();
private static string GenerateKey(Type interfaceType, Type realObjectType)
{
return interfaceType.Name + "->" + realObjectType.Name;
}
public Type GetType(Type interfaceType, Type realObjectType)
{
string key = GenerateKey(interfaceType, realObjectType);
if (_wrapperTypes.ContainsKey(key))
return _wrapperTypes[key];
return null;
}
public void SetType(Type interfaceType, Type realObjectType, Type wrapperType)
{
string key = GenerateKey(interfaceType, realObjectType);
if (_wrapperTypes.ContainsKey(key))
_wrapperTypes[key] = wrapperType;
else
_wrapperTypes.Add(key, wrapperType);
}
}
}
+182
View File
@@ -0,0 +1,182 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
using System.Threading;
namespace Umbraco.Core.Dynamics
{
internal class ClassFactory
{
public static readonly ClassFactory Instance = new ClassFactory();
static ClassFactory() { } // Trigger lazy initialization of static fields
ModuleBuilder module;
Dictionary<Signature, Type> classes;
int classCount;
ReaderWriterLock rwLock;
protected ClassFactory()
{
AssemblyName name = new AssemblyName("DynamicClasses");
AssemblyBuilder assembly = AppDomain.CurrentDomain.DefineDynamicAssembly(name, AssemblyBuilderAccess.Run);
#if ENABLE_LINQ_PARTIAL_TRUST
new ReflectionPermission(PermissionState.Unrestricted).Assert();
#endif
try
{
module = assembly.DefineDynamicModule("Module");
}
finally
{
#if ENABLE_LINQ_PARTIAL_TRUST
PermissionSet.RevertAssert();
#endif
}
classes = new Dictionary<Signature, Type>();
rwLock = new ReaderWriterLock();
}
public Type GetDynamicClass(IEnumerable<DynamicProperty> properties)
{
rwLock.AcquireReaderLock(Timeout.Infinite);
try
{
Signature signature = new Signature(properties);
Type type;
if (!classes.TryGetValue(signature, out type))
{
type = CreateDynamicClass(signature.Properties);
classes.Add(signature, type);
}
return type;
}
finally
{
rwLock.ReleaseReaderLock();
}
}
Type CreateDynamicClass(DynamicProperty[] properties)
{
LockCookie cookie = rwLock.UpgradeToWriterLock(Timeout.Infinite);
try
{
string typeName = "DynamicClass" + (classCount + 1);
#if ENABLE_LINQ_PARTIAL_TRUST
new ReflectionPermission(PermissionState.Unrestricted).Assert();
#endif
try
{
TypeBuilder tb = this.module.DefineType(typeName, TypeAttributes.Class |
TypeAttributes.Public, typeof(DynamicClass));
FieldInfo[] fields = GenerateProperties(tb, properties);
GenerateEquals(tb, fields);
GenerateGetHashCode(tb, fields);
Type result = tb.CreateType();
classCount++;
return result;
}
finally
{
#if ENABLE_LINQ_PARTIAL_TRUST
PermissionSet.RevertAssert();
#endif
}
}
finally
{
rwLock.DowngradeFromWriterLock(ref cookie);
}
}
FieldInfo[] GenerateProperties(TypeBuilder tb, DynamicProperty[] properties)
{
FieldInfo[] fields = new FieldBuilder[properties.Length];
for (int i = 0; i < properties.Length; i++)
{
DynamicProperty dp = properties[i];
FieldBuilder fb = tb.DefineField("_" + dp.Name, dp.Type, FieldAttributes.Private);
PropertyBuilder pb = tb.DefineProperty(dp.Name, PropertyAttributes.HasDefault, dp.Type, null);
MethodBuilder mbGet = tb.DefineMethod("get_" + dp.Name,
MethodAttributes.Public | MethodAttributes.SpecialName | MethodAttributes.HideBySig,
dp.Type, Type.EmptyTypes);
ILGenerator genGet = mbGet.GetILGenerator();
genGet.Emit(OpCodes.Ldarg_0);
genGet.Emit(OpCodes.Ldfld, fb);
genGet.Emit(OpCodes.Ret);
MethodBuilder mbSet = tb.DefineMethod("set_" + dp.Name,
MethodAttributes.Public | MethodAttributes.SpecialName | MethodAttributes.HideBySig,
null, new Type[] { dp.Type });
ILGenerator genSet = mbSet.GetILGenerator();
genSet.Emit(OpCodes.Ldarg_0);
genSet.Emit(OpCodes.Ldarg_1);
genSet.Emit(OpCodes.Stfld, fb);
genSet.Emit(OpCodes.Ret);
pb.SetGetMethod(mbGet);
pb.SetSetMethod(mbSet);
fields[i] = fb;
}
return fields;
}
void GenerateEquals(TypeBuilder tb, FieldInfo[] fields)
{
MethodBuilder mb = tb.DefineMethod("Equals",
MethodAttributes.Public | MethodAttributes.ReuseSlot |
MethodAttributes.Virtual | MethodAttributes.HideBySig,
typeof(bool), new Type[] { typeof(object) });
ILGenerator gen = mb.GetILGenerator();
LocalBuilder other = gen.DeclareLocal(tb);
Label next = gen.DefineLabel();
gen.Emit(OpCodes.Ldarg_1);
gen.Emit(OpCodes.Isinst, tb);
gen.Emit(OpCodes.Stloc, other);
gen.Emit(OpCodes.Ldloc, other);
gen.Emit(OpCodes.Brtrue_S, next);
gen.Emit(OpCodes.Ldc_I4_0);
gen.Emit(OpCodes.Ret);
gen.MarkLabel(next);
foreach (FieldInfo field in fields)
{
Type ft = field.FieldType;
Type ct = typeof(EqualityComparer<>).MakeGenericType(ft);
next = gen.DefineLabel();
gen.EmitCall(OpCodes.Call, ct.GetMethod("get_Default"), null);
gen.Emit(OpCodes.Ldarg_0);
gen.Emit(OpCodes.Ldfld, field);
gen.Emit(OpCodes.Ldloc, other);
gen.Emit(OpCodes.Ldfld, field);
gen.EmitCall(OpCodes.Callvirt, ct.GetMethod("Equals", new Type[] { ft, ft }), null);
gen.Emit(OpCodes.Brtrue_S, next);
gen.Emit(OpCodes.Ldc_I4_0);
gen.Emit(OpCodes.Ret);
gen.MarkLabel(next);
}
gen.Emit(OpCodes.Ldc_I4_1);
gen.Emit(OpCodes.Ret);
}
void GenerateGetHashCode(TypeBuilder tb, FieldInfo[] fields)
{
MethodBuilder mb = tb.DefineMethod("GetHashCode",
MethodAttributes.Public | MethodAttributes.ReuseSlot |
MethodAttributes.Virtual | MethodAttributes.HideBySig,
typeof(int), Type.EmptyTypes);
ILGenerator gen = mb.GetILGenerator();
gen.Emit(OpCodes.Ldc_I4_0);
foreach (FieldInfo field in fields)
{
Type ft = field.FieldType;
Type ct = typeof(EqualityComparer<>).MakeGenericType(ft);
gen.EmitCall(OpCodes.Call, ct.GetMethod("get_Default"), null);
gen.Emit(OpCodes.Ldarg_0);
gen.Emit(OpCodes.Ldfld, field);
gen.EmitCall(OpCodes.Callvirt, ct.GetMethod("GetHashCode", new Type[] { ft }), null);
gen.Emit(OpCodes.Xor);
}
gen.Emit(OpCodes.Ret);
}
}
}
+24
View File
@@ -0,0 +1,24 @@
using System.Reflection;
using System.Text;
namespace Umbraco.Core.Dynamics
{
public abstract class DynamicClass
{
public override string ToString()
{
PropertyInfo[] props = this.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public);
StringBuilder sb = new StringBuilder();
sb.Append("{");
for (int i = 0; i < props.Length; i++)
{
if (i > 0) sb.Append(", ");
sb.Append(props[i].Name);
sb.Append("=");
sb.Append(props[i].GetValue(this, null));
}
sb.Append("}");
return sb.ToString();
}
}
}
@@ -0,0 +1,39 @@
using System.Collections.Generic;
using System.Dynamic;
namespace Umbraco.Core.Dynamics
{
public class DynamicDictionary : DynamicObject
{
internal readonly Dictionary<string, object> SourceItems;
public DynamicDictionary(Dictionary<string, object> sourceItems)
{
SourceItems = sourceItems;
}
public override bool TrySetMember(SetMemberBinder binder, object value)
{
if (SourceItems.ContainsKey(binder.Name))
{
SourceItems[binder.Name.ToLower()] = value;
}
else
{
SourceItems.Add(binder.Name.ToLower(), value);
}
return true;
}
public override bool TryGetMember(GetMemberBinder binder, out object result)
{
if (SourceItems != null)
{
if (SourceItems.TryGetValue(binder.Name.ToLower(), out result))
{
return true;
}
}
result = null;
return true;
}
}
}
@@ -0,0 +1,178 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Reflection;
using System.Text;
using Umbraco.Core.Logging;
namespace Umbraco.Core.Dynamics
{
/// <summary>
/// A helper class to try invoke members, find properties, etc...
/// </summary>
internal class DynamicInstanceHelper
{
internal class TryInvokeMemberResult
{
public object ObjectResult { get; private set; }
public TryInvokeMemberSuccessReason Reason { get; private set; }
public TryInvokeMemberResult(object result, TryInvokeMemberSuccessReason reason)
{
ObjectResult = result;
Reason = reason;
}
}
internal enum TryInvokeMemberSuccessReason
{
FoundProperty,
FoundMethod,
FoundExtensionMethod
}
/// <summary>
/// Attempts to invoke a member based on the dynamic instance
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="thisObject">The object instance to invoke the extension method for</param>
/// <param name="binder"></param>
/// <param name="args"></param>
/// <returns></returns>
/// <remarks>
/// First tries to find a property with the binder name, if that fails it will try to find a static or instance method
/// on the object that matches the binder name
/// </remarks>
public static Attempt<TryInvokeMemberResult> TryInvokeMember<T>(T thisObject, InvokeMemberBinder binder, object[] args)
{
return TryInvokeMember<T>(thisObject, binder, args, null);
}
/// <summary>
/// Attempts to invoke a member based on the dynamic instance
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="thisObject">The object instance to invoke the extension method for</param>
/// <param name="binder"></param>
/// <param name="args"></param>
/// <param name="findExtensionMethodsOnTypes">The types to scan for extension methods </param>
/// <returns></returns>
/// <remarks>
/// First tries to find a property with the binder name, if that fails it will try to find a static or instance method
/// on the object that matches the binder name, if that fails it will then attempt to invoke an extension method
/// based on the binder name and the extension method types to scan.
/// </remarks>
public static Attempt<TryInvokeMemberResult> TryInvokeMember<T>(T thisObject,
InvokeMemberBinder binder,
object[] args,
IEnumerable<Type> findExtensionMethodsOnTypes)
{
//TODO: We MUST cache the result here, it is very expensive to keep finding extension methods!
object result;
try
{
//Property?
result = typeof(T).InvokeMember(binder.Name,
System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.GetProperty,
null,
thisObject,
args);
return new Attempt<TryInvokeMemberResult>(true, new TryInvokeMemberResult(result, TryInvokeMemberSuccessReason.FoundProperty));
}
catch (MissingMethodException)
{
try
{
//Static or Instance Method?
result = typeof(T).InvokeMember(binder.Name,
System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.Static |
System.Reflection.BindingFlags.InvokeMethod,
null,
thisObject,
args);
return new Attempt<TryInvokeMemberResult>(true, new TryInvokeMemberResult(result, TryInvokeMemberSuccessReason.FoundMethod));
}
catch (MissingMethodException)
{
if (findExtensionMethodsOnTypes != null)
{
try
{
result = FindAndExecuteExtensionMethod(thisObject, args, binder.Name, findExtensionMethodsOnTypes);
return new Attempt<TryInvokeMemberResult>(true, new TryInvokeMemberResult(result, TryInvokeMemberSuccessReason.FoundExtensionMethod));
}
catch (TargetInvocationException ext)
{
//don't log here, we return this exception because the caller may need to do something specific when
//this exception occurs.
return new Attempt<TryInvokeMemberResult>(ext);
}
catch (Exception ex)
{
var sb = new StringBuilder("An error occurred finding an executing an extension method for type ");
sb.Append(typeof (T));
sb.Append("Types searched for extension methods were ");
foreach(var t in findExtensionMethodsOnTypes)
{
sb.Append(t + ",");
}
LogHelper.Error<DynamicInstanceHelper>(sb.ToString(), ex);
return new Attempt<TryInvokeMemberResult>(ex);
}
}
return Attempt<TryInvokeMemberResult>.False;
}
}
catch (Exception ex)
{
LogHelper.Error<DynamicInstanceHelper>("An unhandled exception occurred in method TryInvokeMember", ex);
return new Attempt<TryInvokeMemberResult>(ex);
}
}
/// <summary>
/// Attempts to find an extension method that matches the name and arguments based on scanning the Type's passed in
/// to the findMethodsOnTypes parameter
/// </summary>
/// <param name="thisObject">The instance object to execute the extension method for</param>
/// <param name="args"></param>
/// <param name="name"></param>
/// <param name="findMethodsOnTypes"></param>
/// <returns></returns>
internal static object FindAndExecuteExtensionMethod<T>(T thisObject,
object[] args,
string name,
IEnumerable<Type> findMethodsOnTypes)
{
object result = null;
//find known extension methods that match the first type in the list
MethodInfo toExecute = null;
foreach (var t in findMethodsOnTypes)
{
toExecute = ExtensionMethodFinder.FindExtensionMethod(t, args, name, false);
if (toExecute != null)
break;
}
if (toExecute != null)
{
var genericArgs = (new[] { (object)thisObject }).Concat(args);
result = toExecute.Invoke(null, genericArgs.ToArray());
}
else
{
throw new MissingMethodException();
}
return result;
}
}
}
+97
View File
@@ -0,0 +1,97 @@
using System;
using System.Collections.Generic;
using System.Collections;
using System.Dynamic;
using System.Web;
namespace Umbraco.Core.Dynamics
{
//This type is used as a return type when TryGetMember fails on a DynamicNode
//.Where explicitly checks for this type, to indicate that nothing was returned
//Because it's IEnumerable, if the user is actually trying @Model.TextPages or similar
//it will still return an enumerable object (assuming the call actually failed because there were no children of that type)
//but in .Where, if they use a property that doesn't exist, the lambda will bypass this and return false
public class DynamicNull : DynamicObject, IEnumerable, IHtmlString
{
public IEnumerator GetEnumerator()
{
return (new List<DynamicNull>()).GetEnumerator();
}
public DynamicNull Where(string predicate, params object[] values)
{
return this;
}
public DynamicNull OrderBy(string orderBy)
{
return this;
}
public int Count()
{
return 0;
}
public override string ToString()
{
return string.Empty;
}
public override bool TryGetMember(GetMemberBinder binder, out object result)
{
result = this;
return true;
}
public override bool TryGetIndex(GetIndexBinder binder, object[] indexes, out object result)
{
result = this;
return true;
}
public override bool TryInvoke(InvokeBinder binder, object[] args, out object result)
{
result = this;
return true;
}
public bool IsNull()
{
return true;
}
public bool HasValue()
{
return false;
}
public string Name
{
get
{
return string.Empty;
}
}
public int Id
{
get
{
return 0;
}
}
public static implicit operator bool(DynamicNull n)
{
return false;
}
public static implicit operator DateTime(DynamicNull n)
{
return DateTime.MinValue;
}
public static implicit operator int(DynamicNull n)
{
return 0;
}
public static implicit operator string(DynamicNull n)
{
return string.Empty;
}
public string ToHtmlString()
{
return string.Empty;
}
}
}
@@ -0,0 +1,10 @@
using System.Linq.Expressions;
namespace Umbraco.Core.Dynamics
{
internal class DynamicOrdering
{
public Expression Selector;
public bool Ascending;
}
}
@@ -0,0 +1,28 @@
using System;
namespace Umbraco.Core.Dynamics
{
internal class DynamicProperty
{
readonly string _name;
readonly Type _type;
public DynamicProperty(string name, Type type)
{
if (name == null) throw new ArgumentNullException("name");
if (type == null) throw new ArgumentNullException("type");
this._name = name;
this._type = type;
}
public string Name
{
get { return _name; }
}
public Type Type
{
get { return _type; }
}
}
}
@@ -1,12 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Dynamic;
namespace umbraco.MacroEngines
namespace Umbraco.Core.Dynamics
{
public class DynamicQueryableGetMemberBinder : GetMemberBinder
internal class DynamicQueryableGetMemberBinder : GetMemberBinder
{
public DynamicQueryableGetMemberBinder(string name, bool ignoreCase) : base(name, ignoreCase) { }
+735
View File
@@ -0,0 +1,735 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Dynamic;
using System.Reflection;
using System.Xml.Linq;
using System.Xml.XPath;
using System.Collections;
using System.IO;
using System.Web;
namespace Umbraco.Core.Dynamics
{
public class DynamicXml : DynamicObject, IEnumerable<DynamicXml>, IEnumerable<XElement>
{
public XElement BaseElement { get; set; }
public DynamicXml(XElement baseElement)
{
this.BaseElement = baseElement;
}
public DynamicXml(string xml)
{
var baseElement = XElement.Parse(xml);
this.BaseElement = baseElement;
}
public DynamicXml(XPathNodeIterator xpni)
{
if (xpni != null)
{
if (xpni.Current != null)
{
var xml = xpni.Current.OuterXml;
var baseElement = XElement.Parse(xml);
this.BaseElement = baseElement;
}
}
}
public string InnerText
{
get
{
return BaseElement.Value;
}
}
public string ToXml()
{
return BaseElement.ToString(SaveOptions.DisableFormatting);
}
public override bool TryGetIndex(GetIndexBinder binder, object[] indexes, out object result)
{
int index = 0;
if (indexes.Length > 0)
{
index = (int)indexes[0];
result = new DynamicXml(this.BaseElement.Elements().ToList()[index]);
return true;
}
return base.TryGetIndex(binder, indexes, out result);
}
public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
{
if (args.Length == 0 && binder.Name == "ToXml")
{
result = this.BaseElement.ToString();
return true;
}
if (args.Length == 1 && binder.Name == "XPath")
{
var elements = this.BaseElement.XPathSelectElements(args[0].ToString());
HandleIEnumerableXElement(elements, out result);
return true; //anyway
}
//ok, now lets try to match by member, property, extensino method
var attempt = DynamicInstanceHelper.TryInvokeMember(this, binder, args, new[]
{
typeof (IEnumerable<DynamicXml>),
typeof (IEnumerable<XElement>),
typeof (DynamicXml)
});
if (attempt.Success)
{
result = attempt.Result.ObjectResult;
//need to check the return type and possibly cast if result is from an extension method found
if (attempt.Result.Reason == DynamicInstanceHelper.TryInvokeMemberSuccessReason.FoundExtensionMethod)
{
//if the result is already a DynamicXml instance, then we do not need to cast
if (attempt.Result.ObjectResult != null && !(attempt.Result.ObjectResult is DynamicXml))
{
if (attempt.Result.ObjectResult is XElement)
{
result = new DynamicXml((XElement)attempt.Result.ObjectResult);
}
else if (attempt.Result.ObjectResult is IEnumerable<XElement>)
{
result = ((IEnumerable<XElement>)attempt.Result.ObjectResult).Select(x => new DynamicXml(x));
}
else if (attempt.Result.ObjectResult is IEnumerable<DynamicXml>)
{
result = ((IEnumerable<DynamicXml>)attempt.Result.ObjectResult).Select(x => new DynamicXml(x.BaseElement));
}
}
}
return true;
}
//this is the result of an extension method execution gone wrong so we return dynamic null
if (attempt.Result.Reason == DynamicInstanceHelper.TryInvokeMemberSuccessReason.FoundExtensionMethod
&& attempt.Error != null && attempt.Error is TargetInvocationException)
{
result = new DynamicNull();
return true;
}
result = null;
return false;
}
public override bool TryGetMember(GetMemberBinder binder, out object result)
{
if (BaseElement == null || binder == null)
{
result = null;
return false;
}
//Go ahead and try to fetch all of the elements matching the member name, and wrap them
var elements = BaseElement.Elements(binder.Name);
if (!elements.Any() && BaseElement.Name == "root" && BaseElement.Elements().Count() == 1)
{
//no elements matched, lets try first child
elements = BaseElement.Elements().ElementAt(0).Elements(binder.Name);
}
if (HandleIEnumerableXElement(elements, out result))
{
return true;
}
else
{
//Ok, so no elements matched, so lets try attributes
IEnumerable<string> attributes = BaseElement.Attributes(binder.Name).Select(attr => attr.Value);
int count = attributes.Count();
if (count > 0)
{
if (count > 1)
result = attributes; //more than one attribute matched, lets return the collection
else
result = attributes.FirstOrDefault(); //only one attribute matched, lets just return it
return true; // return true because we matched
}
else
{
//no attributes matched, lets try first child
if (BaseElement.Name == "root" && BaseElement.Elements().Count() == 1)
{
attributes = BaseElement.Elements().ElementAt(0).Attributes(binder.Name).Select(attr => attr.Value);
count = attributes.Count();
if (count > 1)
result = attributes; //more than one attribute matched, lets return the collection
else
result = attributes.FirstOrDefault(); //only one attribute matched, lets just return it
return true; // return true because we matched
}
}
}
return base.TryGetMember(binder, out result);
}
private bool HandleIEnumerableXElement(IEnumerable<XElement> elements, out object result)
{
//Get the count now, so we don't have to call it twice
int count = elements.Count();
if (count > 0)
{
var firstElement = elements.FirstOrDefault();
//we have a single element, does it have any children?
if (firstElement != null && firstElement.Elements().Count() == 0 && !firstElement.HasAttributes)
{
//no, return the text
result = firstElement.Value;
return true;
}
else
{
//We have more than one matching element, so let's return the collection
//elements is IEnumerable<DynamicXml>
//but we want to be able to re-enter this code
XElement root = new XElement(XName.Get("root"));
root.Add(elements);
result = new DynamicXml(root);
//From here, you'll either end up back here (because you have <root><node><node>)
//or you use [] indexing and you end up with a single element
return true;
}
}
result = null;
return false;
}
public DynamicXml XPath(string expression)
{
var matched = this.BaseElement.XPathSelectElements(expression);
DynamicXml root = new DynamicXml("<results/>");
foreach (var element in matched)
{
root.BaseElement.Add(element);
}
return root;
}
public IHtmlString ToHtml()
{
return new HtmlString(this.ToXml());
}
public DynamicXml Find(string expression)
{
return new DynamicXml(this.BaseElement.XPathSelectElements(expression).FirstOrDefault());
}
public DynamicXml Find(string attributeName, object value)
{
string expression = string.Format("//*[{0}='{1}']", attributeName, value);
return new DynamicXml(this.BaseElement.XPathSelectElements(expression).FirstOrDefault());
}
IEnumerator<XElement> IEnumerable<XElement>.GetEnumerator()
{
return this.BaseElement.Elements().GetEnumerator();
}
public IEnumerator<DynamicXml> GetEnumerator()
{
return this.BaseElement.Elements().Select(e => new DynamicXml(e)).GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public int Count()
{
return ((IEnumerable<XElement>)this).Count();
}
public bool Any()
{
return ((IEnumerable<XElement>)this).Any();
}
public IEnumerable<DynamicXml> Take(int count)
{
return ((IEnumerable<DynamicXml>)this).Take(count);
}
public IEnumerable<DynamicXml> Skip(int count)
{
return ((IEnumerable<DynamicXml>)this).Skip(count);
}
public bool IsNull()
{
return false;
}
public bool HasValue()
{
return true;
}
public bool IsFirst()
{
return IsHelper(n => n.Index() == 0);
}
public HtmlString IsFirst(string valueIfTrue)
{
return IsHelper(n => n.Index() == 0, valueIfTrue);
}
public HtmlString IsFirst(string valueIfTrue, string valueIfFalse)
{
return IsHelper(n => n.Index() == 0, valueIfTrue, valueIfFalse);
}
public bool IsNotFirst()
{
return !IsHelper(n => n.Index() == 0);
}
public HtmlString IsNotFirst(string valueIfTrue)
{
return IsHelper(n => n.Index() != 0, valueIfTrue);
}
public HtmlString IsNotFirst(string valueIfTrue, string valueIfFalse)
{
return IsHelper(n => n.Index() != 0, valueIfTrue, valueIfFalse);
}
public bool IsPosition(int index)
{
if (this.BaseElement == null || this.BaseElement.Parent == null)
{
return false;
}
return IsHelper(n => n.Index() == index);
}
public HtmlString IsPosition(int index, string valueIfTrue)
{
if (this.BaseElement == null || this.BaseElement.Parent == null)
{
return new HtmlString(string.Empty);
}
return IsHelper(n => n.Index() == index, valueIfTrue);
}
public HtmlString IsPosition(int index, string valueIfTrue, string valueIfFalse)
{
if (this.BaseElement == null || this.BaseElement.Parent == null)
{
return new HtmlString(valueIfFalse);
}
return IsHelper(n => n.Index() == index, valueIfTrue, valueIfFalse);
}
public bool IsModZero(int modulus)
{
if (this.BaseElement == null || this.BaseElement.Parent == null)
{
return false;
}
return IsHelper(n => n.Index() % modulus == 0);
}
public HtmlString IsModZero(int modulus, string valueIfTrue)
{
if (this.BaseElement == null || this.BaseElement.Parent == null)
{
return new HtmlString(string.Empty);
}
return IsHelper(n => n.Index() % modulus == 0, valueIfTrue);
}
public HtmlString IsModZero(int modulus, string valueIfTrue, string valueIfFalse)
{
if (this.BaseElement == null || this.BaseElement.Parent == null)
{
return new HtmlString(valueIfFalse);
}
return IsHelper(n => n.Index() % modulus == 0, valueIfTrue, valueIfFalse);
}
public bool IsNotModZero(int modulus)
{
if (this.BaseElement == null || this.BaseElement.Parent == null)
{
return false;
}
return IsHelper(n => n.Index() % modulus != 0);
}
public HtmlString IsNotModZero(int modulus, string valueIfTrue)
{
if (this.BaseElement == null || this.BaseElement.Parent == null)
{
return new HtmlString(string.Empty);
}
return IsHelper(n => n.Index() % modulus != 0, valueIfTrue);
}
public HtmlString IsNotModZero(int modulus, string valueIfTrue, string valueIfFalse)
{
if (this.BaseElement == null || this.BaseElement.Parent == null)
{
return new HtmlString(valueIfFalse);
}
return IsHelper(n => n.Index() % modulus != 0, valueIfTrue, valueIfFalse);
}
public bool IsNotPosition(int index)
{
if (this.BaseElement == null || this.BaseElement.Parent == null)
{
return false;
}
return !IsHelper(n => n.Index() == index);
}
public HtmlString IsNotPosition(int index, string valueIfTrue)
{
if (this.BaseElement == null || this.BaseElement.Parent == null)
{
return new HtmlString(string.Empty);
}
return IsHelper(n => n.Index() != index, valueIfTrue);
}
public HtmlString IsNotPosition(int index, string valueIfTrue, string valueIfFalse)
{
if (this.BaseElement == null || this.BaseElement.Parent == null)
{
return new HtmlString(valueIfFalse);
}
return IsHelper(n => n.Index() != index, valueIfTrue, valueIfFalse);
}
public bool IsLast()
{
if (this.BaseElement == null || this.BaseElement.Parent == null)
{
return false;
}
int count = this.BaseElement.Parent.Elements().Count();
return IsHelper(n => n.Index() == count - 1);
}
public HtmlString IsLast(string valueIfTrue)
{
if (this.BaseElement == null || this.BaseElement.Parent == null)
{
return new HtmlString(string.Empty);
}
int count = this.BaseElement.Parent.Elements().Count();
return IsHelper(n => n.Index() == count - 1, valueIfTrue);
}
public HtmlString IsLast(string valueIfTrue, string valueIfFalse)
{
if (this.BaseElement == null || this.BaseElement.Parent == null)
{
return new HtmlString(valueIfFalse);
}
int count = this.BaseElement.Parent.Elements().Count();
return IsHelper(n => n.Index() == count - 1, valueIfTrue, valueIfFalse);
}
public bool IsNotLast()
{
if (this.BaseElement == null || this.BaseElement.Parent == null)
{
return false;
}
int count = this.BaseElement.Parent.Elements().Count();
return !IsHelper(n => n.Index() == count - 1);
}
public HtmlString IsNotLast(string valueIfTrue)
{
if (this.BaseElement == null || this.BaseElement.Parent == null)
{
return new HtmlString(string.Empty);
}
int count = this.BaseElement.Parent.Elements().Count();
return IsHelper(n => n.Index() != count - 1, valueIfTrue);
}
public HtmlString IsNotLast(string valueIfTrue, string valueIfFalse)
{
if (this.BaseElement == null || this.BaseElement.Parent == null)
{
return new HtmlString(valueIfFalse);
}
int count = this.BaseElement.Parent.Elements().Count();
return IsHelper(n => n.Index() != count - 1, valueIfTrue, valueIfFalse);
}
public bool IsEven()
{
return IsHelper(n => n.Index() % 2 == 0);
}
public HtmlString IsEven(string valueIfTrue)
{
return IsHelper(n => n.Index() % 2 == 0, valueIfTrue);
}
public HtmlString IsEven(string valueIfTrue, string valueIfFalse)
{
return IsHelper(n => n.Index() % 2 == 0, valueIfTrue, valueIfFalse);
}
public bool IsOdd()
{
return IsHelper(n => n.Index() % 2 == 1);
}
public HtmlString IsOdd(string valueIfTrue)
{
return IsHelper(n => n.Index() % 2 == 1, valueIfTrue);
}
public HtmlString IsOdd(string valueIfTrue, string valueIfFalse)
{
return IsHelper(n => n.Index() % 2 == 1, valueIfTrue, valueIfFalse);
}
public bool IsEqual(DynamicXml other)
{
return IsHelper(n => n.BaseElement == other.BaseElement);
}
public HtmlString IsEqual(DynamicXml other, string valueIfTrue)
{
return IsHelper(n => n.BaseElement == other.BaseElement, valueIfTrue);
}
public HtmlString IsEqual(DynamicXml other, string valueIfTrue, string valueIfFalse)
{
return IsHelper(n => n.BaseElement == other.BaseElement, valueIfTrue, valueIfFalse);
}
public bool IsNotEqual(DynamicXml other)
{
return IsHelper(n => n.BaseElement != other.BaseElement);
}
public HtmlString IsNotEqual(DynamicXml other, string valueIfTrue)
{
return IsHelper(n => n.BaseElement != other.BaseElement, valueIfTrue);
}
public HtmlString IsNotEqual(DynamicXml other, string valueIfTrue, string valueIfFalse)
{
return IsHelper(n => n.BaseElement != other.BaseElement, valueIfTrue, valueIfFalse);
}
public bool IsDescendant(DynamicXml other)
{
var ancestors = this.Ancestors();
return IsHelper(n => ancestors.FirstOrDefault(ancestor => ancestor.BaseElement == other.BaseElement) != null);
}
public HtmlString IsDescendant(DynamicXml other, string valueIfTrue)
{
var ancestors = this.Ancestors();
return IsHelper(n => ancestors.FirstOrDefault(ancestor => ancestor.BaseElement == other.BaseElement) != null, valueIfTrue);
}
public HtmlString IsDescendant(DynamicXml other, string valueIfTrue, string valueIfFalse)
{
var ancestors = this.Ancestors();
return IsHelper(n => ancestors.FirstOrDefault(ancestor => ancestor.BaseElement == other.BaseElement) != null, valueIfTrue, valueIfFalse);
}
public bool IsDescendantOrSelf(DynamicXml other)
{
var ancestors = this.AncestorsOrSelf();
return IsHelper(n => ancestors.FirstOrDefault(ancestor => ancestor.BaseElement == other.BaseElement) != null);
}
public HtmlString IsDescendantOrSelf(DynamicXml other, string valueIfTrue)
{
var ancestors = this.AncestorsOrSelf();
return IsHelper(n => ancestors.FirstOrDefault(ancestor => ancestor.BaseElement == other.BaseElement) != null, valueIfTrue);
}
public HtmlString IsDescendantOrSelf(DynamicXml other, string valueIfTrue, string valueIfFalse)
{
var ancestors = this.AncestorsOrSelf();
return IsHelper(n => ancestors.FirstOrDefault(ancestor => ancestor.BaseElement == other.BaseElement) != null, valueIfTrue, valueIfFalse);
}
public bool IsAncestor(DynamicXml other)
{
var descendants = this.Descendants();
return IsHelper(n => descendants.FirstOrDefault(descendant => descendant.BaseElement == other.BaseElement) != null);
}
public HtmlString IsAncestor(DynamicXml other, string valueIfTrue)
{
var descendants = this.Descendants();
return IsHelper(n => descendants.FirstOrDefault(descendant => descendant.BaseElement == other.BaseElement) != null, valueIfTrue);
}
public HtmlString IsAncestor(DynamicXml other, string valueIfTrue, string valueIfFalse)
{
var descendants = this.Descendants();
return IsHelper(n => descendants.FirstOrDefault(descendant => descendant.BaseElement == other.BaseElement) != null, valueIfTrue, valueIfFalse);
}
public bool IsAncestorOrSelf(DynamicXml other)
{
var descendants = this.DescendantsOrSelf();
return IsHelper(n => descendants.FirstOrDefault(descendant => descendant.BaseElement == other.BaseElement) != null);
}
public HtmlString IsAncestorOrSelf(DynamicXml other, string valueIfTrue)
{
var descendants = this.DescendantsOrSelf();
return IsHelper(n => descendants.FirstOrDefault(descendant => descendant.BaseElement == other.BaseElement) != null, valueIfTrue);
}
public HtmlString IsAncestorOrSelf(DynamicXml other, string valueIfTrue, string valueIfFalse)
{
var descendants = this.DescendantsOrSelf();
return IsHelper(n => descendants.FirstOrDefault(descendant => descendant.BaseElement == other.BaseElement) != null, valueIfTrue, valueIfFalse);
}
public IEnumerable<DynamicXml> Descendants()
{
return Descendants(n => true);
}
public IEnumerable<DynamicXml> Descendants(Func<XElement, bool> func)
{
var flattenedNodes = this.BaseElement.Elements().Map(func, (XElement n) => { return n.Elements(); });
return flattenedNodes.ToList().ConvertAll(n => new DynamicXml(n));
}
public IEnumerable<DynamicXml> DescendantsOrSelf()
{
return DescendantsOrSelf(n => true);
}
public IEnumerable<DynamicXml> DescendantsOrSelf(Func<XElement, bool> func)
{
var flattenedNodes = this.BaseElement.Elements().Map(func, (XElement n) => { return n.Elements(); });
var list = new List<DynamicXml>();
list.Add(this);
list.AddRange(flattenedNodes.ToList().ConvertAll(n => new DynamicXml(n)));
return list;
}
public IEnumerable<DynamicXml> Ancestors()
{
return Ancestors(item => true);
}
public IEnumerable<DynamicXml> Ancestors(Func<XElement, bool> func)
{
var ancestorList = new List<XElement>();
var node = this.BaseElement;
while (node != null)
{
if (node.Parent == null) break;
XElement parent = node.Parent;
if (parent != null)
{
if (this.BaseElement != parent)
{
node = parent;
if (func(node))
{
ancestorList.Add(node);
}
}
else
{
break;
}
}
else
{
break;
}
}
ancestorList.Reverse();
return ancestorList.ConvertAll(item => new DynamicXml(item));
}
public IEnumerable<DynamicXml> AncestorsOrSelf()
{
return AncestorsOrSelf(item => true);
}
public IEnumerable<DynamicXml> AncestorsOrSelf(Func<XElement, bool> func)
{
List<XElement> ancestorList = new List<XElement>();
var node = this.BaseElement;
ancestorList.Add(node);
while (node != null)
{
if (node.Parent == null) break;
XElement parent = node.Parent;
if (parent != null)
{
if (this.BaseElement != parent)
{
node = parent;
if (func(node))
{
ancestorList.Add(node);
}
}
else
{
break;
}
}
else
{
break;
}
}
ancestorList.Reverse();
return ancestorList.ConvertAll(item => new DynamicXml(item));
}
public int Index()
{
if (this.BaseElement != null && this.BaseElement.Parent != null)
{
var elements = this.BaseElement.Parent.Elements();
int index = 0;
foreach (var element in elements)
{
if (element == this.BaseElement) break;
index++;
}
return index;
}
return 0;
}
public bool IsHelper(Func<DynamicXml, bool> test)
{
return test(this);
}
public HtmlString IsHelper(Func<DynamicXml, bool> test, string valueIfTrue)
{
return IsHelper(test, valueIfTrue, string.Empty);
}
public HtmlString IsHelper(Func<DynamicXml, bool> test, string valueIfTrue, string valueIfFalse)
{
return test(this) ? new HtmlString(valueIfTrue) : new HtmlString(valueIfFalse);
}
public static string StripDashesInElementOrAttributeNames(string xml)
{
using (MemoryStream outputms = new MemoryStream())
{
using (TextWriter outputtw = new StreamWriter(outputms))
{
using (MemoryStream ms = new MemoryStream())
{
using (TextWriter tw = new StreamWriter(ms))
{
tw.Write(xml);
tw.Flush();
ms.Position = 0;
using (TextReader tr = new StreamReader(ms))
{
bool IsInsideElement = false, IsInsideQuotes = false;
int ic = 0;
while ((ic = tr.Read()) != -1)
{
if (ic == (int)'<' && !IsInsideQuotes)
{
if (tr.Peek() != (int)'!')
{
IsInsideElement = true;
}
}
if (ic == (int)'>' && !IsInsideQuotes)
{
IsInsideElement = false;
}
if (ic == (int)'"')
{
IsInsideQuotes = !IsInsideQuotes;
}
if (!IsInsideElement || ic != (int)'-' || IsInsideQuotes)
{
outputtw.Write((char)ic);
}
}
}
}
}
outputtw.Flush();
outputms.Position = 0;
using (TextReader outputtr = new StreamReader(outputms))
{
return outputtr.ReadToEnd();
}
}
}
}
}
}
@@ -0,0 +1,198 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web.Compilation;
using System.Runtime.CompilerServices;
using System.Collections;
using System.Linq.Expressions;
namespace Umbraco.Core.Dynamics
{
/// <summary>
/// Utility class for finding extension methods on a type to execute
/// </summary>
internal static class ExtensionMethodFinder
{
/// <summary>
/// Returns all extension methods found matching the definition
/// </summary>
/// <param name="thisType"></param>
/// <param name="name"></param>
/// <param name="argumentCount"></param>
/// <param name="argsContainsThis"></param>
/// <returns></returns>
/// <remarks>
/// TODO: NOTE: This will be an intensive method to call!! Results should be cached!
/// </remarks>
private static IEnumerable<MethodInfo> GetAllExtensionMethods(Type thisType, string name, int argumentCount, bool argsContainsThis)
{
//only scan assemblies we know to contain extension methods (user assemblies)
var assembliesToScan = TypeFinder.GetAssembliesWithKnownExclusions();
//get extension methods from runtime
var candidates = (
from assembly in assembliesToScan
where assembly.IsDefined(typeof(ExtensionAttribute), false)
from type in assembly.GetTypes()
where (type.IsDefined(typeof(ExtensionAttribute), false)
&& type.IsSealed && !type.IsGenericType && !type.IsNested)
from method in type.GetMethods(BindingFlags.Static | BindingFlags.Public)
// this filters extension methods
where method.IsDefined(typeof(ExtensionAttribute), false)
select method
);
//add the extension methods defined in IEnumerable
candidates = candidates.Concat(typeof(Enumerable).GetMethods(BindingFlags.Static | BindingFlags.Public));
//filter by name
var methodsByName = candidates.Where(m => m.Name == name);
var isGenericAndRightParamCount = methodsByName.Where(m => m.GetParameters().Length == argumentCount + (argsContainsThis ? 0 : 1));
//find the right overload that can take genericParameterType
//which will be either DynamicNodeList or List<DynamicNode> which is IEnumerable`
var withGenericParameterType = isGenericAndRightParamCount.Select(m => new { m, t = FirstParameterType(m) });
var methodsWhereArgZeroIsTargetType = (from method in withGenericParameterType
where
method.t != null && MethodArgZeroHasCorrectTargetType(method.m, method.t, thisType)
select method);
return methodsWhereArgZeroIsTargetType.Select(mt => mt.m);
}
private static bool MethodArgZeroHasCorrectTargetType(MethodInfo method, Type firstArgumentType, Type thisType)
{
//This is done with seperate method calls because you can't debug/watch lamdas - if you're trying to figure
//out why the wrong method is returned, it helps to be able to see each boolean result
return
// is it defined on me?
MethodArgZeroHasCorrectTargetTypeTypeMatchesExactly(method, firstArgumentType, thisType) ||
// or on any of my interfaces?
MethodArgZeroHasCorrectTargetTypeAnInterfaceMatches(method, firstArgumentType, thisType) ||
// or on any of my base types?
MethodArgZeroHasCorrectTargetTypeIsASubclassOf(method, firstArgumentType, thisType) ||
//share a common interface (e.g. IEnumerable)
MethodArgZeroHasCorrectTargetTypeShareACommonInterface(method, firstArgumentType, thisType);
}
private static bool MethodArgZeroHasCorrectTargetTypeShareACommonInterface(MethodInfo method, Type firstArgumentType, Type thisType)
{
Type[] interfaces = firstArgumentType.GetInterfaces();
if (interfaces.Length == 0)
{
return false;
}
bool result = interfaces.All(i => thisType.GetInterfaces().Contains(i));
return result;
}
private static bool MethodArgZeroHasCorrectTargetTypeIsASubclassOf(MethodInfo method, Type firstArgumentType, Type thisType)
{
bool result = thisType.IsSubclassOf(firstArgumentType);
return result;
}
private static bool MethodArgZeroHasCorrectTargetTypeAnInterfaceMatches(MethodInfo method, Type firstArgumentType, Type thisType)
{
bool result = thisType.GetInterfaces().Contains(firstArgumentType);
return result;
}
private static bool MethodArgZeroHasCorrectTargetTypeTypeMatchesExactly(MethodInfo method, Type firstArgumentType, Type thisType)
{
bool result = (thisType == firstArgumentType);
return result;
}
private static Type FirstParameterType(MethodInfo m)
{
ParameterInfo[] p = m.GetParameters();
if (p.Any())
{
return p.First().ParameterType;
}
return null;
}
private static MethodInfo DetermineMethodFromParams(IEnumerable<MethodInfo> methods, Type genericType, IEnumerable<object> args)
{
if (!methods.Any())
{
return null;
}
MethodInfo methodToExecute = null;
if (methods.Count() > 1)
{
//Given the args, lets get the types and compare the type sequence to try and find the correct overload
var argTypes = args.ToList().ConvertAll(o =>
{
var oe = (o as Expression);
if (oe != null)
{
return oe.Type.FullName;
}
return o.GetType().FullName;
});
var methodsWithArgTypes = methods.Select(method => new { method, types = method.GetParameters().Select(pi => pi.ParameterType.FullName) });
var firstMatchingOverload = methodsWithArgTypes.FirstOrDefault(m => m.types.SequenceEqual(argTypes));
if (firstMatchingOverload != null)
{
methodToExecute = firstMatchingOverload.method;
}
}
if (methodToExecute == null)
{
var firstMethod = methods.FirstOrDefault();
// NH: this is to ensure that it's always the correct one being chosen when using the LINQ extension methods
if (methods.Count() > 1)
{
var firstGenericMethod = methods.FirstOrDefault(x => x.IsGenericMethodDefinition);
if (firstGenericMethod != null)
{
firstMethod = firstGenericMethod;
}
}
if (firstMethod != null)
{
if (firstMethod.IsGenericMethodDefinition)
{
if (genericType != null)
{
methodToExecute = firstMethod.MakeGenericMethod(genericType);
}
}
else
{
methodToExecute = firstMethod;
}
}
}
return methodToExecute;
}
public static MethodInfo FindExtensionMethod(Type thisType, object[] args, string name, bool argsContainsThis)
{
Type genericType = null;
if (thisType.IsGenericType)
{
genericType = thisType.GetGenericArguments()[0];
}
var methods = GetAllExtensionMethods(thisType, name, args.Length, argsContainsThis).ToArray();
return DetermineMethodFromParams(methods, genericType, args);
}
}
}
@@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Models;
namespace Umbraco.Core.Dynamics
{
internal static class ExtensionMethods
{
public static IEnumerable<TSource> Map<TSource>(
this IEnumerable<TSource> source,
Func<TSource, bool> selectorFunction,
Func<TSource, IEnumerable<TSource>> getChildrenFunction)
{
if (!source.Any())
{
return source;
}
// Add what we have to the stack
var flattenedList = source.Where(selectorFunction);
// Go through the input enumerable looking for children,
// and add those if we have them
foreach (TSource element in source)
{
var secondInner = getChildrenFunction(element);
if (secondInner.Any())
{
secondInner = secondInner.Map(selectorFunction, getChildrenFunction);
}
flattenedList = flattenedList.Concat(secondInner);
}
return flattenedList;
}
public static bool ContainsAny(this string haystack, IEnumerable<string> needles)
{
if (haystack == null) throw new ArgumentNullException("haystack");
if (!string.IsNullOrEmpty(haystack) || needles.Any())
{
return needles.Any(haystack.Contains);
}
return false;
}
public static bool ContainsAny(this string haystack, params string[] needles)
{
if (haystack == null) throw new ArgumentNullException("haystack");
if (!string.IsNullOrEmpty(haystack) || needles.Length > 0)
{
return needles.Any(haystack.Contains);
}
return false;
}
public static bool ContainsAny(this string haystack, StringComparison comparison, IEnumerable<string> needles)
{
if (haystack == null) throw new ArgumentNullException("haystack");
if (!string.IsNullOrEmpty(haystack) || needles.Any())
{
return needles.Any(value => haystack.IndexOf(value, comparison) >= 0);
}
return false;
}
public static bool ContainsAny(this string haystack, StringComparison comparison, params string[] needles)
{
if (haystack == null) throw new ArgumentNullException("haystack");
if (!string.IsNullOrEmpty(haystack) || needles.Length > 0)
{
return needles.Any(value => haystack.IndexOf(value, comparison) >= 0);
}
return false;
}
public static bool ContainsInsensitive(this string haystack, string needle)
{
if (haystack == null) throw new ArgumentNullException("haystack");
return haystack.IndexOf(needle, StringComparison.CurrentCultureIgnoreCase) >= 0;
}
public static bool HasValue(this string s)
{
return !string.IsNullOrWhiteSpace(s);
}
}
}
@@ -0,0 +1,25 @@
using System;
namespace Umbraco.Core.Dynamics
{
internal sealed class ParseException : Exception
{
readonly int _position;
public ParseException(string message, int position)
: base(message)
{
this._position = position;
}
public int Position
{
get { return _position; }
}
public override string ToString()
{
return string.Format(Res.ParseExceptionFormat, Message, _position);
}
}
}
@@ -0,0 +1,65 @@
using System;
using Umbraco.Core.Models;
using umbraco.interfaces;
using System.Web;
namespace Umbraco.Core.Dynamics
{
internal class PropertyResult : IPublishedContentProperty, IHtmlString
{
internal PropertyResult(IPublishedContentProperty source, PropertyResultType type)
{
if (source == null) throw new ArgumentNullException("source");
Alias = source.Alias;
Value = source.Value;
Version = source.Version;
PropertyType = type;
}
internal PropertyResult(string alias, object value, Guid version, PropertyResultType type)
{
if (alias == null) throw new ArgumentNullException("alias");
if (value == null) throw new ArgumentNullException("value");
Alias = alias;
Value = value;
Version = version;
PropertyType = type;
}
internal PropertyResultType PropertyType { get; private set; }
public string Alias { get; private set; }
public object Value { get; private set; }
/// <summary>
/// Returns the value as a string output, this is used in the final rendering process of a property
/// </summary>
internal string ValueAsString
{
get
{
return Value == null ? "" : Convert.ToString(Value);
}
}
public Guid Version { get; private set; }
/// <summary>
/// The Id of the document for which this property belongs to
/// </summary>
public int DocumentId { get; set; }
/// <summary>
/// The alias of the document type alias for which this property belongs to
/// </summary>
public string DocumentTypeAlias { get; set; }
public string ToHtmlString()
{
return ValueAsString;
}
}
}
@@ -0,0 +1,23 @@
namespace Umbraco.Core.Dynamics
{
/// <summary>
/// Currently just used for informational purposes as to where a PropertyResult object was created from.
/// </summary>
internal enum PropertyResultType
{
/// <summary>
/// The property resolved was a normal document property
/// </summary>
UserProperty,
/// <summary>
/// The property resolved was a property defined as a member on the document object (IPublishedContent) itself
/// </summary>
ReflectedProperty,
/// <summary>
/// The property was created manually for a custom purpose
/// </summary>
CustomProperty
}
}
+50
View File
@@ -0,0 +1,50 @@
namespace Umbraco.Core.Dynamics
{
internal static class Res
{
public const string DuplicateIdentifier = "The identifier '{0}' was defined more than once";
public const string ExpressionTypeMismatch = "Expression of type '{0}' expected";
public const string ExpressionExpected = "Expression expected";
public const string InvalidCharacterLiteral = "Character literal must contain exactly one character";
public const string InvalidIntegerLiteral = "Invalid integer literal '{0}'";
public const string InvalidRealLiteral = "Invalid real literal '{0}'";
public const string UnknownIdentifier = "Unknown identifier '{0}'";
public const string NoItInScope = "No 'it' is in scope";
public const string IifRequiresThreeArgs = "The 'iif' function requires three arguments";
public const string FirstExprMustBeBool = "The first expression must be of type 'Boolean'";
public const string BothTypesConvertToOther = "Both of the types '{0}' and '{1}' convert to the other";
public const string NeitherTypeConvertsToOther = "Neither of the types '{0}' and '{1}' converts to the other";
public const string MissingAsClause = "Expression is missing an 'as' clause";
public const string ArgsIncompatibleWithLambda = "Argument list incompatible with lambda expression";
public const string TypeHasNoNullableForm = "Type '{0}' has no nullable form";
public const string NoMatchingConstructor = "No matching constructor in type '{0}'";
public const string AmbiguousConstructorInvocation = "Ambiguous invocation of '{0}' constructor";
public const string CannotConvertValue = "A value of type '{0}' cannot be converted to type '{1}'";
public const string NoApplicableMethod = "No applicable method '{0}' exists in type '{1}'";
public const string MethodsAreInaccessible = "Methods on type '{0}' are not accessible";
public const string MethodIsVoid = "Method '{0}' in type '{1}' does not return a value";
public const string AmbiguousMethodInvocation = "Ambiguous invocation of method '{0}' in type '{1}'";
public const string UnknownPropertyOrField = "No property or field '{0}' exists in type '{1}'";
public const string NoApplicableAggregate = "No applicable aggregate method '{0}' exists";
public const string CannotIndexMultiDimArray = "Indexing of multi-dimensional arrays is not supported";
public const string InvalidIndex = "Array index must be an integer expression";
public const string NoApplicableIndexer = "No applicable indexer exists in type '{0}'";
public const string AmbiguousIndexerInvocation = "Ambiguous invocation of indexer in type '{0}'";
public const string IncompatibleOperand = "Operator '{0}' incompatible with operand type '{1}'";
public const string IncompatibleOperands = "Operator '{0}' incompatible with operand types '{1}' and '{2}'";
public const string UnterminatedStringLiteral = "Unterminated string literal";
public const string InvalidCharacter = "Syntax error '{0}'";
public const string DigitExpected = "Digit expected";
public const string SyntaxError = "Syntax error";
public const string TokenExpected = "{0} expected";
public const string ParseExceptionFormat = "{0} (at index {1})";
public const string ColonExpected = "':' expected";
public const string OpenParenExpected = "'(' expected";
public const string CloseParenOrOperatorExpected = "')' or operator expected";
public const string CloseParenOrCommaExpected = "')' or ',' expected";
public const string DotOrOpenParenExpected = "'.' or '(' expected";
public const string OpenBracketExpected = "'[' expected";
public const string CloseBracketOrCommaExpected = "']' or ',' expected";
public const string IdentifierExpected = "Identifier expected";
}
}
+43
View File
@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Umbraco.Core.Dynamics
{
internal class Signature : IEquatable<Signature>
{
public DynamicProperty[] Properties { get; set; }
public int HashCode { get; set; }
public Signature(IEnumerable<DynamicProperty> properties)
{
this.Properties = properties.ToArray();
HashCode = 0;
foreach (DynamicProperty p in this.Properties)
{
HashCode ^= p.Name.GetHashCode() ^ p.Type.GetHashCode();
}
}
public override int GetHashCode()
{
return HashCode;
}
public override bool Equals(object obj)
{
return obj is Signature && Equals((Signature)obj);
}
public bool Equals(Signature other)
{
if (Properties.Length != other.Properties.Length) return false;
for (int i = 0; i < Properties.Length; i++)
{
if (Properties[i].Name != other.Properties[i].Name ||
Properties[i].Type != other.Properties[i].Type) return false;
}
return true;
}
}
}
+108
View File
@@ -0,0 +1,108 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Umbraco.Core
{
/// <summary>
/// A very useful class for parsing, enumerating and querying Enum objects
/// </summary>
/// <typeparam name="T"></typeparam>
/// <remarks>
/// Taken from http://damieng.com/blog/2010/10/17/enums-better-syntax-improved-performance-and-tryparse-in-net-3-5
/// </remarks>
internal static class Enum<T> where T : struct
{
private static readonly IEnumerable<T> All = Enum.GetValues(typeof(T)).Cast<T>();
private static readonly Dictionary<string, T> InsensitiveNames = All.ToDictionary(k => Enum.GetName(typeof(T), k).ToLowerInvariant());
private static readonly Dictionary<string, T> SensitiveNames = All.ToDictionary(k => Enum.GetName(typeof(T), k));
private static readonly Dictionary<int, T> Values = All.ToDictionary(k => Convert.ToInt32(k));
private static readonly Dictionary<T, string> Names = All.ToDictionary(k => k, v => v.ToString());
public static bool IsDefined(T value)
{
return Names.Keys.Contains(value);
}
public static bool IsDefined(string value)
{
return SensitiveNames.Keys.Contains(value);
}
public static bool IsDefined(int value)
{
return Values.Keys.Contains(value);
}
public static IEnumerable<T> GetValues()
{
return All;
}
public static string[] GetNames()
{
return Names.Values.ToArray();
}
public static string GetName(T value)
{
string name;
Names.TryGetValue(value, out name);
return name;
}
public static T Parse(string value)
{
T parsed = default(T);
if (!SensitiveNames.TryGetValue(value, out parsed))
throw new ArgumentException("Value is not one of the named constants defined for the enumeration", "value");
return parsed;
}
public static T Parse(string value, bool ignoreCase)
{
if (!ignoreCase)
return Parse(value);
T parsed = default(T);
if (!InsensitiveNames.TryGetValue(value.ToLowerInvariant(), out parsed))
throw new ArgumentException("Value is not one of the named constants defined for the enumeration", "value");
return parsed;
}
public static bool TryParse(string value, out T returnValue)
{
return SensitiveNames.TryGetValue(value, out returnValue);
}
public static bool TryParse(string value, bool ignoreCase, out T returnValue)
{
if (!ignoreCase)
return TryParse(value, out returnValue);
return InsensitiveNames.TryGetValue(value.ToLowerInvariant(), out returnValue);
}
public static T? ParseOrNull(string value)
{
if (String.IsNullOrEmpty(value))
return null;
T foundValue;
if (InsensitiveNames.TryGetValue(value.ToLowerInvariant(), out foundValue))
return foundValue;
return null;
}
public static T? CastOrNull(int value)
{
T foundValue;
if (Values.TryGetValue(value, out foundValue))
return foundValue;
return null;
}
}
}
+28
View File
@@ -0,0 +1,28 @@
using System;
using System.Linq;
using System.Linq.Expressions;
namespace Umbraco.Core
{
internal static class ExpressionExtensions
{
public static Expression<Func<T, bool>> True<T>() { return f => true; }
public static Expression<Func<T, bool>> False<T>() { return f => false; }
public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> left,
Expression<Func<T, bool>> right)
{
var invokedExpr = Expression.Invoke(right, left.Parameters.Cast<Expression>());
return Expression.Lambda<Func<T, bool>>
(Expression.OrElse(left.Body, invokedExpr), left.Parameters);
}
public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> left,
Expression<Func<T, bool>> right)
{
var invokedExpr = Expression.Invoke(right, left.Parameters.Cast<Expression>());
return Expression.Lambda<Func<T, bool>>
(Expression.AndAlso(left.Body, invokedExpr), left.Parameters);
}
}
}
+306
View File
@@ -0,0 +1,306 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace Umbraco.Core
{
/// <summary>
/// A set of helper methods for dealing with expressions
/// </summary>
/// <remarks></remarks>
internal static class ExpressionHelper
{
private static readonly ConcurrentDictionary<LambdaExpressionCacheKey, PropertyInfo> PropertyInfoCache = new ConcurrentDictionary<LambdaExpressionCacheKey, PropertyInfo>();
/// <summary>
/// Gets a <see cref="PropertyInfo"/> object from an expression.
/// </summary>
/// <typeparam name="TSource">The type of the source.</typeparam>
/// <typeparam name="TProperty">The type of the property.</typeparam>
/// <param name="source">The source.</param>
/// <param name="propertyLambda">The property lambda.</param>
/// <returns></returns>
/// <remarks></remarks>
public static PropertyInfo GetPropertyInfo<TSource, TProperty>(this TSource source, Expression<Func<TSource, TProperty>> propertyLambda)
{
return GetPropertyInfo(propertyLambda);
}
/// <summary>
/// Gets a <see cref="PropertyInfo"/> object from an expression.
/// </summary>
/// <typeparam name="TSource">The type of the source.</typeparam>
/// <typeparam name="TProperty">The type of the property.</typeparam>
/// <param name="propertyLambda">The property lambda.</param>
/// <returns></returns>
/// <remarks></remarks>
public static PropertyInfo GetPropertyInfo<TSource, TProperty>(Expression<Func<TSource, TProperty>> propertyLambda)
{
return PropertyInfoCache.GetOrAdd(
new LambdaExpressionCacheKey(propertyLambda),
x =>
{
var type = typeof(TSource);
var member = propertyLambda.Body as MemberExpression;
if (member == null)
{
if (propertyLambda.Body.GetType().Name == "UnaryExpression")
{
// The expression might be for some boxing, e.g. representing a value type like HiveId as an object
// in which case the expression will be Convert(x.MyProperty)
var unary = propertyLambda.Body as UnaryExpression;
if (unary != null)
{
var boxedMember = unary.Operand as MemberExpression;
if (boxedMember == null)
throw new ArgumentException("The type of property could not be infered, try specifying the type parameters explicitly. This can happen if you have tried to access PropertyInfo where the property's return type is a value type, but the expression is trying to convert it to an object");
else member = boxedMember;
}
}
else throw new ArgumentException(string.Format("Expression '{0}' refers to a method, not a property.", propertyLambda));
}
var propInfo = member.Member as PropertyInfo;
if (propInfo == null)
throw new ArgumentException(string.Format(
"Expression '{0}' refers to a field, not a property.",
propertyLambda));
if (type != propInfo.ReflectedType &&
!type.IsSubclassOf(propInfo.ReflectedType))
throw new ArgumentException(string.Format(
"Expresion '{0}' refers to a property that is not from type {1}.",
propertyLambda,
type));
return propInfo;
});
}
public static IDictionary<string, object> GetMethodParams<T1, T2>(Expression<Func<T1, T2>> fromExpression)
{
if (fromExpression == null) return null;
var body = fromExpression.Body as MethodCallExpression;
if (body == null)
return new Dictionary<string, object>();
var rVal = new Dictionary<string, object>();
var parameters = body.Method.GetParameters().Select(x => x.Name).ToArray();
var i = 0;
foreach (var argument in body.Arguments)
{
var lambda = Expression.Lambda(argument, fromExpression.Parameters);
var d = lambda.Compile();
var value = d.DynamicInvoke(new object[1]);
rVal.Add(parameters[i], value);
i++;
}
return rVal;
}
/// <summary>
/// Gets a <see cref="MethodInfo"/> from an <see cref="Expression{Action{T}}"/> provided it refers to a method call.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="fromExpression">From expression.</param>
/// <returns>The <see cref="MethodInfo"/> or null if <paramref name="fromExpression"/> is null or cannot be converted to <see cref="MethodCallExpression"/>.</returns>
/// <remarks></remarks>
public static MethodInfo GetMethodInfo<T>(Expression<Action<T>> fromExpression)
{
if (fromExpression == null) return null;
var body = fromExpression.Body as MethodCallExpression;
return body != null ? body.Method : null;
}
/// <summary>
/// Gets the method info.
/// </summary>
/// <typeparam name="TReturn">The return type of the method.</typeparam>
/// <param name="fromExpression">From expression.</param>
/// <returns></returns>
public static MethodInfo GetMethodInfo<TReturn>(Expression<Func<TReturn>> fromExpression)
{
if (fromExpression == null) return null;
var body = fromExpression.Body as MethodCallExpression;
return body != null ? body.Method : null;
}
/// <summary>
/// Gets the method info.
/// </summary>
/// <typeparam name="T1">The type of the 1.</typeparam>
/// <typeparam name="T2">The type of the 2.</typeparam>
/// <param name="fromExpression">From expression.</param>
/// <returns></returns>
public static MethodInfo GetMethodInfo<T1, T2>(Expression<Func<T1, T2>> fromExpression)
{
if (fromExpression == null) return null;
var body = fromExpression.Body as MethodCallExpression;
return body != null ? body.Method : null;
}
/// <summary>
/// Gets a <see cref="MethodInfo"/> from an <see cref="Expression"/> provided it refers to a method call.
/// </summary>
/// <param name="expression">The expression.</param>
/// <returns>The <see cref="MethodInfo"/> or null if <paramref name="expression"/> cannot be converted to <see cref="MethodCallExpression"/>.</returns>
/// <remarks></remarks>
public static MethodInfo GetMethod(Expression expression)
{
if (expression == null) return null;
return IsMethod(expression) ? (((MethodCallExpression)expression).Method) : null;
}
/// <summary>
/// Gets a <see cref="MemberInfo"/> from an <see cref="Expression{Func{T, TReturn}}"/> provided it refers to member access.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <typeparam name="TReturn">The type of the return.</typeparam>
/// <param name="fromExpression">From expression.</param>
/// <returns>The <see cref="MemberInfo"/> or null if <paramref name="fromExpression"/> cannot be converted to <see cref="MemberExpression"/>.</returns>
/// <remarks></remarks>
public static MemberInfo GetMemberInfo<T, TReturn>(Expression<Func<T, TReturn>> fromExpression)
{
if (fromExpression == null) return null;
var body = fromExpression.Body as MemberExpression;
return body != null ? body.Member : null;
}
/// <summary>
/// Determines whether the MethodInfo is the same based on signature, not based on the equality operator or HashCode.
/// </summary>
/// <param name="left">The left.</param>
/// <param name="right">The right.</param>
/// <returns>
/// <c>true</c> if [is method signature equal to] [the specified left]; otherwise, <c>false</c>.
/// </returns>
/// <remarks>
/// This is useful for comparing Expression methods that may contain different generic types
/// </remarks>
public static bool IsMethodSignatureEqualTo(this MethodInfo left, MethodInfo right)
{
if (left.Equals(right))
return true;
if (left.DeclaringType != right.DeclaringType)
return false;
if (left.Name != right.Name)
return false;
var leftParams = left.GetParameters();
var rightParams = right.GetParameters();
if (leftParams.Length != rightParams.Length)
return false;
for (int i = 0; i < leftParams.Length; i++)
{
//if they are delegate parameters, then assume they match as they could be anything
if (typeof(Delegate).IsAssignableFrom(leftParams[i].ParameterType) && typeof(Delegate).IsAssignableFrom(rightParams[i].ParameterType))
continue;
//if they are not delegates, then compare the types
if (leftParams[i].ParameterType != rightParams[i].ParameterType)
return false;
}
if (left.ReturnType != right.ReturnType)
return false;
return true;
}
/// <summary>
/// Gets a <see cref="MemberInfo"/> from an <see cref="Expression"/> provided it refers to member access.
/// </summary>
/// <param name="expression">The expression.</param>
/// <returns></returns>
/// <remarks></remarks>
public static MemberInfo GetMember(Expression expression)
{
if (expression == null) return null;
return IsMember(expression) ? (((MemberExpression)expression).Member) : null;
}
/// <summary>
/// Gets a <see cref="MethodInfo"/> from a <see cref="Delegate"/>
/// </summary>
/// <param name="fromMethodGroup">From method group.</param>
/// <returns></returns>
/// <remarks></remarks>
public static MethodInfo GetStaticMethodInfo(Delegate fromMethodGroup)
{
if (fromMethodGroup == null) throw new ArgumentNullException("fromMethodGroup");
return fromMethodGroup.Method;
}
///// <summary>
///// Formats an unhandled item for representing the expression as a string.
///// </summary>
///// <typeparam name="T"></typeparam>
///// <param name="unhandledItem">The unhandled item.</param>
///// <returns></returns>
///// <remarks></remarks>
//public static string FormatUnhandledItem<T>(T unhandledItem) where T : class
//{
// if (unhandledItem == null) throw new ArgumentNullException("unhandledItem");
// var itemAsExpression = unhandledItem as Expression;
// return itemAsExpression != null
// ? FormattingExpressionTreeVisitor.Format(itemAsExpression)
// : unhandledItem.ToString();
//}
/// <summary>
/// Determines whether the specified expression is a method.
/// </summary>
/// <param name="expression">The expression.</param>
/// <returns><c>true</c> if the specified expression is method; otherwise, <c>false</c>.</returns>
/// <remarks></remarks>
public static bool IsMethod(Expression expression)
{
return expression != null && typeof(MethodCallExpression).IsAssignableFrom(expression.GetType());
}
/// <summary>
/// Determines whether the specified expression is a member.
/// </summary>
/// <param name="expression">The expression.</param>
/// <returns><c>true</c> if the specified expression is member; otherwise, <c>false</c>.</returns>
/// <remarks></remarks>
public static bool IsMember(Expression expression)
{
return expression != null && typeof(MemberExpression).IsAssignableFrom(expression.GetType());
}
/// <summary>
/// Determines whether the specified expression is a constant.
/// </summary>
/// <param name="expression">The expression.</param>
/// <returns><c>true</c> if the specified expression is constant; otherwise, <c>false</c>.</returns>
/// <remarks></remarks>
public static bool IsConstant(Expression expression)
{
return expression != null && typeof(ConstantExpression).IsAssignableFrom(expression.GetType());
}
/// <summary>
/// Gets the first value from the supplied arguments of an expression, for those arguments that can be cast to <see cref="ConstantExpression"/>.
/// </summary>
/// <param name="arguments">The arguments.</param>
/// <returns></returns>
/// <remarks></remarks>
public static object GetFirstValueFromArguments(IEnumerable<Expression> arguments)
{
if (arguments == null) return false;
return
arguments.Where(x => typeof(ConstantExpression).IsAssignableFrom(x.GetType())).Cast
<ConstantExpression>().Select(x => x.Value).DefaultIfEmpty(null).FirstOrDefault();
}
}
}
+94
View File
@@ -0,0 +1,94 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
namespace Umbraco.Core
{
/// <summary>
/// Used to create a hash code from multiple objects.
/// </summary>
/// <remarks>
/// .Net has a class the same as this: System.Web.Util.HashCodeCombiner and of course it works for all sorts of things
/// which we've not included here as we just need a quick easy class for this in order to create a unique
/// hash of directories/files to see if they have changed.
/// </remarks>
internal class HashCodeCombiner
{
private long _combinedHash = 5381L;
internal void AddInt(int i)
{
_combinedHash = ((_combinedHash << 5) + _combinedHash) ^ i;
}
internal void AddObject(object o)
{
AddInt(o.GetHashCode());
}
internal void AddDateTime(DateTime d)
{
AddInt(d.GetHashCode());
}
internal void AddCaseInsensitiveString(string s)
{
if (s != null)
AddInt((StringComparer.InvariantCultureIgnoreCase).GetHashCode(s));
}
internal void AddFileSystemItem(FileSystemInfo f)
{
//if it doesn't exist, don't proceed.
if (!f.Exists)
return;
AddCaseInsensitiveString(f.FullName);
AddDateTime(f.CreationTimeUtc);
AddDateTime(f.LastWriteTimeUtc);
//check if it is a file or folder
var fileInfo = f as FileInfo;
if (fileInfo != null)
{
AddInt(fileInfo.Length.GetHashCode());
}
var dirInfo = f as DirectoryInfo;
if (dirInfo != null)
{
foreach (var d in dirInfo.GetFiles())
{
AddFile(d);
}
foreach (var s in dirInfo.GetDirectories())
{
AddFolder(s);
}
}
}
internal void AddFile(FileInfo f)
{
AddFileSystemItem(f);
}
internal void AddFolder(DirectoryInfo d)
{
AddFileSystemItem(d);
}
/// <summary>
/// Returns the hex code of the combined hash code
/// </summary>
/// <returns></returns>
internal string GetCombinedHashCode()
{
return _combinedHash.ToString("x", CultureInfo.InvariantCulture);
}
}
}
+31
View File
@@ -0,0 +1,31 @@
using System;
namespace Umbraco.Core
{
/// <summary>
/// A bootstrapper interface for the Umbraco application
/// </summary>
internal interface IBootManager
{
/// <summary>
/// Fires first in the application startup process before any customizations can occur
/// </summary>
/// <returns></returns>
IBootManager Initialize();
/// <summary>
/// Fires after initialization and calls the callback to allow for customizations to occur
/// </summary>
/// <param name="afterStartup"></param>
/// <returns></returns>
IBootManager Startup(Action<ApplicationContext> afterStartup);
/// <summary>
/// Fires after startup and calls the callback once customizations are locked
/// </summary>
/// <param name="afterComplete"></param>
/// <returns></returns>
IBootManager Complete(Action<ApplicationContext> afterComplete);
}
}
@@ -2,11 +2,14 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Umbraco.Core.CodeAnnotations;
namespace Umbraco.Core.IO
{
public static class IFileSystemExtensions
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
public static class FileSystemExtensions
{
[UmbracoExperimentalFeature("", "Will be declared public after 4.10")]
internal static long GetSize(this IFileSystem fs, string path)
{
var s = fs.OpenFile(path);
@@ -16,6 +19,7 @@ namespace Umbraco.Core.IO
return size;
}
[UmbracoExperimentalFeature("", "Will be declared public after 4.10")]
internal static void CopyFile(this IFileSystem fs, string path, string newPath)
{
fs.AddFile(newPath, fs.OpenFile(path));
@@ -2,9 +2,11 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Umbraco.Core.CodeAnnotations;
namespace Umbraco.Core.IO
{
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
internal class FileSystemProvider
{
public const string Media = "media";
@@ -2,10 +2,12 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Umbraco.Core.CodeAnnotations;
namespace Umbraco.Core.IO
{
[AttributeUsage(AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
internal class FileSystemProviderAttribute : Attribute
{
public string Alias { get; set; }
@@ -1,12 +1,16 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Reflection;
using System.Text;
using Umbraco.Core.CodeAnnotations;
using Umbraco.Core.Configuration;
namespace Umbraco.Core.IO
{
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
internal class FileSystemProviderManager
{
private readonly FileSystemProvidersSection _config;
@@ -31,44 +35,85 @@ namespace Umbraco.Core.IO
#endregion
/// <summary>
/// used to cache the lookup of how to construct this object so we don't have to reflect each time.
/// </summary>
private class ProviderConstructionInfo
{
public object[] Parameters { get; set; }
public ConstructorInfo Constructor { get; set; }
public string ProviderAlias { get; set; }
}
private readonly ConcurrentDictionary<string, ProviderConstructionInfo> _providerLookup = new ConcurrentDictionary<string, ProviderConstructionInfo>();
private readonly ConcurrentDictionary<Type, string> _wrappedProviderLookup = new ConcurrentDictionary<Type, string>();
public IFileSystem GetFileSystemProvider(string alias)
{
var providerConfig = _config.Providers[alias];
if(providerConfig == null)
throw new ArgumentException(string.Format("No provider found with the alias '{0}'", alias));
//either get the constructor info from cache or create it and add to cache
var ctorInfo = _providerLookup.GetOrAdd(alias, s =>
{
var providerConfig = _config.Providers[s];
if (providerConfig == null)
throw new ArgumentException(string.Format("No provider found with the alias '{0}'", s));
var providerType = Type.GetType(providerConfig.Type);
if(providerType == null)
throw new InvalidOperationException(string.Format("Could not find type '{0}'", providerConfig.Type));
var providerType = Type.GetType(providerConfig.Type);
if (providerType == null)
throw new InvalidOperationException(string.Format("Could not find type '{0}'", providerConfig.Type));
if (providerType.IsAssignableFrom(typeof(IFileSystem)))
throw new InvalidOperationException(string.Format("The type '{0}' does not implement IFileSystem", providerConfig.Type));
if (providerType.IsAssignableFrom(typeof (IFileSystem)))
throw new InvalidOperationException(string.Format("The type '{0}' does not implement IFileSystem", providerConfig.Type));
var paramCount = providerConfig.Parameters != null ? providerConfig.Parameters.Count : 0;
var constructor = providerType.GetConstructors()
.SingleOrDefault(x => x.GetParameters().Count() == paramCount
&& x.GetParameters().All(y => providerConfig.Parameters.AllKeys.Contains(y.Name)));
if(constructor == null)
throw new InvalidOperationException(string.Format("Could not find constructor for type '{0}' which accepts {1} parameters", providerConfig.Type, paramCount));
var paramCount = providerConfig.Parameters != null ? providerConfig.Parameters.Count : 0;
var constructor = providerType.GetConstructors()
.SingleOrDefault(x => x.GetParameters().Count() == paramCount
&& x.GetParameters().All(y => providerConfig.Parameters.AllKeys.Contains(y.Name)));
if (constructor == null)
throw new InvalidOperationException(string.Format("Could not find constructor for type '{0}' which accepts {1} parameters", providerConfig.Type, paramCount));
var parameters = new object[paramCount];
for(var i = 0; i < paramCount; i++)
parameters[i] = providerConfig.Parameters[providerConfig.Parameters.AllKeys[i]].Value;
var parameters = new object[paramCount];
for (var i = 0; i < paramCount; i++)
parameters[i] = providerConfig.Parameters[providerConfig.Parameters.AllKeys[i]].Value;
return (IFileSystem) constructor.Invoke(parameters);
//return the new constructor info class to cache so we don't have to do this again.
return new ProviderConstructionInfo()
{
Constructor = constructor,
Parameters = parameters,
ProviderAlias = s
};
});
var fs = (IFileSystem)ctorInfo.Constructor.Invoke(ctorInfo.Parameters);
return fs;
}
public TProviderTypeFilter GetFileSystemProvider<TProviderTypeFilter>()
where TProviderTypeFilter : class, IFileSystem
where TProviderTypeFilter : FileSystemWrapper
{
var attr =
(FileSystemProviderAttribute)typeof(TProviderTypeFilter).GetCustomAttributes(typeof(FileSystemProviderAttribute), false).
SingleOrDefault();
//get the alias for the type from cache or look it up and add it to the cache, then we don't have to reflect each time
var alias = _wrappedProviderLookup.GetOrAdd(typeof (TProviderTypeFilter), fsType =>
{
//validate the ctor
var constructor = fsType.GetConstructors()
.SingleOrDefault(x =>
x.GetParameters().Count() == 1 && TypeHelper.IsTypeAssignableFrom<IFileSystem>(x.GetParameters().Single().ParameterType));
if (constructor == null)
throw new InvalidOperationException("The type of " + fsType + " must inherit from FileSystemWrapper and must have a constructor that accepts one parameter of type " + typeof(IFileSystem));
if (attr == null)
throw new InvalidOperationException(string.Format("The provider type filter '{0}' is missing the required FileSystemProviderAttribute", typeof(FileSystemProviderAttribute).FullName));
var attr =
(FileSystemProviderAttribute)fsType.GetCustomAttributes(typeof(FileSystemProviderAttribute), false).
SingleOrDefault();
return GetFileSystemProvider(attr.Alias).As<TProviderTypeFilter>();
if (attr == null)
throw new InvalidOperationException(string.Format("The provider type filter '{0}' is missing the required FileSystemProviderAttribute", typeof(FileSystemProviderAttribute).FullName));
return attr.Alias;
});
var innerFs = GetFileSystemProvider(alias);
var outputFs = Activator.CreateInstance(typeof (TProviderTypeFilter), innerFs);
return (TProviderTypeFilter)outputFs;
}
}
}
+108
View File
@@ -0,0 +1,108 @@
using System;
using System.Collections.Generic;
using System.IO;
using Umbraco.Core.CodeAnnotations;
namespace Umbraco.Core.IO
{
/// <summary>
/// All custom file systems that are based upon another IFileSystem should inherit from FileSystemWrapper
/// </summary>
/// <remarks>
/// An IFileSystem is generally used as a base file system, for example like a PhysicalFileSystem or an S3FileSystem.
/// Then, other custom file systems are wrapped upon these files systems like MediaFileSystem, etc... All of the custom
/// file systems must inherit from FileSystemWrapper.
///
/// This abstract class just wraps the 'real' IFileSystem object passed in to its constructor.
/// </remarks>
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
internal abstract class FileSystemWrapper : IFileSystem
{
private readonly IFileSystem _wrapped;
protected FileSystemWrapper(IFileSystem wrapped)
{
_wrapped = wrapped;
}
public IEnumerable<string> GetDirectories(string path)
{
return _wrapped.GetDirectories(path);
}
public void DeleteDirectory(string path)
{
_wrapped.DeleteDirectory(path);
}
public void DeleteDirectory(string path, bool recursive)
{
_wrapped.DeleteDirectory(path, recursive);
}
public bool DirectoryExists(string path)
{
return _wrapped.DirectoryExists(path);
}
public void AddFile(string path, Stream stream)
{
_wrapped.AddFile(path, stream);
}
public void AddFile(string path, Stream stream, bool overrideIfExists)
{
_wrapped.AddFile(path, stream, overrideIfExists);
}
public IEnumerable<string> GetFiles(string path)
{
return _wrapped.GetFiles(path);
}
public IEnumerable<string> GetFiles(string path, string filter)
{
return _wrapped.GetFiles(path, filter);
}
public Stream OpenFile(string path)
{
return _wrapped.OpenFile(path);
}
public void DeleteFile(string path)
{
_wrapped.DeleteFile(path);
}
public bool FileExists(string path)
{
return _wrapped.FileExists(path);
}
public string GetRelativePath(string fullPathOrUrl)
{
return _wrapped.GetRelativePath(fullPathOrUrl);
}
public string GetFullPath(string path)
{
return _wrapped.GetFullPath(path);
}
public string GetUrl(string path)
{
return _wrapped.GetUrl(path);
}
public DateTimeOffset GetLastModified(string path)
{
return _wrapped.GetLastModified(path);
}
public DateTimeOffset GetCreated(string path)
{
return _wrapped.GetCreated(path);
}
}
}
+2
View File
@@ -1,9 +1,11 @@
using System;
using System.Collections.Generic;
using System.IO;
using Umbraco.Core.CodeAnnotations;
namespace Umbraco.Core.IO
{
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
internal interface IFileSystem
{
IEnumerable<string> GetDirectories(string path);
-11
View File
@@ -1,11 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Umbraco.Core.IO
{
[FileSystemProvider("media")]
internal interface IMediaFileSystem : IFileSystem
{ }
}
+92 -45
View File
@@ -9,12 +9,14 @@ using System.Configuration;
using System.Web;
using System.Text.RegularExpressions;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
namespace Umbraco.Core.IO
{
internal static class IOHelper
public static class IOHelper
{
private static string _rootDir = "";
// static compiled regex for faster performance
private readonly static Regex ResolveUrlPattern = new Regex("(=[\"\']?)(\\W?\\~(?:.(?![\"\']?\\s+(?:\\S+)=|[>\"\']))+.)[\"\']?", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
@@ -49,46 +51,33 @@ namespace Umbraco.Core.IO
return VirtualPathUtility.ToAbsolute(virtualPath, SystemDirectories.Root);
}
public static string ResolveUrlsFromTextString(string text)
[Obsolete("Use Umbraco.Web.Templates.TemplateUtilities.ResolveUrlsFromTextString instead, this method on this class will be removed in future versions")]
internal static string ResolveUrlsFromTextString(string text)
{
if (UmbracoSettings.ResolveUrlsFromTextString)
{
var sw = new Stopwatch();
sw.Start();
Debug.WriteLine("Start: " + sw.ElapsedMilliseconds);
// find all relative urls (ie. urls that contain ~)
var tags =
ResolveUrlPattern.Matches(text);
Debug.WriteLine("After regex: " + sw.ElapsedMilliseconds);
foreach (Match tag in tags)
{
Debug.WriteLine("-- inside regex: " + sw.ElapsedMilliseconds);
string url = "";
if (tag.Groups[1].Success)
url = tag.Groups[1].Value;
// The richtext editor inserts a slash in front of the url. That's why we need this little fix
// if (url.StartsWith("/"))
// text = text.Replace(url, ResolveUrl(url.Substring(1)));
// else
if (!String.IsNullOrEmpty(url))
{
Debug.WriteLine("---- before resolve: " + sw.ElapsedMilliseconds);
string resolvedUrl = (url.Substring(0, 1) == "/") ? ResolveUrl(url.Substring(1)) : ResolveUrl(url);
Debug.WriteLine("---- after resolve: " + sw.ElapsedMilliseconds);
Debug.WriteLine("---- before replace: " + sw.ElapsedMilliseconds);
text = text.Replace(url, resolvedUrl);
Debug.WriteLine("---- after replace: " + sw.ElapsedMilliseconds);
}
}
Debug.WriteLine("total: " + sw.ElapsedMilliseconds);
sw.Stop();
Debug.WriteLine("Resolve Urls", sw.ElapsedMilliseconds.ToString());
{
using (var timer = DisposableTimer.DebugDuration(typeof(IOHelper), "ResolveUrlsFromTextString starting", "ResolveUrlsFromTextString complete"))
{
// find all relative urls (ie. urls that contain ~)
var tags = ResolveUrlPattern.Matches(text);
LogHelper.Debug(typeof(IOHelper), "After regex: " + timer.Stopwatch.ElapsedMilliseconds + " matched: " + tags.Count);
foreach (Match tag in tags)
{
string url = "";
if (tag.Groups[1].Success)
url = tag.Groups[1].Value;
// The richtext editor inserts a slash in front of the url. That's why we need this little fix
// if (url.StartsWith("/"))
// text = text.Replace(url, ResolveUrl(url.Substring(1)));
// else
if (!String.IsNullOrEmpty(url))
{
string resolvedUrl = (url.Substring(0, 1) == "/") ? ResolveUrl(url.Substring(1)) : ResolveUrl(url);
text = text.Replace(url, resolvedUrl);
}
}
}
}
return text;
}
@@ -96,7 +85,7 @@ namespace Umbraco.Core.IO
public static string MapPath(string path, bool useHttpContext)
{
// Check if the path is already mapped
if (path.Length >= 2 && path[1] == Path.VolumeSeparatorChar)
if ((path.Length >= 2 && path[1] == Path.VolumeSeparatorChar) || path.StartsWith("\\"))
return path;
// Check that we even have an HttpContext! otherwise things will fail anyways
@@ -128,7 +117,7 @@ namespace Umbraco.Core.IO
}
//use a tilde character instead of the complete path
public static string ReturnPath(string settingsKey, string standardPath, bool useTilde)
internal static string ReturnPath(string settingsKey, string standardPath, bool useTilde)
{
string retval = ConfigurationManager.AppSettings[settingsKey];
@@ -138,21 +127,19 @@ namespace Umbraco.Core.IO
return retval.TrimEnd('/');
}
public static string ReturnPath(string settingsKey, string standardPath)
internal static string ReturnPath(string settingsKey, string standardPath)
{
return ReturnPath(settingsKey, standardPath, false);
}
/// <summary>
/// Validates if the current filepath matches a directory where the user is allowed to edit a file
/// </summary>
/// <param name="filePath">filepath </param>
/// <param name="validDir"></param>
/// <returns>true if valid, throws a FileSecurityException if not</returns>
public static bool ValidateEditPath(string filePath, string validDir)
internal static bool ValidateEditPath(string filePath, string validDir)
{
if (!filePath.StartsWith(MapPath(SystemDirectories.Root)))
filePath = MapPath(filePath);
@@ -165,7 +152,24 @@ namespace Umbraco.Core.IO
return true;
}
public static bool ValidateFileExtension(string filePath, List<string> validFileExtensions)
internal static bool ValidateEditPath(string filePath, IEnumerable<string> validDirs)
{
foreach (var dir in validDirs)
{
var validDir = dir;
if (!filePath.StartsWith(MapPath(SystemDirectories.Root)))
filePath = MapPath(filePath);
if (!validDir.StartsWith(MapPath(SystemDirectories.Root)))
validDir = MapPath(validDir);
if (filePath.StartsWith(validDir))
return true;
}
throw new FileSecurityException(String.Format("The filepath '{0}' is not within an allowed directory for this type of files", filePath.Replace(MapPath(SystemDirectories.Root), "")));
}
internal static bool ValidateFileExtension(string filePath, List<string> validFileExtensions)
{
if (!filePath.StartsWith(MapPath(SystemDirectories.Root)))
filePath = MapPath(filePath);
@@ -202,5 +206,48 @@ namespace Umbraco.Core.IO
}
/// <summary>
/// Check to see if filename passed has any special chars in it and strips them to create a safe filename. Used to overcome an issue when Umbraco is used in IE in an intranet environment.
/// </summary>
/// <param name="filePath">The filename passed to the file handler from the upload field.</param>
/// <returns>A safe filename without any path specific chars.</returns>
internal static string SafeFileName(string filePath)
{
if (String.IsNullOrEmpty(filePath))
return String.Empty;
if (!String.IsNullOrWhiteSpace(filePath))
{
foreach (var character in Path.GetInvalidFileNameChars())
{
filePath = filePath.Replace(character, '-');
}
}
else
{
filePath = String.Empty;
}
// Adapted from: http://stackoverflow.com/a/4827510/5018
// Combined both Reserved Characters and Character Data
// from http://en.wikipedia.org/wiki/Percent-encoding
var stringBuilder = new StringBuilder();
const string reservedCharacters = "!*'();:@&=+$,/?%#[]-~{}\"<>\\^`| ";
foreach (var character in filePath)
{
if (reservedCharacters.IndexOf(character) == -1)
stringBuilder.Append(character);
else
stringBuilder.Append("-");
}
// Remove repeating dashes
// From: http://stackoverflow.com/questions/5111967/regex-to-remove-a-specific-repeated-character
var reducedString = Regex.Replace(stringBuilder.ToString(), "-+", "-");
return reducedString;
}
}
}
+57
View File
@@ -0,0 +1,57 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Umbraco.Core.CodeAnnotations;
using Umbraco.Core.Configuration;
namespace Umbraco.Core.IO
{
/// <summary>
/// A custom file system provider for media
/// </summary>
[FileSystemProvider("media")]
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
internal class MediaFileSystem : FileSystemWrapper
{
public MediaFileSystem(IFileSystem wrapped)
: base(wrapped)
{
}
public string GetRelativePath(int propertyId, string fileName)
{
var seperator = UmbracoSettings.UploadAllowDirectories
? Path.DirectorySeparatorChar
: '-';
return propertyId.ToString() + seperator + fileName;
}
public IEnumerable<string> GetThumbnails(string path)
{
var parentDirectory = System.IO.Path.GetDirectoryName(path);
var extension = System.IO.Path.GetExtension(path);
return GetFiles(parentDirectory)
.Where(x => x.StartsWith(path.TrimEnd(extension) + "_thumb"))
.ToList();
}
public void DeleteFile(string path, bool deleteThumbnails)
{
DeleteFile(path);
if (!deleteThumbnails)
return;
DeleteThumbnails(path);
}
public void DeleteThumbnails(string path)
{
GetThumbnails(path)
.ForEach(DeleteFile);
}
}
}
@@ -1,47 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Umbraco.Core.Configuration;
namespace Umbraco.Core.IO
{
public static class MediaFileSystemExtensions
{
internal static string GetRelativePath(this IMediaFileSystem fs, int propertyId, string fileName)
{
var seperator = UmbracoSettings.UploadAllowDirectories
? Path.DirectorySeparatorChar
: '-';
return propertyId.ToString() + seperator + fileName;
}
internal static IEnumerable<string> GetThumbnails(this IMediaFileSystem fs, string path)
{
var parentDirectory = System.IO.Path.GetDirectoryName(path);
var extension = System.IO.Path.GetExtension(path);
return fs.GetFiles(parentDirectory)
.Where(x => x.StartsWith(path.TrimEnd(extension) + "_thumb"))
.ToList();
}
internal static void DeleteFile(this IMediaFileSystem fs, string path, bool deleteThumbnails)
{
fs.DeleteFile(path);
if(!deleteThumbnails)
return;
fs.DeleteThumbnails(path);
}
internal static void DeleteThumbnails(this IMediaFileSystem fs, string path)
{
fs.GetThumbnails(path)
.ForEach(fs.DeleteFile);
}
}
}
+25 -12
View File
@@ -1,12 +1,15 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using Umbraco.Core.CodeAnnotations;
using Umbraco.Core.Logging;
namespace Umbraco.Core.IO
{
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
internal class PhysicalFileSystem : IFileSystem
{
private readonly string _rootPath;
@@ -40,9 +43,13 @@ namespace Umbraco.Core.IO
return Directory.EnumerateDirectories(path).Select(GetRelativePath);
}
catch (UnauthorizedAccessException ex)
{ }
{
LogHelper.Error<PhysicalFileSystem>("Not authorized to get directories", ex);
}
catch (DirectoryNotFoundException ex)
{ }
{
LogHelper.Error<PhysicalFileSystem>("Directory not found", ex);
}
return Enumerable.Empty<string>();
}
@@ -62,7 +69,9 @@ namespace Umbraco.Core.IO
Directory.Delete(GetFullPath(path), recursive);
}
catch (DirectoryNotFoundException ex)
{ }
{
LogHelper.Error<PhysicalFileSystem>("Directory not found", ex);
}
}
public bool DirectoryExists(string path)
@@ -77,9 +86,7 @@ namespace Umbraco.Core.IO
public void AddFile(string path, Stream stream, bool overrideIfExists)
{
if (FileExists(path) && !overrideIfExists)
throw new InvalidOperationException(string.Format("A file at path '{0}' already exists",
path));
if (FileExists(path) && !overrideIfExists) throw new InvalidOperationException(string.Format("A file at path '{0}' already exists", path));
EnsureDirectory(Path.GetDirectoryName(path));
@@ -105,9 +112,13 @@ namespace Umbraco.Core.IO
return Directory.EnumerateFiles(path, filter).Select(GetRelativePath);
}
catch (UnauthorizedAccessException ex)
{ }
{
LogHelper.Error<PhysicalFileSystem>("Not authorized to get directories", ex);
}
catch (DirectoryNotFoundException ex)
{ }
{
LogHelper.Error<PhysicalFileSystem>("Directory not found", ex);
}
return Enumerable.Empty<string>();
}
@@ -127,7 +138,9 @@ namespace Umbraco.Core.IO
File.Delete(GetFullPath(path));
}
catch (FileNotFoundException ex)
{ }
{
LogHelper.Error<PhysicalFileSystem>("File not found", ex);
}
}
public bool FileExists(string path)
@@ -185,7 +198,7 @@ namespace Umbraco.Core.IO
protected string EnsureTrailingSeparator(string path)
{
if (!path.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal))
if (!path.EndsWith(Path.DirectorySeparatorChar.ToString(CultureInfo.InvariantCulture), StringComparison.Ordinal))
path = path + Path.DirectorySeparatorChar;
return path;
+22 -2
View File
@@ -10,8 +10,9 @@ using System.IO;
namespace Umbraco.Core.IO
{
//all paths has a starting but no trailing /
internal class SystemDirectories
public class SystemDirectories
{
//TODO: Why on earth is this even configurable? You cannot change the /Bin folder in ASP.Net
public static string Bin
{
get
@@ -68,6 +69,24 @@ namespace Umbraco.Core.IO
}
}
public static string AppPlugins
{
get
{
//NOTE: this is not configurable and shouldn't need to be
return "~/App_Plugins";
}
}
public static string MvcViews
{
get
{
//NOTE: this is not configurable and shouldn't need to be
return "~/Views";
}
}
public static string Media
{
@@ -77,8 +96,9 @@ namespace Umbraco.Core.IO
}
}
//have changed to internal so nobody uses this anymore since this is a new class.
[Obsolete("Please use MacroScripts instead!", true)]
public static string Python
internal static string Python
{
get
{
+3 -3
View File
@@ -8,7 +8,7 @@ using System.Web;
namespace Umbraco.Core.IO
{
internal class SystemFiles
public class SystemFiles
{
public static string AccessXml
@@ -96,7 +96,7 @@ namespace Umbraco.Core.IO
{
get
{
if (ContentCacheXmlIsEphemeral)
if (ContentCacheXmlIsEphemeral && SystemUtilities.GetCurrentTrustLevel() == AspNetHostingPermissionLevel.Unrestricted)
{
return Path.Combine(HttpRuntime.CodegenDir, @"UmbracoData\umbraco.config");
}
@@ -104,7 +104,7 @@ namespace Umbraco.Core.IO
}
}
public static bool ContentCacheXmlIsEphemeral
internal static bool ContentCacheXmlIsEphemeral
{
get
{
-14
View File
@@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Umbraco.Core
{
internal interface IThumbnailProvider
{
int Priority { get; }
bool CanProvideThumbnail(string fileUrl);
string GetThumbnailUrl(string fileUrl);
}
}
+20
View File
@@ -0,0 +1,20 @@
using System;
namespace Umbraco.Core
{
public static class IntExtensions
{
/// <summary>
/// Does something 'x' amount of times
/// </summary>
/// <param name="n"></param>
/// <param name="action"></param>
public static void Times(this int n, Action<int> action)
{
for (int i = 0; i < n; i++)
{
action(i);
}
}
}
}
@@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
namespace Umbraco.Core
{
/// <summary>
/// Represents a simple <see cref="LambdaExpression"/> in a form which is suitable for using as a dictionary key
/// by exposing the return type, argument types and expression string form in a single concatenated string.
/// </summary>
internal struct LambdaExpressionCacheKey
{
public LambdaExpressionCacheKey(string returnType, string expression, params string[] argTypes)
{
ReturnType = returnType;
ExpressionAsString = expression;
ArgTypes = new HashSet<string>(argTypes);
_toString = null;
}
public LambdaExpressionCacheKey(LambdaExpression obj)
{
ReturnType = obj.ReturnType.FullName;
ExpressionAsString = obj.ToString();
ArgTypes = new HashSet<string>(obj.Parameters.Select(x => x.Type.FullName));
_toString = null;
}
/// <summary>
/// The argument type names of the <see cref="LambdaExpression"/>
/// </summary>
public readonly HashSet<string> ArgTypes;
/// <summary>
/// The return type of the <see cref="LambdaExpression"/>
/// </summary>
public readonly string ReturnType;
/// <summary>
/// The original string representation of the <see cref="LambdaExpression"/>
/// </summary>
public readonly string ExpressionAsString;
private string _toString;
/// <summary>
/// Returns a <see cref="System.String"/> that represents this instance.
/// </summary>
/// <returns>
/// A <see cref="System.String"/> that represents this instance.
/// </returns>
public override string ToString()
{
return _toString ?? (_toString = String.Concat(String.Join("|", ArgTypes), ",", ReturnType, ",", ExpressionAsString));
}
/// <summary>
/// Determines whether the specified <see cref="System.Object"/> is equal to this instance.
/// </summary>
/// <param name="obj">The <see cref="System.Object"/> to compare with this instance.</param>
/// <returns>
/// <c>true</c> if the specified <see cref="System.Object"/> is equal to this instance; otherwise, <c>false</c>.
/// </returns>
public override bool Equals(object obj)
{
if (ReferenceEquals(obj, null)) return false;
var casted = (LambdaExpressionCacheKey)obj;
return casted.ToString() == ToString();
}
/// <summary>
/// Returns a hash code for this instance.
/// </summary>
/// <returns>
/// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
/// </returns>
public override int GetHashCode()
{
return ToString().GetHashCode();
}
}
}
@@ -0,0 +1,271 @@
using System;
using System.Security.Principal;
using System.Threading;
using System.Threading.Tasks;
using log4net.Appender;
using log4net.Core;
using log4net.Util;
namespace Umbraco.Core.Logging
{
/// <summary>
/// Based on code by Chris Haines http://cjbhaines.wordpress.com/2012/02/13/asynchronous-log4net-appenders/
/// </summary>
public class AsynchronousRollingFileAppender : RollingFileAppender
{
private readonly ManualResetEvent _manualResetEvent;
private int _bufferOverflowCounter;
private bool _forceStop;
private bool _hasFinished;
private DateTime _lastLoggedBufferOverflow;
private bool _logBufferOverflow;
private RingBuffer<LoggingEvent> _pendingAppends;
private int _queueSizeLimit = 1000;
private bool _shuttingDown;
public AsynchronousRollingFileAppender()
{
_manualResetEvent = new ManualResetEvent(false);
}
public int QueueSizeLimit
{
get { return _queueSizeLimit; }
set { _queueSizeLimit = value; }
}
public override void ActivateOptions()
{
base.ActivateOptions();
_pendingAppends = new RingBuffer<LoggingEvent>(QueueSizeLimit);
_pendingAppends.BufferOverflow += OnBufferOverflow;
StartAppendTask();
}
protected override void Append(LoggingEvent[] loggingEvents)
{
Array.ForEach(loggingEvents, Append);
}
protected override void Append(LoggingEvent loggingEvent)
{
if (FilterEvent(loggingEvent))
{
_pendingAppends.Enqueue(loggingEvent);
}
}
protected override void OnClose()
{
_shuttingDown = true;
_manualResetEvent.WaitOne(TimeSpan.FromSeconds(5));
if (!_hasFinished)
{
_forceStop = true;
var windowsIdentity = WindowsIdentity.GetCurrent();
base.Append(new LoggingEvent(new LoggingEventData
{
Level = Level.Error,
Message =
"Unable to clear out the AsynchronousRollingFileAppender buffer in the allotted time, forcing a shutdown",
TimeStamp = DateTime.UtcNow,
Identity = "",
ExceptionString = "",
UserName = windowsIdentity != null ? windowsIdentity.Name : "",
Domain = AppDomain.CurrentDomain.FriendlyName,
ThreadName = Thread.CurrentThread.ManagedThreadId.ToString(),
LocationInfo =
new LocationInfo(this.GetType().Name, "OnClose", "AsynchronousRollingFileAppender.cs", "59"),
LoggerName = this.GetType().FullName,
Properties = new PropertiesDictionary(),
})
);
}
base.OnClose();
}
private void StartAppendTask()
{
if (!_shuttingDown)
{
Task appendTask = new Task(AppendLoggingEvents, TaskCreationOptions.LongRunning);
appendTask.LogErrors(LogAppenderError).ContinueWith(x => StartAppendTask()).LogErrors(LogAppenderError);
appendTask.Start();
}
}
private void LogAppenderError(string logMessage, Exception exception)
{
var windowsIdentity = WindowsIdentity.GetCurrent();
base.Append(new LoggingEvent(new LoggingEventData
{
Level = Level.Error,
Message = "Appender exception: " + logMessage,
TimeStamp = DateTime.UtcNow,
Identity = "",
ExceptionString = exception.ToString(),
UserName = windowsIdentity != null ? windowsIdentity.Name : "",
Domain = AppDomain.CurrentDomain.FriendlyName,
ThreadName = Thread.CurrentThread.ManagedThreadId.ToString(),
LocationInfo =
new LocationInfo(this.GetType().Name,
"LogAppenderError",
"AsynchronousRollingFileAppender.cs",
"100"),
LoggerName = this.GetType().FullName,
Properties = new PropertiesDictionary(),
}));
}
private void AppendLoggingEvents()
{
LoggingEvent loggingEventToAppend;
while (!_shuttingDown)
{
if (_logBufferOverflow)
{
LogBufferOverflowError();
_logBufferOverflow = false;
_bufferOverflowCounter = 0;
_lastLoggedBufferOverflow = DateTime.UtcNow;
}
while (!_pendingAppends.TryDequeue(out loggingEventToAppend))
{
Thread.Sleep(10);
if (_shuttingDown)
{
break;
}
}
if (loggingEventToAppend == null)
{
continue;
}
try
{
base.Append(loggingEventToAppend);
}
catch
{
}
}
while (_pendingAppends.TryDequeue(out loggingEventToAppend) && !_forceStop)
{
try
{
base.Append(loggingEventToAppend);
}
catch
{
}
}
_hasFinished = true;
_manualResetEvent.Set();
}
private void LogBufferOverflowError()
{
var windowsIdentity = WindowsIdentity.GetCurrent();
base.Append(new LoggingEvent(new LoggingEventData
{
Level = Level.Error,
Message =
string.Format(
"Buffer overflow. {0} logging events have been lost in the last 30 seconds. [QueueSizeLimit: {1}]",
_bufferOverflowCounter,
QueueSizeLimit),
TimeStamp = DateTime.UtcNow,
Identity = "",
ExceptionString = "",
UserName = windowsIdentity != null ? windowsIdentity.Name : "",
Domain = AppDomain.CurrentDomain.FriendlyName,
ThreadName = Thread.CurrentThread.ManagedThreadId.ToString(),
LocationInfo =
new LocationInfo(this.GetType().Name,
"LogBufferOverflowError",
"AsynchronousRollingFileAppender.cs",
"172"),
LoggerName = this.GetType().FullName,
Properties = new PropertiesDictionary(),
}));
}
private void OnBufferOverflow(object sender, EventArgs eventArgs)
{
_bufferOverflowCounter++;
if (_logBufferOverflow == false)
{
if (_lastLoggedBufferOverflow < DateTime.UtcNow.AddSeconds(-30))
{
_logBufferOverflow = true;
}
}
}
private class RingBuffer<T>
{
private readonly object _lockObject = new object();
private readonly T[] _buffer;
private readonly int _size;
private int _readIndex = 0;
private int _writeIndex = 0;
private bool _bufferFull = false;
public event Action<object, EventArgs> BufferOverflow;
public RingBuffer(int size)
{
this._size = size;
_buffer = new T[size];
}
public void Enqueue(T item)
{
lock (_lockObject)
{
_buffer[_writeIndex] = item;
_writeIndex = (++_writeIndex) % _size;
if (_bufferFull)
{
if (BufferOverflow != null)
{
BufferOverflow(this, EventArgs.Empty);
}
_readIndex = _writeIndex;
}
else if (_writeIndex == _readIndex)
{
_bufferFull = true;
}
}
}
public bool TryDequeue(out T ret)
{
if (_readIndex == _writeIndex && !_bufferFull)
{
ret = default(T);
return false;
}
lock (_lockObject)
{
if (_readIndex == _writeIndex && !_bufferFull)
{
ret = default(T);
return false;
}
ret = _buffer[_readIndex];
_readIndex = (++_readIndex) % _size;
_bufferFull = false;
return true;
}
}
}
}
}
+261
View File
@@ -0,0 +1,261 @@
using System;
using System.Linq;
using System.Threading;
using System.Web;
using log4net;
namespace Umbraco.Core.Logging
{
///<summary>
/// Used for logging
///</summary>
internal static class LogHelper
{
///<summary>
/// Returns a logger for the type specified
///</summary>
///<typeparam name="T"></typeparam>
///<returns></returns>
public static ILog LoggerFor<T>()
{
return LogManager.GetLogger(typeof(T));
}
/// <summary>
/// Returns a logger for the object's type
/// </summary>
/// <param name="getTypeFromInstance"></param>
/// <returns></returns>
public static ILog LoggerFor(object getTypeFromInstance)
{
if (getTypeFromInstance == null) throw new ArgumentNullException("getTypeFromInstance");
return LogManager.GetLogger(getTypeFromInstance.GetType());
}
/// <summary>
/// Useful if the logger itself is running on another thread
/// </summary>
/// <param name="generateMessageFormat"></param>
/// <returns></returns>
private static string PrefixThreadId(string generateMessageFormat)
{
return "[Thread " + Thread.CurrentThread.ManagedThreadId + "] " + generateMessageFormat;
}
#region Error
/// <summary>
/// Adds an error log
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="message"></param>
/// <param name="exception"></param>
public static void Error<T>(string message, Exception exception)
{
var logger = LoggerFor<T>();
if (logger != null)
logger.Error(PrefixThreadId(message), exception);
}
#endregion
#region Warn
public static void Warn(Type callingType, string message, params Func<object>[] formatItems)
{
var logger = LogManager.GetLogger(callingType);
if (logger == null || !logger.IsWarnEnabled) return;
logger.WarnFormat(PrefixThreadId(message), formatItems.Select(x => x.Invoke()).ToArray());
}
public static void Warn(Type callingType, string message, bool showHttpTrace, params Func<object>[] formatItems)
{
Mandate.ParameterNotNull(callingType, "callingType");
Mandate.ParameterNotNullOrEmpty(message, "message");
if (showHttpTrace && HttpContext.Current != null)
{
HttpContext.Current.Trace.Warn(callingType.Name, string.Format(message, formatItems.Select(x => x.Invoke()).ToArray()));
}
var logger = LogManager.GetLogger(callingType);
if (logger == null || !logger.IsWarnEnabled) return;
logger.WarnFormat(PrefixThreadId(message), formatItems.Select(x => x.Invoke()).ToArray());
}
public static void WarnWithException(Type callingType, string message, Exception e, params Func<object>[] formatItems)
{
WarnWithException(callingType, message, false, e, formatItems);
}
public static void WarnWithException(Type callingType, string message, bool showHttpTrace, Exception e, params Func<object>[] formatItems)
{
Mandate.ParameterNotNull(e, "e");
Mandate.ParameterNotNull(callingType, "callingType");
Mandate.ParameterNotNullOrEmpty(message, "message");
if (showHttpTrace && HttpContext.Current != null)
{
HttpContext.Current.Trace.Warn(
callingType.Name,
string.Format(message, formatItems.Select(x => x.Invoke()).ToArray()),
e);
}
var logger = LogManager.GetLogger(callingType);
if (logger == null || !logger.IsWarnEnabled) return;
var executedParams = formatItems.Select(x => x.Invoke()).ToArray();
logger.WarnFormat(PrefixThreadId(message) + ". Exception: " + e, executedParams);
}
/// <summary>
/// Adds a warn log
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="message"></param>
/// <param name="formatItems"></param>
public static void Warn<T>(string message, params Func<object>[] formatItems)
{
Warn(typeof(T), message, formatItems);
}
public static void Warn<T>(string message, bool showHttpTrace, params Func<object>[] formatItems)
{
Warn(typeof(T), message, showHttpTrace, formatItems);
}
public static void WarnWithException<T>(string message, Exception e, params Func<object>[] formatItems)
{
WarnWithException(typeof(T), message, e, formatItems);
}
public static void WarnWithException<T>(string message, bool showHttpTrace, Exception e, params Func<object>[] formatItems)
{
WarnWithException(typeof(T), message, showHttpTrace, e, formatItems);
}
#endregion
#region Info
/// <summary>
/// Traces a message, only generating the message if tracing is actually enabled. Use this method to avoid calling any long-running methods such as "ToDebugString" if logging is disabled.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="generateMessage">The delegate to generate a message.</param>
/// <remarks></remarks>
public static void Info<T>(Func<string> generateMessage)
{
Info(typeof(T), generateMessage);
}
/// <summary>
/// Traces if tracing is enabled.
/// </summary>
/// <param name="callingType"></param>
/// <param name="generateMessage"></param>
public static void Info(Type callingType, Func<string> generateMessage)
{
var logger = LogManager.GetLogger(callingType);
if (logger == null || !logger.IsInfoEnabled) return;
logger.Info(PrefixThreadId(generateMessage.Invoke()));
}
/// <summary>
/// Traces if tracing is enabled.
/// </summary>
/// <param name="type">The type for the logging namespace.</param>
/// <param name="generateMessageFormat">The message format.</param>
/// <param name="formatItems">The format items.</param>
public static void Info(Type type, string generateMessageFormat, params Func<object>[] formatItems)
{
var logger = LogManager.GetLogger(type);
if (logger == null || !logger.IsInfoEnabled) return;
var executedParams = formatItems.Select(x => x.Invoke()).ToArray();
logger.InfoFormat(PrefixThreadId(generateMessageFormat), executedParams);
}
/// <summary>
/// Traces a message, only generating the message if tracing is actually enabled. Use this method to avoid calling any long-running methods such as "ToDebugString" if logging is disabled.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="generateMessageFormat">The generate message format.</param>
/// <param name="formatItems">The format items.</param>
/// <remarks></remarks>
public static void Info<T>(string generateMessageFormat, params Func<object>[] formatItems)
{
Info(typeof(T), generateMessageFormat, formatItems);
}
#endregion
#region Debug
/// <summary>
/// Debugs a message, only generating the message if tracing is actually enabled. Use this method to avoid calling any long-running methods such as "ToDebugString" if logging is disabled.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="generateMessage">The delegate to generate a message.</param>
/// <remarks></remarks>
public static void Debug<T>(Func<string> generateMessage)
{
Debug(typeof(T), generateMessage);
}
/// <summary>
/// Debugs if tracing is enabled.
/// </summary>
/// <param name="callingType"></param>
/// <param name="generateMessage"></param>
public static void Debug(Type callingType, Func<string> generateMessage)
{
var logger = LogManager.GetLogger(callingType);
if (logger == null || !logger.IsDebugEnabled) return;
logger.Debug(PrefixThreadId(generateMessage.Invoke()));
}
/// <summary>
/// Debugs if tracing is enabled.
/// </summary>
/// <param name="type">The type for the logging namespace.</param>
/// <param name="generateMessageFormat">The message format.</param>
/// <param name="formatItems">The format items.</param>
public static void Debug(Type type, string generateMessageFormat, params Func<object>[] formatItems)
{
var logger = LogManager.GetLogger(type);
if (logger == null || !logger.IsDebugEnabled) return;
var executedParams = formatItems.Select(x => x.Invoke()).ToArray();
logger.DebugFormat(PrefixThreadId(generateMessageFormat), executedParams);
}
/// <summary>
/// Debugs a message, only generating the message if debug is actually enabled. Use this method to avoid calling any long-running methods such as "ToDebugString" if logging is disabled.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="generateMessageFormat">The generate message format.</param>
/// <param name="formatItems">The format items.</param>
/// <remarks></remarks>
public static void Debug<T>(string generateMessageFormat, params Func<object>[] formatItems)
{
Debug(typeof(T), generateMessageFormat, formatItems);
}
/// <summary>
/// Debugs a message and also writes to the TraceContext specified, useful for when you would like the debug
/// output also displayed in the Http trace output.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="generateMessageFormat"></param>
/// <param name="showHttpTrace"></param>
/// <param name="formatItems"></param>
public static void Debug<T>(string generateMessageFormat, bool showHttpTrace, params Func<object>[] formatItems)
{
if (showHttpTrace && HttpContext.Current != null)
{
HttpContext.Current.Trace.Write(
typeof(T).Name,
string.Format(generateMessageFormat, formatItems.Select(x => x()).ToArray()));
}
Debug(typeof(T), generateMessageFormat, formatItems);
}
#endregion
}
}
@@ -0,0 +1,44 @@
using System;
using System.Threading.Tasks;
namespace Umbraco.Core.Logging
{
internal static class LoggingTaskExtension
{
/// <summary>
/// This task shouldn't be waited on (as it's not guaranteed to run), and you shouldn't wait on the parent task either (because it might throw an
/// exception that doesn't get handled). If you want to be waiting on something, use LogErrorsWaitable instead.
///
/// None of these methods are suitable for tasks that return a value. If you're wanting a result, you should probably be handling
/// errors yourself.
/// </summary>
public static Task LogErrors(this Task task, Action<string, Exception> logMethod)
{
return task.ContinueWith(t => LogErrorsInner(t, logMethod), TaskContinuationOptions.OnlyOnFaulted);
}
/// <summary>
/// This task can be waited on (as it's guaranteed to run), and you should wait on this rather than the parent task. Because it's
/// guaranteed to run, it may be slower than using LogErrors, and you should consider using that method if you don't want to wait.
///
/// None of these methods are suitable for tasks that return a value. If you're wanting a result, you should probably be handling
/// errors yourself.
/// </summary>
public static Task LogErrorsWaitable(this Task task, Action<string, Exception> logMethod)
{
return task.ContinueWith(t => LogErrorsInner(t, logMethod));
}
private static void LogErrorsInner(Task task, Action<string, Exception> logAction)
{
if (task.Exception != null)
{
logAction("Aggregate Exception with " + task.Exception.InnerExceptions.Count + " inner exceptions: ", task.Exception);
foreach (var innerException in task.Exception.InnerExceptions)
{
logAction("Inner exception from aggregate exception: ", innerException);
}
}
}
}
}
+87
View File
@@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Umbraco.Core.Macros
{
/// <summary>
/// Parses the macro syntax in a string and renders out it's contents
/// </summary>
internal class MacroTagParser
{
/// <summary>
/// This will accept a text block and seach/parse it for macro markup.
/// When either a text block or a a macro is found, it will call the callback method.
/// </summary>
/// <param name="text"> </param>
/// <param name="textFoundCallback"></param>
/// <param name="macroFoundCallback"></param>
/// <returns></returns>
/// <remarks>
/// This method simply parses the macro contents, it does not create a string or result,
/// this is up to the developer calling this method to implement this with the callbacks.
/// </remarks>
internal static void ParseMacros(
string text,
Action<string> textFoundCallback,
Action<string, Dictionary<string, string>> macroFoundCallback )
{
if (textFoundCallback == null) throw new ArgumentNullException("textFoundCallback");
if (macroFoundCallback == null) throw new ArgumentNullException("macroFoundCallback");
string elementText = text;
var fieldResult = new StringBuilder(elementText);
//NOTE: This is legacy code, this is definitely not the correct way to do a while loop! :)
var stop = false;
while (!stop)
{
var tagIndex = fieldResult.ToString().ToLower().IndexOf("<?umbraco");
if (tagIndex < 0)
tagIndex = fieldResult.ToString().ToLower().IndexOf("<umbraco:macro");
if (tagIndex > -1)
{
var tempElementContent = "";
//text block found, call the call back method
textFoundCallback(fieldResult.ToString().Substring(0, tagIndex));
fieldResult.Remove(0, tagIndex);
var tag = fieldResult.ToString().Substring(0, fieldResult.ToString().IndexOf(">") + 1);
var attributes = XmlHelper.GetAttributesFromElement(tag);
// Check whether it's a single tag (<?.../>) or a tag with children (<?..>...</?...>)
if (tag.Substring(tag.Length - 2, 1) != "/" && tag.IndexOf(" ") > -1)
{
String closingTag = "</" + (tag.Substring(1, tag.IndexOf(" ") - 1)) + ">";
// Tag with children are only used when a macro is inserted by the umbraco-editor, in the
// following format: "<?UMBRACO_MACRO ...><IMG SRC="..."..></?UMBRACO_MACRO>", so we
// need to delete extra information inserted which is the image-tag and the closing
// umbraco_macro tag
if (fieldResult.ToString().IndexOf(closingTag) > -1)
{
fieldResult.Remove(0, fieldResult.ToString().IndexOf(closingTag));
}
}
var macroAlias = attributes.ContainsKey("macroalias") ? attributes["macroalias"] : attributes["alias"];
//call the callback now that we have the macro parsed
macroFoundCallback(macroAlias, attributes);
fieldResult.Remove(0, fieldResult.ToString().IndexOf(">") + 1);
fieldResult.Insert(0, tempElementContent);
}
else
{
//text block found, call the call back method
textFoundCallback(fieldResult.ToString());
stop = true; //break;
}
}
}
}
}
@@ -1,10 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace umbraco.editorControls.macrocontainer
namespace Umbraco.Core.Macros
{
/// <summary>
/// NOTE: This is legacy code, might require a cleanup
/// </summary>
[Serializable]
internal class PersistableMacroProperty
{
+107
View File
@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Umbraco.Core
{
/// <summary>
/// Helper class for mandating values, for example on method parameters.
/// </summary>
internal static class Mandate
{
/// <summary>
/// Mandates that the specified parameter is not null.
/// </summary>
/// <param name="value">The value.</param>
/// <param name="paramName">Name of the param.</param>
/// <exception cref="ArgumentNullException">If <paramref name="value"/> is null.</exception>
public static void ParameterNotNull<T>(T value, string paramName) where T : class
{
That(value != null, () => new ArgumentNullException(paramName));
}
/// <summary>
/// Mandates that the specified parameter is not null.
/// </summary>
/// <param name="value">The value.</param>
/// <param name="paramName">Name of the param.</param>
/// <exception cref="ArgumentNullException">If <paramref name="value"/> is null or whitespace.</exception>
public static void ParameterNotNullOrEmpty(string value, string paramName)
{
That(!string.IsNullOrWhiteSpace(value), () => new ArgumentNullException(paramName));
}
/// <summary>
/// Mandates that the specified sequence is not null and has at least one element.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="sequence">The sequence.</param>
/// <param name="paramName">Name of the param.</param>
public static void ParameterNotNullOrEmpty<T>(IEnumerable<T> sequence, string paramName)
{
ParameterNotNull(sequence, paramName);
ParameterCondition(sequence.Any(), paramName);
}
/// <summary>
/// Mandates that the specified parameter matches the condition.
/// </summary>
/// <param name="condition">The condition to check.</param>
/// <param name="paramName">Name of the param.</param>
/// <exception cref="ArgumentException">If the condition is false.</exception>
public static void ParameterCondition(bool condition, string paramName)
{
ParameterCondition(condition, paramName, (string)null);
}
/// <summary>
/// Mandates that the specified parameter matches the condition.
/// </summary>
/// <param name="condition">The condition to check.</param>
/// <param name="paramName">Name of the param.</param>
/// <param name="message">The message.</param>
/// <exception cref="ArgumentException">If the condition is false.</exception>
public static void ParameterCondition(bool condition, string paramName, string message)
{
// Warning: don't make this method have an optional message parameter (removing the other ParameterCondition overload) as it will
// make binaries compiled against previous Framework libs incompatible unneccesarily
message = message ?? "A parameter passed into a method was not a valid value";
That(condition, () => new ArgumentException(message, paramName));
}
/// <summary>
/// Mandates that the specified condition is true, otherwise throws an exception specified in <typeparamref name="TException"/>.
/// </summary>
/// <typeparam name="TException">The type of the exception.</typeparam>
/// <param name="condition">if set to <c>true</c>, throws exception <typeparamref name="TException"/>.</param>
/// <exception cref="Exception">An exception of type <typeparamref name="TException"/> is raised if the condition is false.</exception>
public static void That<TException>(bool condition) where TException : Exception, new()
{
if (!condition)
throw ActivatorHelper.CreateInstance<TException>();
}
/// <summary>
/// Mandates that the specified condition is true, otherwise throws an exception specified in <typeparamref name="TException"/>.
/// </summary>
/// <typeparam name="TException">The type of the exception.</typeparam>
/// <param name="condition">if set to <c>true</c>, throws exception <typeparamref name="TException"/>.</param>
/// <param name="defer">Deffered expression to call if the exception should be raised.</param>
/// <exception cref="Exception">An exception of type <typeparamref name="TException"/> is raised if the condition is false.</exception>
public static void That<TException>(bool condition, Func<TException> defer) where TException : Exception, new()
{
if (!condition)
{
throw defer.Invoke();
}
// Here is an example of how this method is actually called
//object myParam = null;
//Mandate.That(myParam != null,
// textManager => new ArgumentNullException(textManager.Get("blah", new {User = "blah"})));
}
}
}
@@ -0,0 +1,11 @@
using System.Collections.Generic;
namespace Umbraco.Core.Media
{
public interface IImageUrlProvider
{
string Name { get; }
string GetImageUrlFromMedia(int mediaId, IDictionary<string, string> parameters);
string GetImageUrlFromFileName(string specifiedSrc, IDictionary<string, string> parameters);
}
}
@@ -0,0 +1,9 @@
namespace Umbraco.Core.Media
{
public interface IThumbnailProvider
{
bool CanProvideThumbnail(string fileUrl);
string GetThumbnailUrl(string fileUrl);
}
}

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